Customized SNICInterface

Fork of NySNICInterface by Ryo Iizuka

Revision:
33:33f1bc919486
Parent:
32:ae95309643aa
Child:
36:f33fcf5975ab
--- a/SNIC/SNIC_Core.h	Fri May 30 08:30:40 2014 +0000
+++ b/SNIC/SNIC_Core.h	Tue Jun 03 08:53:07 2014 +0000
@@ -75,8 +75,9 @@
 friend class C_SNIC_UartCommandManager;
 friend class C_SNIC_WifiInterface;
 friend class TCPSocketConnection;
+friend class TCPSocketServer;
+friend class UDPSocket;
 friend class Socket;
-friend class TCPSocketServer;
 
 private:
     /** Wi-Fi Network type
@@ -98,6 +99,16 @@
         bool                is_accept;
     }tagCONNECT_INFO_T;
 
+    /** UDP Recv information
+    */
+    typedef struct {
+        CircBuffer<char>    *recvbuf_p;
+        int                 from_ip;
+        short               from_port;
+        int                 parent_socket;
+        bool                is_received;
+    }tagUDP_RECVINFO_T;
+
     /** GEN_FW_VER_GET_REQ Command */
     typedef struct 
     {
@@ -184,6 +195,35 @@
         unsigned char timeout;
     }tagSNIC_TCP_CONNECT_TO_SERVER_REQ_T;
     
+    /** SNIC_UDP_SIMPLE_SEND_REQ */
+    typedef struct
+    {
+        unsigned char cmd_sid;
+        unsigned char seq;
+        unsigned char remote_ip[4];
+        unsigned char remote_port[2];
+        unsigned char payload_len[2];
+    }tagSNIC_UDP_SIMPLE_SEND_REQ_T;
+
+    /** SNIC_UDP_CREATE_SOCKET_REQ */
+    typedef struct
+    {
+        unsigned char  cmd_sid;
+        unsigned char  seq;
+        unsigned char  bind;
+        unsigned char  local_addr[4];
+        unsigned char  local_port[2];
+    }tagSNIC_UDP_CREATE_SOCKET_REQ_T;
+    
+    /** SNIC_UDP_START_RECV_REQ */
+    typedef struct
+    {
+        unsigned char  cmd_sid;
+        unsigned char  seq;
+        unsigned char  socket_id;
+        unsigned char  recv_bufsize[2];
+    }tagSNIC_UDP_START_RECV_REQ_T;
+
     /** SNIC_GET_DHCP_INFO_REQ */
     typedef struct
     {
@@ -296,7 +336,14 @@
     */
     C_SNIC_Core::tagCONNECT_INFO_T   *getConnectInfo( int socket_id );
 
-    /**
+    /** 
+        Get pointer of UDP Recv information.
+        @param socket_id    Socket ID
+        @return The pointer of UDP Recv information
+    */
+    C_SNIC_Core::tagUDP_RECVINFO_T   *getUdpRecvInfo( int socket_id );
+
+                                /**
         Get pointer of the instance of C_SNIC_UartCommandManager.
         @return The pointer of the instance of C_SNIC_UartCommandManager.
     */
@@ -326,7 +373,10 @@
     /** Socket buffer */
     tagCONNECT_INFO_T   mConnectInfo[MAX_SOCKET_ID+1];
   
-    /** Constructor
+    /** UDP Information */
+    tagUDP_RECVINFO_T   mUdpRecvInfo[MAX_SOCKET_ID+1];
+
+/** Constructor
      */
     C_SNIC_Core();