net/udp.h

gehe zur Dokumentation dieser Datei
00001 
00002 //***************************************************************************
00003 //*            udp.h
00004 //*
00005 //*  Mon Jul 31 21:47:03 2006
00006 //*  Copyright  2006  sharan
00007 //*  Email
00008 //*
00009 //****************************************************************************/
00010 /*
00011  *  This program is free software; you can redistribute it and/or modify
00012  *  it under the terms of the GNU General Public License as published by
00013  *  the Free Software Foundation; either version 2 of the License, or
00014  *  (at your option) any later version.
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU General Public License for more details.
00020  *
00021  *  You should have received a copy of the GNU General Public License
00022  *  along with this program; if not, write to the Free Software
00023  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00024  */
00025 #ifndef _UDP_H
00026         #define _UDP_H
00027         
00028         /* -----------------------------------------------------------------------------------------------------------*/
00037         /* -----------------------------------------------------------------------------------------------------------*/
00038         void udp( unsigned int packet_lenght, unsigned char * ethernetbuffer );
00039         
00040         /* -----------------------------------------------------------------------------------------------------------*/
00048         /* -----------------------------------------------------------------------------------------------------------*/
00049         unsigned int UDP_SendPacket( unsigned int SOCKET, unsigned int Datalenght, unsigned char * UDP_Databuffer );
00050 
00051         /* -----------------------------------------------------------------------------------------------------------*/
00059         /* -----------------------------------------------------------------------------------------------------------*/
00060         unsigned int UDP_RegisterSocket( unsigned long IP, unsigned int DestinationPort, unsigned int Bufferlenght, unsigned char * UDP_Recivebuffer);
00061 
00062         /* -----------------------------------------------------------------------------------------------------------*/
00070         /* -----------------------------------------------------------------------------------------------------------*/
00071         unsigned int UDP_ListenOnPort( unsigned int Port, unsigned int Bufferlenght, unsigned char * UDP_Recivebuffer);
00072         
00073         /* -----------------------------------------------------------------------------------------------------------*/
00078         /* -----------------------------------------------------------------------------------------------------------*/
00079         unsigned int UDP_GetSocketState( unsigned int SOCKET );
00080         
00081         /* -----------------------------------------------------------------------------------------------------------*/
00089         /* -----------------------------------------------------------------------------------------------------------*/
00090         unsigned int UDP_GetByteInBuffer( unsigned int SOCKET );
00091 
00092         /* -----------------------------------------------------------------------------------------------------------*/
00097         /* -----------------------------------------------------------------------------------------------------------*/
00098          void UDP_FreeBuffer( unsigned int SOCKET );
00099         
00100         /* -----------------------------------------------------------------------------------------------------------*/
00105         /* -----------------------------------------------------------------------------------------------------------*/
00106         unsigned int UDP_CloseSocket( unsigned int SOCKET );
00107         
00108         unsigned int UDP_Getfreesocket( void );
00109         unsigned int UDP_GetSocket( unsigned char * ethernetbuffer );
00110         unsigned int MakeUDPheader( unsigned int SOCKET, unsigned int Datalenght, unsigned char * ethernetbuffer );
00111         
00112         #define MAX_UDP_CONNECTIONS 4
00113         #define UDP_HEADER_LENGHT 8
00114         
00119         struct UDP_SOCKET {
00120                 volatile unsigned char Socketstate;
00121                 volatile unsigned long DestinationIP;
00122                 volatile unsigned int SourcePort;
00123                 volatile unsigned int DestinationPort;
00124                 volatile unsigned char MACadress[6];
00125                 volatile unsigned int Bufferlenght;
00126                 volatile unsigned int Bufferfill;
00127                 volatile unsigned char * Recivebuffer;
00128         };
00129         
00130         #define SOCKET_NOT_USE          0x00                    // SOCKET ist Frei
00131         #define SOCKET_READY            0x10                    // Socket ist Bereit zur Benutzung
00132         #define SOCKET_BUSY                     0x20                    // SOCKET belegt ...
00133         
00137         struct UDP_header {
00138                 volatile unsigned int UDP_SourcePort;
00139                 volatile unsigned int UDP_DestinationPort;
00140                 volatile unsigned int UDP_Datalenght;
00141                 volatile unsigned int UDP_Checksum;
00142         };
00143 
00144 #endif /* _UDP_H */

Erzeugt am Mon Sep 25 19:53:16 2006 für MikroEthernetBoard von  doxygen 1.4.6