Subversion Repositories f9daq

Rev

Blame | Last modification | View Log | RSS feed

  1. #ifndef SiTCP_H
  2. #define SiTCP_H
  3.  
  4. //#include<iostream>
  5. #include<stdio.h>
  6. #include<stdlib.h>
  7. #include<errno.h>
  8. //#include<string>
  9. //#include<cstring>
  10. //#include<arpa/inet.h>
  11. #include <Winsock2.h>
  12. //#include<fstream>
  13.  
  14. //#include<unistd.h>
  15.  
  16. #define EINPROGRESS     115     /* Operation now in progress */
  17.  
  18. struct bcp_header{
  19.   unsigned char type;
  20.   unsigned char command;
  21.   unsigned char id;
  22.   unsigned char length;
  23.   unsigned int address;
  24. };
  25.  
  26.  
  27. char* sitcpIpAddr;
  28. unsigned int tcpPort;
  29. unsigned int udpPort;
  30. int udpsock;
  31. int tcpsock;
  32. struct sockaddr_in tcpAddr;
  33. //  struct sockaddr_in udpAddr;
  34.  
  35. fd_set rmask, wmask, readfds;
  36. struct timeval timeout;
  37. //struct bcp_header sndHeader;
  38. //unsigned char sndBuf[2048];
  39.  
  40. struct bcp_header SiTCPsndHeader;
  41. unsigned char SiTCPsndBuf[2048];
  42. unsigned char SiTCPsndData[256];
  43. struct sockaddr_in SiTCPudpAddr;
  44.  
  45. void SiTCPinit();
  46. void SiTCPclose();
  47. int SiTCPSetIPPort(char* IpAddr, unsigned int tcp, unsigned int udp);
  48. int SiTCPCreateUDPSock();
  49. int SiTCPCloseUDPSock();
  50. int SiTCPCreateTCPSock();
  51. int SiTCPCloseTCPSock();
  52.  
  53. //int GetTCPSock(){return tcpsock;}
  54. //int GetUDPSock(){return udpsock;}
  55. int SiTCPGetTCPSock();
  56. int SiTCPGetUDPSock();
  57.  
  58. void SiTCPRBCPskeleton(unsigned char type, unsigned char command, unsigned char id,
  59.             unsigned char length, unsigned int address);
  60.  
  61. int SiTCPrcvRBCP_ACK(int output);
  62.  
  63. struct bcp_header SiTCPGetsndHeader();
  64.         //bcp_header GetsndHeader() const {return sndHeader;}
  65.  
  66. #endif
  67.