]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Tcp4Dxe/Socket.h
[Change summary]:
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / Socket.h
index a5576a5aaddadae1effd0597a7578f8e33ec558a..e98fb62324b67d8631831e62f27a42b2bb064f50 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Socket header file.\r
 \r
-Copyright (c) 2005 - 2006, Intel Corporation<BR>\r
+Copyright (c) 2005 - 2009, Intel Corporation<BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -68,23 +68,19 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 ///\r
 /// Socket state\r
 ///\r
-typedef enum {\r
-  SO_CLOSED       = 0,\r
-  SO_LISTENING,\r
-  SO_CONNECTING,\r
-  SO_CONNECTED,\r
-  SO_DISCONNECTING\r
-} SOCK_STATE;\r
+#define SO_CLOSED        0\r
+#define SO_LISTENING     1\r
+#define SO_CONNECTING    2\r
+#define SO_CONNECTED     3\r
+#define SO_DISCONNECTING 4\r
 \r
 ///\r
 /// Socket configure state\r
 ///\r
-typedef enum {\r
-  SO_UNCONFIGURED       = 0,\r
-  SO_CONFIGURED_ACTIVE,\r
-  SO_CONFIGURED_PASSIVE,\r
-  SO_NO_MAPPING\r
-} SOCK_CONFIGURE_STATE;\r
+#define SO_UNCONFIGURED        0\r
+#define SO_CONFIGURED_ACTIVE   1\r
+#define SO_CONFIGURED_PASSIVE  2\r
+#define SO_NO_MAPPING          3\r
 \r
 /**\r
   Set socket SO_NO_MORE_DATA flag.\r
@@ -331,44 +327,44 @@ typedef struct _SOCK_COMPLETION_TOKEN {
   EFI_STATUS  Status;           ///< The status to be issued\r
 } SOCK_COMPLETION_TOKEN;\r
 \r
+typedef union {\r
+  VOID  *RxData;\r
+  VOID  *TxData;\r
+} SOCK_IO_DATA;\r
+\r
 ///\r
 /// The application token with data packet\r
 ///\r
 typedef struct _SOCK_IO_TOKEN {\r
   SOCK_COMPLETION_TOKEN Token;\r
-  union {\r
-    VOID  *RxData;\r
-    VOID  *TxData;\r
-  } Packet;\r
+  SOCK_IO_DATA          Packet;\r
 } SOCK_IO_TOKEN;\r
 \r
 ///\r
 ///  The request issued from socket layer to protocol layer.  \r
 ///\r
-typedef enum {\r
-  SOCK_ATTACH,    ///< Attach current socket to a new PCB\r
-  SOCK_DETACH,    ///< Detach current socket from the PCB\r
-  SOCK_CONFIGURE, ///< Configure attached PCB\r
-  SOCK_FLUSH,     ///< Flush attached PCB\r
-  SOCK_SND,       ///< Need protocol to send something\r
-  SOCK_SNDPUSH,   ///< Need protocol to send pushed data\r
-  SOCK_SNDURG,    ///< Need protocol to send urgent data\r
-  SOCK_CONSUMED,  ///< Application has retrieved data from socket\r
-  SOCK_CONNECT,   ///< Need to connect to a peer\r
-  SOCK_CLOSE,     ///< Need to close the protocol process\r
-  SOCK_ABORT,     ///< Need to reset the protocol process\r
-  SOCK_POLL,      ///< Need to poll to the protocol layer\r
-  SOCK_ROUTE,     ///< Need to add a route information\r
-  SOCK_MODE,      ///< Need to get the mode data of the protocol\r
-  SOCK_GROUP      ///< Need to join a mcast group\r
-} SOCK_REQUEST;\r
+#define SOCK_ATTACH     0    ///< Attach current socket to a new PCB\r
+#define SOCK_DETACH     1    ///< Detach current socket from the PCB\r
+#define SOCK_CONFIGURE  2    ///< Configure attached PCB\r
+#define SOCK_FLUSH      3    ///< Flush attached PCB\r
+#define SOCK_SND        4    ///< Need protocol to send something\r
+#define SOCK_SNDPUSH    5    ///< Need protocol to send pushed data\r
+#define SOCK_SNDURG     6    ///< Need protocol to send urgent data\r
+#define SOCK_CONSUMED   7    ///< Application has retrieved data from socket\r
+#define SOCK_CONNECT    8    ///< Need to connect to a peer\r
+#define SOCK_CLOSE      9    ///< Need to close the protocol process\r
+#define SOCK_ABORT      10   ///< Need to reset the protocol process\r
+#define SOCK_POLL       11   ///< Need to poll to the protocol layer\r
+#define SOCK_ROUTE      12   ///< Need to add a route information\r
+#define SOCK_MODE       13   ///< Need to get the mode data of the protocol\r
+#define SOCK_GROUP      14   ///< Need to join a mcast group\r
 \r
 ///\r
 ///  The socket type.\r
 ///\r
 typedef enum {\r
-  SOCK_DGRAM, ///< This socket providing datagram service\r
-  SOCK_STREAM ///< This socket providing stream service\r
+  SockDgram, ///< This socket providing datagram service\r
+  SockStream ///< This socket providing stream service\r
 } SOCK_TYPE;\r
 \r
 ///\r
@@ -396,7 +392,7 @@ typedef
 EFI_STATUS\r
 (*SOCK_PROTO_HANDLER) (\r
   IN SOCKET       *Socket,\r
-  IN SOCK_REQUEST Request,\r
+  IN UINT8        Request,\r
   IN VOID         *RequestData\r
   );\r
   \r
@@ -413,13 +409,13 @@ EFI_STATUS
   Set the state of the socket.\r
 \r
   @param  Sock                  Pointer to the socket.\r
-  @param  State                 The new state to be set.\r
+  @param  State                 The new socket state to be set.\r
 \r
 **/\r
 VOID\r
 SockSetState (\r
   IN OUT SOCKET     *Sock,\r
-  IN     SOCK_STATE State\r
+  IN     UINT8      State\r
   );\r
 \r
 /**\r
@@ -592,7 +588,7 @@ VOID
 ///\r
 typedef struct _SOCK_INIT_DATA {\r
   SOCK_TYPE   Type;\r
-  SOCK_STATE  State;\r
+  UINT8       State;\r
 \r
   SOCKET      *Parent;        ///< The parent of this socket\r
   UINT32      BackLog;        ///< The connection limit for listening socket\r
@@ -641,9 +637,9 @@ struct _SOCKET {
   EFI_DEVICE_PATH_PROTOCOL  *ParentDevicePath;\r
   EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
   LIST_ENTRY                Link;  \r
-  SOCK_CONFIGURE_STATE  ConfigureState;\r
+  UINT8                 ConfigureState;\r
   SOCK_TYPE             Type;\r
-  SOCK_STATE            State;\r
+  UINT8                 State;\r
   UINT16                Flag;\r
   EFI_LOCK              Lock;       ///< The lock of socket\r
   SOCK_BUFFER           SndBuffer;  ///< Send buffer of application's data\r