Marco Hsu / WIFI_API_32kRAM
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers socket_internal.h Source File

socket_internal.h

00001 /*
00002 @file   
00003     socket_internal.h
00004 
00005 @brief  
00006 */
00007 #ifndef __SOCKET_INTERNAL_H__
00008 #define __SOCKET_INTERNAL_H__
00009 
00010 
00011 #ifdef  __cplusplus
00012 extern "C" {
00013 #endif
00014 
00015 /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
00016 INCLUDES
00017 *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
00018 
00019 #include "socket_nmc.h"
00020 
00021 
00022 /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
00023 MACROS
00024 *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
00025 
00026 
00027 #define SOCKET_CMD_INVALID              0x00
00028 /*< Invlaid Socket command value.
00029 */
00030 #define SOCKET_CMD_BIND                 0x41
00031 /*< Socket Binding command value.
00032 */
00033 #define SOCKET_CMD_LISTEN               0x42
00034 /*< Socket Listening command value.
00035 */
00036 #define SOCKET_CMD_ACCEPT               0x43
00037 /*< Socket Accepting command value.
00038 */
00039 #define SOCKET_CMD_CONNECT              0x44
00040 /*< Socket Connecting command value.
00041 */
00042 #define SOCKET_CMD_SEND                 0x45
00043 /*< Socket send command value.
00044 */
00045 #define SOCKET_CMD_RECV                 0x46
00046 /*< Socket Recieve command value.
00047 */
00048 #define SOCKET_CMD_SENDTO               0x47
00049 /*< Socket sendTo command value.
00050 */
00051 #define SOCKET_CMD_RECVFROM             0x48
00052 /*< Socket RecieveFrom command value.
00053 */
00054 #define SOCKET_CMD_CLOSE                0x49
00055 /*< Socket Close command value.
00056 */
00057 #define SOCKET_CMD_DNS_RESOLVE          0x4A
00058 /*< Socket DNS Resolve command value.
00059 */
00060 #define SOCKET_CMD_SSL_CONNECT          0x4B
00061 /*< SSL-Socket Connect command value.
00062 */
00063 #define SOCKET_CMD_SSL_SEND             0x4C    
00064 /*< SSL-Socket Send command value.
00065 */  
00066 #define SOCKET_CMD_SSL_RECV             0x4D
00067 /*< SSL-Socket Recieve command value.
00068 */
00069 #define SOCKET_CMD_SSL_CLOSE            0x4E
00070 /*< SSL-Socket Close command value.
00071 */
00072 #define SOCKET_CMD_DHCP_CLIENT          0x4F
00073 /*< DHCP Client command value.
00074 */
00075 #define SOCKET_CMD_TCP_ERROR            0x50
00076 /*!< TCP Error command value.
00077 */
00078 
00079 
00080 /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
00081 DATA TYPES
00082 *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
00083 
00084 
00085 /*
00086 *  @brief   
00087 */
00088 typedef struct{ 
00089     uint16      u16Family;
00090     uint16      u16Port;
00091     uint32      u32IPAddr;
00092 }tstrSockAddr;
00093 
00094 
00095 
00096 /*
00097 @struct \
00098     tstrDnsReply
00099     
00100 @brief
00101     DNS Reply, contains hostName and HostIP.
00102 */
00103 typedef struct{
00104     char    acHostName[HOSTNAME_MAX_SIZE];
00105     uint32  u32HostIP;
00106 }tstrDnsReply;
00107 
00108 
00109 /*
00110 @struct \
00111     tstrDhcpClientReply
00112 
00113 @brief
00114     DHCP Client Reply, contains OfferIP.
00115 */
00116 typedef struct{
00117     uint32  u32OfferIP;
00118     uint32  u32GatewayIP;
00119 }tstrDhcpClientReply;
00120 
00121 /*
00122 @struct \
00123     tstrConnectReply
00124     
00125 @brief
00126     Connect Reply, contains sock number and error value
00127 */
00128 typedef struct{
00129     SOCKET      sock;
00130     sint8       s8Error;
00131     uint16      u16Void;
00132 }tstrConnectReply;
00133 
00134 
00135 /*
00136 @struct \
00137     tstrTCPErrorReply
00138  
00139 @brief
00140     Connect Reply, contains sock number and error value
00141 */
00142 typedef struct{
00143     SOCKET      sock;
00144     sint8       s8Error;
00145     uint16      u16Void;
00146 }tstrTCPErrorReply;
00147  
00148 /*
00149 *  @brief
00150 */
00151 typedef struct{
00152     tstrSockAddr    strAddr;
00153     SOCKET          sListenSock;
00154     SOCKET          sConnectedSock;
00155     uint16          u16Void;
00156 }tstrAcceptReply;
00157 
00158 
00159 /*
00160 @brief
00161 */
00162 typedef struct{
00163     SOCKET      sock;
00164     sint8       s8Status;
00165     uint16      u16Void;
00166 }tstrBindReply;
00167 
00168 
00169 /*
00170 @struct \
00171     tstrSocketRecvMsg
00172     
00173 @brief  Socket recv status. 
00174 
00175     It is passed to the APPSocketEventHandler with SOCKET_MSG_RECV or SOCKET_MSG_RECVFROM message type 
00176     in a response to a user call to the recv or recvfrom.
00177     If the received data from the remote peer is larger than the USER Buffer size (given at recv call), the data is 
00178     delivered to the user in a number of consecutive chunks according to the USER Buffer size.
00179 */
00180 typedef struct{
00181     SOCKET      sock;
00182     sint8       s8Status;
00183     uint16      u16Void;
00184 }tstrListenReply;
00185 
00186 
00187 /*
00188 @struct \
00189     tstrSendReply
00190     
00191 @brief
00192     Send Reply, contains socket number and number of sent bytes.
00193 */
00194 typedef struct{
00195     SOCKET      sock;
00196     uint8       u8Void;
00197     sint16      s16SentBytes;
00198 }tstrSendReply;
00199 
00200 
00201 /*
00202 @struct
00203 @brief
00204 */
00205 typedef struct{
00206     tstrSockAddr    strRemoteAddr;
00207     sint16          s16RecvStatus;
00208     uint16          u16DataOffset;
00209     SOCKET          sock;
00210     uint8           u8Void;
00211     uint16          u16Void;
00212 }tstrRecvReply;
00213 
00214 /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
00215 FUNCTION PROTOTYPES
00216 *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
00217 
00218 NMI_API void Socket_ReadSocketData(SOCKET sock, tstrSocketRecvMsg *pstrRecv,uint8 u8SocketMsg,
00219                                   uint32 u32StartAddress,uint16 u16ReadCount, uint8 u8Skip);
00220 
00221 #ifdef  __cplusplus
00222 }
00223 #endif /* __cplusplus */
00224 
00225 #endif /* __SOCKET_H__ */
00226