Subversion Repositories f9daq

Rev

Blame | Last modification | View Log | RSS feed

#ifndef SiTCP_H
#define SiTCP_H

//#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<errno.h>
//#include<string>
//#include<cstring>
//#include<arpa/inet.h>
#include <Winsock2.h>
//#include<fstream>

//#include<unistd.h>

#define EINPROGRESS     115     /* Operation now in progress */

struct bcp_header{
  unsigned char type;
  unsigned char command;
  unsigned char id;
  unsigned char length;
  unsigned int address;
};


char* sitcpIpAddr;
unsigned int tcpPort;
unsigned int udpPort;
int udpsock;
int tcpsock;
struct sockaddr_in tcpAddr;
//  struct sockaddr_in udpAddr;

fd_set rmask, wmask, readfds;
struct timeval timeout;
//struct bcp_header sndHeader;
//unsigned char sndBuf[2048];

struct bcp_header SiTCPsndHeader;
unsigned char SiTCPsndBuf[2048];
unsigned char SiTCPsndData[256];
struct sockaddr_in SiTCPudpAddr;

void SiTCPinit();
void SiTCPclose();
int SiTCPSetIPPort(char* IpAddr, unsigned int tcp, unsigned int udp);
int SiTCPCreateUDPSock();
int SiTCPCloseUDPSock();
int SiTCPCreateTCPSock();
int SiTCPCloseTCPSock();

//int GetTCPSock(){return tcpsock;}
//int GetUDPSock(){return udpsock;}
int SiTCPGetTCPSock();
int SiTCPGetUDPSock();

void SiTCPRBCPskeleton(unsigned char type, unsigned char command, unsigned char id,
            unsigned char length, unsigned int address);

int SiTCPrcvRBCP_ACK(int output);

struct bcp_header SiTCPGetsndHeader();
        //bcp_header GetsndHeader() const {return sndHeader;}

#endif