sockets.h

来自「embedded ethernet code for pic18F」· C头文件 代码 · 共 55 行

H
55
字号
/* Basic socket include: must be included by all server implementations */

typedef struct
{
	unsigned fin : 1;
	unsigned ack : 1;
	unsigned push : 1;
	unsigned syn : 1;
	unsigned rst : 1;
	unsigned : 3;
} FLAGS;


typedef struct
{
	unsigned char ip[4];
	unsigned int port;
	unsigned int srcPort;
	unsigned char mac[6];
	//unsigned int (*callback)(unsigned int,FLAGS *,unsigned char *);
	void (*putData)(unsigned int,FLAGS *,unsigned char *);
	unsigned int (*getData)(FLAGS *,unsigned char *);
	unsigned syn :1;
	unsigned est :1;
	unsigned fin :1;
	unsigned :5;
	unsigned long seq;
	unsigned long clientSeq;
	unsigned long ack;
	
} SOCKETINFO;

// the number of server sockets that the system exposes to clients

#define NSOCKETS 3



// Routine which sets up the sockets available to the program

void initSocketInfo(void);

// utility routines available to server functionality.  Takes a FLAGS structure associated to the packet currently being processed
// and allows the server to interrogate it as to session state (are we at the start or end of a session) and to change session
// state (end it, force a push, force a reset) 

unsigned int isFirstPacket(FLAGS *);
unsigned int isFinalPacket(FLAGS *);
void makeFinalPacket(FLAGS *);
unsigned int isPushPacket(FLAGS *);
void makePushPacket(FLAGS *);
void makeResetPacket(FLAGS *);


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?