00001 /*############################################################################## 00002 00003 nIP - nano IP stack 00004 00005 File : socket.h 00006 00007 Description : Internetstack Sockets 00008 00009 Copyright notice: 00010 00011 Copyright (C) 2005 - 00012 Andreas Dittrich, dittrich@informatik.hu-berlin.de 00013 Jon Kowal, kowal@informatik.hu-berlin.de 00014 00015 This program is free software; you can redistribute it and/or 00016 modify it under the terms of the GNU General Public License 00017 as published by the Free Software Foundation; either version 2 00018 of the License, or (at your option) any later version. 00019 00020 This program is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 GNU General Public License for more details. 00024 00025 You should have received a copy of the GNU General Public License 00026 along with this program; if not, write to the Free Software 00027 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00028 00029 ##############################################################################*/ 00030 00031 #ifndef _NIP_SOCKET_H 00032 #define _NIP_SOCKET_H 00033 00034 00035 #ifndef NIP_MAX_SOCKETS 00036 #define NIP_MAX_SOCKETS 10 00037 #endif 00038 00039 /** Type for addressing sockets. Most significant bit determines UDP/TCP 00040 * - MSB = 1 => TCP Socket 00041 * - MSB = 0 => UDP Socket 00042 */ 00043 #if ( NIP_MAX_SOCKETS < 256 ) 00044 typedef uint8_t nip_socket_id_t; 00045 #elif ( NIP_MAX_SOCKETS < 65536 ) 00046 typedef uint16_t nip_socket_id_t; 00047 #else 00048 typedef uint32_t nip_socket_id_t; 00049 #endif 00050 00051 00052 /** Entry of socket array */ 00053 typedef struct 00054 { 00055 nip_socket_id_t id; 00056 nip_ip_addr ip_addr; 00057 uint16_t port; 00058 } nip_socket_t; 00059 00060 00061 #endif /* _NIP_SOCKET_H */ 00062