00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _UDP_H
00011 #define _UDP_H
00012
00013
00022
00023 void udp( unsigned int packet_lenght, unsigned char * ethernetbuffer );
00024
00025
00033
00034 unsigned int UDP_SendPacket( unsigned int SOCKET, unsigned int Datalenght, unsigned char * UDP_Databuffer );
00035
00036
00044
00045 unsigned int UDP_RegisterSocket( unsigned long IP, unsigned int DestinationPort, unsigned int Bufferlenght, unsigned char * UDP_Recivebuffer);
00046
00047
00052
00053 unsigned int UDP_GetSocketState( unsigned int SOCKET );
00054
00055
00063
00064 unsigned int UDP_GetByteInBuffer( unsigned int SOCKET );
00065
00066
00071
00072 void UDP_FreeBuffer( unsigned int SOCKET );
00073
00074
00079
00080 unsigned int UDP_CloseSocket( unsigned int SOCKET );
00081
00082 unsigned int UDP_Getfreesocket( void );
00083 unsigned int UDP_GetSocket( unsigned char * ethernetbuffer );
00084 unsigned int MakeUDPheader( unsigned int SOCKET, unsigned int Datalenght, unsigned char * ethernetbuffer );
00085
00086 #define MAX_UDP_CONNECTIONS 2
00087 #define UDP_HEADER_LENGHT 8
00088
00093 struct UDP_SOCKET {
00094 volatile unsigned char Socketstate;
00095 volatile unsigned long DestinationIP;
00096 volatile unsigned int SourcePort;
00097 volatile unsigned int DestinationPort;
00098 volatile unsigned char MACadress[6];
00099 volatile unsigned int Bufferlenght;
00100 volatile unsigned int Bufferfill;
00101 volatile unsigned char * Recivebuffer;
00102 };
00103
00104 #define SOCKET_NOT_USE 0x00 // SOCKET ist Frei
00105 #define SOCKET_READY 0x10 // Socket ist Bereit zur Benutzung
00106 #define SOCKET_BUSY 0x20 // SOCKET belegt ...
00107
00111 struct UDP_header {
00112 volatile unsigned int UDP_SourcePort;
00113 volatile unsigned int UDP_DestinationPort;
00114 volatile unsigned int UDP_Datalenght;
00115 volatile unsigned int UDP_Checksum;
00116 };
00117
00118 #endif