Line 36... |
Line 36... |
IP_FIN_CLIENT,
|
IP_FIN_CLIENT,
|
IP_FIN_SERVER,
|
IP_FIN_SERVER,
|
IP_CLOSED
|
IP_CLOSED
|
} IPState_e;
|
} IPState_e;
|
|
|
typedef void (*IPFuncPtr)();
|
typedef struct IPSocket IPSocket;
|
|
typedef void (*IPSendFuncPtr)(uint8 *packet, int length);
|
|
typedef void (*IPSockFuncPtr)(IPSocket *sock);
|
|
typedef void (*IPCallbackPtr)(IPSocket *sock, uint8 *buf, int bytes);
|
|
|
typedef struct IPFrame {
|
typedef struct IPFrame {
|
uint8 packet[PACKET_SIZE];
|
uint8 packet[PACKET_SIZE];
|
struct IPFrame *next, *prev;
|
struct IPFrame *next, *prev;
|
struct IPSocket *socket;
|
struct IPSocket *socket;
|
uint32 seqEnd;
|
uint32 seqEnd;
|
uint16 length;
|
uint16 length;
|
short timeout;
|
short timeout;
|
uint8 state, retryCnt;
|
uint8 state, retryCnt;
|
|
uint8 pad1, pad2;
|
} IPFrame;
|
} IPFrame;
|
|
|
typedef struct IPSocket {
|
struct IPSocket {
|
struct IPSocket *next, *prev;
|
struct IPSocket *next, *prev;
|
IPState_e state;
|
IPState_e state;
|
uint32 seq;
|
uint32 seq;
|
uint32 seqReceived;
|
uint32 seqReceived;
|
uint32 seqWindow;
|
uint32 seqWindow;
|
Line 69... |
Line 73... |
int readOffset;
|
int readOffset;
|
struct IPFrame *frameSend;
|
struct IPFrame *frameSend;
|
int sendOffset;
|
int sendOffset;
|
void *fileOut;
|
void *fileOut;
|
void *fileIn;
|
void *fileIn;
|
IPFuncPtr funcPtr;
|
IPSockFuncPtr funcPtr;
|
IPFuncPtr userFunc;
|
IPCallbackPtr userFunc;
|
void *userPtr;
|
void *userPtr;
|
void *userPtr2;
|
void *userPtr2;
|
uint32 userData;
|
uint32 userData;
|
uint32 userData2;
|
uint32 userData2;
|
} IPSocket;
|
};
|
|
|
//ethernet.c
|
//ethernet.c
|
void EthernetSendPacket(const unsigned char *packet, int length); //Windows
|
void EthernetSendPacket(const unsigned char *packet, int length); //Windows
|
void EthernetInit(unsigned char MacAddress[6]);
|
void EthernetInit(unsigned char MacAddress[6]);
|
int EthernetReceive(unsigned char *buffer, int length);
|
int EthernetReceive(unsigned char *buffer, int length);
|
void EthernetTransmit(unsigned char *buffer, int length);
|
void EthernetTransmit(unsigned char *buffer, int length);
|
|
|
//tcpip.c
|
//tcpip.c
|
void IPInit(IPFuncPtr frameSendFunction, uint8 macAddress[6], char name[6]);
|
void IPInit(IPSendFuncPtr frameSendFunction, uint8 macAddress[6], char name[6]);
|
IPFrame *IPFrameGet(int freeCount);
|
IPFrame *IPFrameGet(int freeCount);
|
int IPProcessEthernetPacket(IPFrame *frameIn, int length);
|
int IPProcessEthernetPacket(IPFrame *frameIn, int length);
|
void IPTick(void);
|
void IPTick(void);
|
|
|
IPSocket *IPOpen(IPMode_e mode, uint32 ipAddress, uint32 port, IPFuncPtr funcPtr);
|
IPSocket *IPOpen(IPMode_e mode, uint32 ipAddress, uint32 port, IPSockFuncPtr funcPtr);
|
void IPWriteFlush(IPSocket *socket);
|
void IPWriteFlush(IPSocket *socket);
|
uint32 IPWrite(IPSocket *socket, const uint8 *buf, uint32 length);
|
uint32 IPWrite(IPSocket *socket, const uint8 *buf, uint32 length);
|
uint32 IPRead(IPSocket *socket, uint8 *buf, uint32 length);
|
uint32 IPRead(IPSocket *socket, uint8 *buf, uint32 length);
|
void IPClose(IPSocket *socket);
|
void IPClose(IPSocket *socket);
|
#ifdef IPPRINTF
|
#ifdef IPPRINTF
|
void IPPrintf(IPSocket *socket, char *message, int arg0, int arg1, int arg2, int arg3);
|
void IPPrintf(IPSocket *socket, char *message, int arg0, int arg1, int arg2, int arg3);
|
#else
|
#else
|
void IPPrintf(IPSocket *socket, char *message, ...);
|
void IPPrintf(IPSocket *socket, char *message, ...);
|
#endif
|
#endif
|
void IPResolve(char *name, IPFuncPtr resolvedFunc, void *arg);
|
void IPResolve(char *name, IPCallbackPtr resolvedFunc, void *arg);
|
uint32 IPAddressSelf(void);
|
uint32 IPAddressSelf(void);
|
|
|
//http.c
|
//http.c
|
#define HTML_LENGTH_CALLBACK -2
|
#define HTML_LENGTH_CALLBACK -2
|
#define HTML_LENGTH_LIST_END -1
|
#define HTML_LENGTH_LIST_END -1
|
Line 119... |
Line 123... |
|
|
//netutil.c
|
//netutil.c
|
void FtpdInit(int UseFiles);
|
void FtpdInit(int UseFiles);
|
IPSocket *FtpTransfer(uint32 ip, char *user, char *passwd,
|
IPSocket *FtpTransfer(uint32 ip, char *user, char *passwd,
|
char *filename, uint8 *buf, int size,
|
char *filename, uint8 *buf, int size,
|
int send, void (*callback)(uint8 *data, int size));
|
int send, IPCallbackPtr callback);
|
void TftpdInit(void);
|
void TftpdInit(void);
|
IPSocket *TftpTransfer(uint32 ip, char *filename, uint8 *buffer, int size,
|
IPSocket *TftpTransfer(uint32 ip, char *filename, uint8 *buffer, int size,
|
void (*callback)(uint8 *data, int bytes));
|
IPCallbackPtr callback);
|
void ConsoleInit(void);
|
void ConsoleInit(void);
|
void *IPNameValue(const char *name, void *value);
|
void *IPNameValue(const char *name, void *value);
|
|
|
#endif //__TCPIP_H__
|
#endif //__TCPIP_H__
|
|
|
No newline at end of file
|
No newline at end of file
|