2 Interface function of the Socket.
4 Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 Check whether the Event is in the List.
21 @param[in] List Pointer to the token list to be searched.
22 @param[in] Event The event to be checked.
24 @retval TRUE The specific Event exists in the List.
25 @retval FALSE The specific Event is not in the List.
29 SockTokenExistedInList (
34 LIST_ENTRY
*ListEntry
;
35 SOCK_TOKEN
*SockToken
;
37 NET_LIST_FOR_EACH (ListEntry
, List
) {
38 SockToken
= NET_LIST_USER_STRUCT (
44 if (Event
== SockToken
->Token
->Event
) {
53 Call SockTokenExistedInList() to check whether the Event is
54 in the related socket's lists.
56 @param[in] Sock Pointer to the instance's socket.
57 @param[in] Event The event to be checked.
59 @retval TRUE The Event exists in related socket's lists.
60 @retval FALSE The Event is not in related socket's lists.
70 if (SockTokenExistedInList (&Sock
->SndTokenList
, Event
) ||
71 SockTokenExistedInList (&Sock
->ProcessingSndTokenList
, Event
) ||
72 SockTokenExistedInList (&Sock
->RcvTokenList
, Event
) ||
73 SockTokenExistedInList (&Sock
->ListenTokenList
, Event
)
79 if ((Sock
->ConnectionToken
!= NULL
) && (Sock
->ConnectionToken
->Event
== Event
)) {
84 if ((Sock
->CloseToken
!= NULL
) && (Sock
->CloseToken
->Event
== Event
)) {
92 Buffer a token into the specific list of the socket Sock.
94 @param[in] Sock Pointer to the instance's socket.
95 @param[in] List Pointer to the list to store the token.
96 @param[in] Token Pointer to the token to be buffered.
97 @param[in] DataLen The data length of the buffer contained in Token.
99 @return Pointer to the token that wraps Token. If NULL, an error condition occurred.
110 SOCK_TOKEN
*SockToken
;
112 SockToken
= AllocateZeroPool (sizeof (SOCK_TOKEN
));
113 if (NULL
== SockToken
) {
117 "SockBufferIOToken: No Memory to allocate SockToken\n")
123 SockToken
->Sock
= Sock
;
124 SockToken
->Token
= (SOCK_COMPLETION_TOKEN
*) Token
;
125 SockToken
->RemainDataLen
= DataLen
;
126 InsertTailList (List
, &SockToken
->TokenList
);
132 Destroy the socket Sock and its associated protocol control block.
134 @param[in, out] Sock The socket to be destroyed.
136 @retval EFI_SUCCESS The socket Sock was destroyed successfully.
137 @retval EFI_ACCESS_DENIED Failed to get the lock to access the socket.
146 TCP_PROTO_DATA
*ProtoData
;
148 EFI_GUID
*IpProtocolGuid
;
149 EFI_GUID
*TcpProtocolGuid
;
152 ASSERT ((Sock
!= NULL
) && (Sock
->ProtoHandler
!= NULL
));
154 if (Sock
->InDestroy
) {
158 Sock
->InDestroy
= TRUE
;
160 if (Sock
->IpVersion
== IP_VERSION_4
) {
161 IpProtocolGuid
= &gEfiIp4ProtocolGuid
;
162 TcpProtocolGuid
= &gEfiTcp4ProtocolGuid
;
164 IpProtocolGuid
= &gEfiIp6ProtocolGuid
;
165 TcpProtocolGuid
= &gEfiTcp6ProtocolGuid
;
167 ProtoData
= (TCP_PROTO_DATA
*) Sock
->ProtoReserved
;
168 Tcb
= ProtoData
->TcpPcb
;
170 ASSERT (Tcb
!= NULL
);
173 // Close the IP protocol.
176 Tcb
->IpInfo
->ChildHandle
,
178 ProtoData
->TcpService
->IpIo
->Image
,
182 if (Sock
->DestroyCallback
!= NULL
) {
183 Sock
->DestroyCallback (Sock
, Sock
->Context
);
187 // Retrieve the protocol installed on this sock
189 Status
= gBS
->OpenProtocol (
195 EFI_OPEN_PROTOCOL_GET_PROTOCOL
198 if (EFI_ERROR (Status
)) {
202 "SockDestroyChild: Open protocol installed on socket failed with %r\n",
208 // Uninstall the protocol installed on this sock
210 gBS
->UninstallMultipleProtocolInterfaces (
218 Status
= EfiAcquireLockOrFail (&(Sock
->Lock
));
219 if (EFI_ERROR (Status
)) {
223 "SockDestroyChild: Get the lock to access socket failed with %r\n",
227 return EFI_ACCESS_DENIED
;
231 // force protocol layer to detach the PCB
233 Status
= Sock
->ProtoHandler (Sock
, SOCK_DETACH
, NULL
);
235 if (EFI_ERROR (Status
)) {
239 "SockDestroyChild: Protocol detach socket failed with %r\n",
243 Sock
->InDestroy
= FALSE
;
244 } else if (SOCK_IS_CONFIGURED (Sock
)) {
246 SockConnFlush (Sock
);
247 SockSetState (Sock
, SO_CLOSED
);
249 Sock
->ConfigureState
= SO_UNCONFIGURED
;
252 EfiReleaseLock (&(Sock
->Lock
));
254 if (EFI_ERROR (Status
)) {
263 Create a socket and its associated protocol control block
264 with the intial data SockInitData and protocol specific
267 @param[in] SockInitData Inital data to setting the socket.
269 @return Pointer to the newly created socket. If NULL, an error condition occured.
274 IN SOCK_INIT_DATA
*SockInitData
280 EFI_GUID
*TcpProtocolGuid
;
283 // create a new socket
285 Sock
= SockCreate (SockInitData
);
290 "SockCreateChild: No resource to create a new socket\n")
296 Status
= EfiAcquireLockOrFail (&(Sock
->Lock
));
297 if (EFI_ERROR (Status
)) {
301 "SockCreateChild: Get the lock to access socket failed with %r\n",
307 // inform the protocol layer to attach the socket
308 // with a new protocol control block
310 Status
= Sock
->ProtoHandler (Sock
, SOCK_ATTACH
, NULL
);
311 EfiReleaseLock (&(Sock
->Lock
));
312 if (EFI_ERROR (Status
)) {
316 "SockCreateChild: Protocol failed to attach a socket with %r\n",
326 if (Sock
->DestroyCallback
!= NULL
) {
327 Sock
->DestroyCallback (Sock
, Sock
->Context
);
330 if (Sock
->IpVersion
== IP_VERSION_4
) {
331 TcpProtocolGuid
= &gEfiTcp4ProtocolGuid
;
333 TcpProtocolGuid
= &gEfiTcp6ProtocolGuid
;
342 EFI_OPEN_PROTOCOL_GET_PROTOCOL
345 // Uninstall the protocol installed on this sock
347 gBS
->UninstallMultipleProtocolInterfaces (
358 Configure the specific socket Sock using configuration data ConfigData.
360 @param[in] Sock Pointer to the socket to be configured.
361 @param[in] ConfigData Pointer to the configuration data.
363 @retval EFI_SUCCESS The socket configured successfully.
364 @retval EFI_ACCESS_DENIED Failed to get the lock to access the socket, or the
365 socket is already configured.
376 Status
= EfiAcquireLockOrFail (&(Sock
->Lock
));
377 if (EFI_ERROR (Status
)) {
381 "SockConfigure: Get the access for socket failed with %r",
385 return EFI_ACCESS_DENIED
;
388 if (SOCK_IS_CONFIGURED (Sock
)) {
389 Status
= EFI_ACCESS_DENIED
;
393 ASSERT (Sock
->State
== SO_CLOSED
);
395 Status
= Sock
->ProtoHandler (Sock
, SOCK_CONFIGURE
, ConfigData
);
398 EfiReleaseLock (&(Sock
->Lock
));
404 Initiate a connection establishment process.
406 @param[in] Sock Pointer to the socket to initiate the initate the
408 @param[in] Token Pointer to the token used for the connection
411 @retval EFI_SUCCESS The connection initialized successfully.
412 @retval EFI_ACCESS_DENIED Failed to get the lock to access the socket, or the
413 socket is closed, or the socket is not configured to
414 be an active one, or the token is already in one of
416 @retval EFI_NO_MAPPING The IP address configuration operation is not
418 @retval EFI_NOT_STARTED The socket is not configured.
430 Status
= EfiAcquireLockOrFail (&(Sock
->Lock
));
431 if (EFI_ERROR (Status
)) {
435 "SockConnect: Get the access for socket failed with %r",
439 return EFI_ACCESS_DENIED
;
442 if (SOCK_IS_NO_MAPPING (Sock
)) {
443 Status
= EFI_NO_MAPPING
;
447 if (SOCK_IS_UNCONFIGURED (Sock
)) {
449 Status
= EFI_NOT_STARTED
;
453 if (!SOCK_IS_CLOSED (Sock
) || !SOCK_IS_CONFIGURED_ACTIVE (Sock
)) {
455 Status
= EFI_ACCESS_DENIED
;
459 Event
= ((SOCK_COMPLETION_TOKEN
*) Token
)->Event
;
461 if (SockTokenExisted (Sock
, Event
)) {
463 Status
= EFI_ACCESS_DENIED
;
467 Sock
->ConnectionToken
= (SOCK_COMPLETION_TOKEN
*) Token
;
468 SockSetState (Sock
, SO_CONNECTING
);
469 Status
= Sock
->ProtoHandler (Sock
, SOCK_CONNECT
, NULL
);
472 EfiReleaseLock (&(Sock
->Lock
));
477 Issue a listen token to get an existed connected network instance
478 or wait for a connection if there is none.
480 @param[in] Sock Pointer to the socket to accept connections.
481 @param[in] Token The token to accept a connection.
483 @retval EFI_SUCCESS Either a connection is accpeted or the Token is
484 buffered for further acception.
485 @retval EFI_ACCESS_DENIED Failed to get the lock to access the socket, or the
486 socket is closed, or the socket is not configured to
487 be a passive one, or the token is already in one of
489 @retval EFI_NO_MAPPING The IP address configuration operation is not
491 @retval EFI_NOT_STARTED The socket is not configured.
492 @retval EFI_OUT_OF_RESOURCE Failed to buffer the Token due to memory limits.
501 EFI_TCP4_LISTEN_TOKEN
*ListenToken
;
502 LIST_ENTRY
*ListEntry
;
507 ASSERT (SockStream
== Sock
->Type
);
509 Status
= EfiAcquireLockOrFail (&(Sock
->Lock
));
510 if (EFI_ERROR (Status
)) {
514 "SockAccept: Get the access for socket failed with %r",
518 return EFI_ACCESS_DENIED
;
521 if (SOCK_IS_NO_MAPPING (Sock
)) {
522 Status
= EFI_NO_MAPPING
;
526 if (SOCK_IS_UNCONFIGURED (Sock
)) {
528 Status
= EFI_NOT_STARTED
;
532 if (!SOCK_IS_LISTENING (Sock
)) {
534 Status
= EFI_ACCESS_DENIED
;
538 Event
= ((SOCK_COMPLETION_TOKEN
*) Token
)->Event
;
540 if (SockTokenExisted (Sock
, Event
)) {
542 Status
= EFI_ACCESS_DENIED
;
546 ListenToken
= (EFI_TCP4_LISTEN_TOKEN
*) Token
;
549 // Check if a connection has already in this Sock->ConnectionList
551 NET_LIST_FOR_EACH (ListEntry
, &Sock
->ConnectionList
) {
553 Socket
= NET_LIST_USER_STRUCT (ListEntry
, SOCKET
, ConnectionList
);
555 if (SOCK_IS_CONNECTED (Socket
)) {
556 ListenToken
->NewChildHandle
= Socket
->SockHandle
;
557 SIGNAL_TOKEN (&(ListenToken
->CompletionToken
), EFI_SUCCESS
);
559 RemoveEntryList (ListEntry
);
561 ASSERT (Socket
->Parent
!= NULL
);
563 Socket
->Parent
->ConnCnt
--;
567 "SockAccept: Accept a socket, now conncount is %d",
568 Socket
->Parent
->ConnCnt
)
570 Socket
->Parent
= NULL
;
577 // Buffer this token for latter incoming connection request
579 if (NULL
== SockBufferToken (Sock
, &(Sock
->ListenTokenList
), Token
, 0)) {
581 Status
= EFI_OUT_OF_RESOURCES
;
585 EfiReleaseLock (&(Sock
->Lock
));
591 Issue a token with data to the socket to send out.
593 @param[in] Sock Pointer to the socket to process the token with
595 @param[in] Token The token with data that needs to send out.
597 @retval EFI_SUCCESS The token processed successfully.
598 @retval EFI_ACCESS_DENIED Failed to get the lock to access the socket, or the
599 socket is closed, or the socket is not in a
600 synchronized state , or the token is already in one
601 of this socket's lists.
602 @retval EFI_NO_MAPPING The IP address configuration operation is not
604 @retval EFI_NOT_STARTED The socket is not configured.
605 @retval EFI_OUT_OF_RESOURCE Failed to buffer the token due to memory limits.
614 SOCK_IO_TOKEN
*SndToken
;
617 EFI_TCP4_TRANSMIT_DATA
*TxData
;
619 SOCK_TOKEN
*SockToken
;
622 ASSERT (SockStream
== Sock
->Type
);
624 Status
= EfiAcquireLockOrFail (&(Sock
->Lock
));
625 if (EFI_ERROR (Status
)) {
629 "SockSend: Get the access for socket failed with %r",
633 return EFI_ACCESS_DENIED
;
636 if (SOCK_IS_NO_MAPPING (Sock
)) {
637 Status
= EFI_NO_MAPPING
;
641 SndToken
= (SOCK_IO_TOKEN
*) Token
;
642 TxData
= (EFI_TCP4_TRANSMIT_DATA
*) SndToken
->Packet
.TxData
;
644 if (SOCK_IS_UNCONFIGURED (Sock
)) {
645 Status
= EFI_NOT_STARTED
;
649 if (!(SOCK_IS_CONNECTING (Sock
) || SOCK_IS_CONNECTED (Sock
))) {
651 Status
= EFI_ACCESS_DENIED
;
656 // check if a token is already in the token buffer
658 Event
= SndToken
->Token
.Event
;
660 if (SockTokenExisted (Sock
, Event
)) {
661 Status
= EFI_ACCESS_DENIED
;
665 DataLen
= TxData
->DataLength
;
668 // process this sending token now or buffer it only?
670 FreeSpace
= SockGetFreeSpace (Sock
, SOCK_SND_BUF
);
672 if ((FreeSpace
< Sock
->SndBuffer
.LowWater
) || !SOCK_IS_CONNECTED (Sock
)) {
674 SockToken
= SockBufferToken (
681 if (NULL
== SockToken
) {
682 Status
= EFI_OUT_OF_RESOURCES
;
686 SockToken
= SockBufferToken (
688 &Sock
->ProcessingSndTokenList
,
693 if (NULL
== SockToken
) {
696 "SockSend: Failed to buffer IO token into socket processing SndToken List\n",
700 Status
= EFI_OUT_OF_RESOURCES
;
704 Status
= SockProcessTcpSndData (Sock
, TxData
);
706 if (EFI_ERROR (Status
)) {
709 "SockSend: Failed to process Snd Data\n",
713 RemoveEntryList (&(SockToken
->TokenList
));
714 FreePool (SockToken
);
719 EfiReleaseLock (&(Sock
->Lock
));
724 Issue a token to get data from the socket.
726 @param[in] Sock Pointer to the socket to get data from.
727 @param[in] Token The token to store the received data from the
730 @retval EFI_SUCCESS The token processed successfully.
731 @retval EFI_ACCESS_DENIED Failed to get the lock to access the socket, or the
732 socket is closed, or the socket is not in a
733 synchronized state , or the token is already in one
734 of this socket's lists.
735 @retval EFI_NO_MAPPING The IP address configuration operation is not
737 @retval EFI_NOT_STARTED The socket is not configured.
738 @retval EFI_CONNECTION_FIN The connection is closed and there is no more data.
739 @retval EFI_OUT_OF_RESOURCE Failed to buffer the token due to memory limit.
748 SOCK_IO_TOKEN
*RcvToken
;
753 ASSERT (SockStream
== Sock
->Type
);
755 Status
= EfiAcquireLockOrFail (&(Sock
->Lock
));
756 if (EFI_ERROR (Status
)) {
760 "SockRcv: Get the access for socket failed with %r",
764 return EFI_ACCESS_DENIED
;
767 if (SOCK_IS_NO_MAPPING (Sock
)) {
769 Status
= EFI_NO_MAPPING
;
773 if (SOCK_IS_UNCONFIGURED (Sock
)) {
775 Status
= EFI_NOT_STARTED
;
779 if (!(SOCK_IS_CONNECTED (Sock
) || SOCK_IS_CONNECTING (Sock
))) {
781 Status
= EFI_ACCESS_DENIED
;
785 RcvToken
= (SOCK_IO_TOKEN
*) Token
;
788 // check if a token is already in the token buffer of this socket
790 Event
= RcvToken
->Token
.Event
;
791 if (SockTokenExisted (Sock
, Event
)) {
792 Status
= EFI_ACCESS_DENIED
;
796 RcvToken
= (SOCK_IO_TOKEN
*) Token
;
797 RcvdBytes
= GET_RCV_DATASIZE (Sock
);
800 // check whether an error has happened before
802 if (EFI_ABORTED
!= Sock
->SockError
) {
804 SIGNAL_TOKEN (&(RcvToken
->Token
), Sock
->SockError
);
805 Sock
->SockError
= EFI_ABORTED
;
810 // check whether can not receive and there is no any
811 // data buffered in Sock->RcvBuffer
813 if (SOCK_IS_NO_MORE_DATA (Sock
) && (0 == RcvdBytes
)) {
815 Status
= EFI_CONNECTION_FIN
;
819 if (RcvdBytes
!= 0) {
820 SockProcessRcvToken (Sock
, RcvToken
);
822 Status
= Sock
->ProtoHandler (Sock
, SOCK_CONSUMED
, NULL
);
825 if (NULL
== SockBufferToken (Sock
, &Sock
->RcvTokenList
, RcvToken
, 0)) {
826 Status
= EFI_OUT_OF_RESOURCES
;
831 EfiReleaseLock (&(Sock
->Lock
));
836 Reset the socket and its associated protocol control block.
838 @param[in, out] Sock Pointer to the socket to be flushed.
840 @retval EFI_SUCCESS The socket is flushed successfully.
841 @retval EFI_ACCESS_DENIED Failed to get the lock to access the socket.
851 ASSERT (SockStream
== Sock
->Type
);
853 Status
= EfiAcquireLockOrFail (&(Sock
->Lock
));
854 if (EFI_ERROR (Status
)) {
858 "SockFlush: Get the access for socket failed with %r",
862 return EFI_ACCESS_DENIED
;
865 if (!SOCK_IS_CONFIGURED (Sock
)) {
867 Status
= EFI_ACCESS_DENIED
;
871 Status
= Sock
->ProtoHandler (Sock
, SOCK_FLUSH
, NULL
);
872 if (EFI_ERROR (Status
)) {
876 "SockFlush: Protocol failed handling SOCK_FLUSH with %r",
883 SOCK_ERROR (Sock
, EFI_ABORTED
);
884 SockConnFlush (Sock
);
885 SockSetState (Sock
, SO_CLOSED
);
887 Sock
->ConfigureState
= SO_UNCONFIGURED
;
890 EfiReleaseLock (&(Sock
->Lock
));
895 Close or abort the socket associated connection.
897 @param[in, out] Sock Pointer to the socket of the connection to close
899 @param[in] Token The token for a close operation.
900 @param[in] OnAbort TRUE for aborting the connection; FALSE to close it.
902 @retval EFI_SUCCESS The close or abort operation initialized
904 @retval EFI_ACCESS_DENIED Failed to get the lock to access the socket, or the
905 socket is closed, or the socket is not in a
906 synchronized state , or the token is already in one
907 of this socket's lists.
908 @retval EFI_NO_MAPPING The IP address configuration operation is not
910 @retval EFI_NOT_STARTED The socket is not configured.
923 ASSERT (SockStream
== Sock
->Type
);
925 Status
= EfiAcquireLockOrFail (&(Sock
->Lock
));
926 if (EFI_ERROR (Status
)) {
929 "SockClose: Get the access for socket failed with %r",
933 return EFI_ACCESS_DENIED
;
936 if (SOCK_IS_NO_MAPPING (Sock
)) {
937 Status
= EFI_NO_MAPPING
;
941 if (SOCK_IS_UNCONFIGURED (Sock
)) {
942 Status
= EFI_NOT_STARTED
;
946 if (SOCK_IS_DISCONNECTING (Sock
)) {
947 Status
= EFI_ACCESS_DENIED
;
951 Event
= ((SOCK_COMPLETION_TOKEN
*) Token
)->Event
;
953 if (SockTokenExisted (Sock
, Event
)) {
954 Status
= EFI_ACCESS_DENIED
;
958 Sock
->CloseToken
= Token
;
959 SockSetState (Sock
, SO_DISCONNECTING
);
962 Status
= Sock
->ProtoHandler (Sock
, SOCK_ABORT
, NULL
);
964 Status
= Sock
->ProtoHandler (Sock
, SOCK_CLOSE
, NULL
);
968 EfiReleaseLock (&(Sock
->Lock
));
973 Abort the socket associated connection, listen, transmission or receive request.
975 @param[in, out] Sock Pointer to the socket to abort.
976 @param[in] Token Pointer to a token that has been issued by
977 Connect(), Accept(), Transmit() or Receive(). If
978 NULL, all pending tokens issued by the four
979 functions listed above will be aborted.
981 @retval EFI_UNSUPPORTED The operation is not supported in the current
992 Status
= EFI_SUCCESS
;
994 ASSERT (SockStream
== Sock
->Type
);
996 Status
= EfiAcquireLockOrFail (&(Sock
->Lock
));
997 if (EFI_ERROR (Status
)) {
1000 "SockCancel: Get the access for socket failed with %r",
1004 return EFI_ACCESS_DENIED
;
1007 if (SOCK_IS_UNCONFIGURED (Sock
)) {
1008 Status
= EFI_NOT_STARTED
;
1013 // 1. Check ConnectionToken.
1015 if (Token
== NULL
|| (SOCK_COMPLETION_TOKEN
*) Token
== Sock
->ConnectionToken
) {
1016 if (Sock
->ConnectionToken
!= NULL
) {
1017 SIGNAL_TOKEN (Sock
->ConnectionToken
, EFI_ABORTED
);
1018 Sock
->ConnectionToken
= NULL
;
1021 if (Token
!= NULL
) {
1022 Status
= EFI_SUCCESS
;
1028 // 2. Check ListenTokenList.
1030 Status
= SockCancelToken (Token
, &Sock
->ListenTokenList
);
1031 if (Token
!= NULL
&& !EFI_ERROR (Status
)) {
1036 // 3. Check RcvTokenList.
1038 Status
= SockCancelToken (Token
, &Sock
->RcvTokenList
);
1039 if (Token
!= NULL
&& !EFI_ERROR (Status
)) {
1044 // 4. Check SndTokenList.
1046 Status
= SockCancelToken (Token
, &Sock
->SndTokenList
);
1047 if (Token
!= NULL
&& !EFI_ERROR (Status
)) {
1052 // 5. Check ProcessingSndTokenList.
1054 Status
= SockCancelToken (Token
, &Sock
->ProcessingSndTokenList
);
1057 EfiReleaseLock (&(Sock
->Lock
));
1063 Get the mode data of the low layer protocol.
1065 @param[in] Sock Pointer to the socket to get mode data from.
1066 @param[in, out] Mode Pointer to the data to store the low layer mode
1069 @retval EFI_SUCCESS The mode data was obtained successfully.
1070 @retval EFI_NOT_STARTED The socket is not configured.
1079 return Sock
->ProtoHandler (Sock
, SOCK_MODE
, Mode
);
1083 Configure the low level protocol to join a multicast group for
1084 this socket's connection.
1086 @param[in] Sock Pointer to the socket of the connection to join the
1087 specific multicast group.
1088 @param[in] GroupInfo Pointer to the multicast group info.
1090 @retval EFI_SUCCESS The configuration completed successfully.
1091 @retval EFI_ACCESS_DENIED Failed to get the lock to access the socket.
1092 @retval EFI_NOT_STARTED The socket is not configured.
1103 Status
= EfiAcquireLockOrFail (&(Sock
->Lock
));
1105 if (EFI_ERROR (Status
)) {
1109 "SockGroup: Get the access for socket failed with %r",
1113 return EFI_ACCESS_DENIED
;
1116 if (SOCK_IS_UNCONFIGURED (Sock
)) {
1117 Status
= EFI_NOT_STARTED
;
1121 Status
= Sock
->ProtoHandler (Sock
, SOCK_GROUP
, GroupInfo
);
1124 EfiReleaseLock (&(Sock
->Lock
));
1129 Add or remove route information in IP route table associated
1132 @param[in] Sock Pointer to the socket associated with the IP route
1133 table to operate on.
1134 @param[in] RouteInfo Pointer to the route information to be processed.
1136 @retval EFI_SUCCESS The route table updated successfully.
1137 @retval EFI_ACCESS_DENIED Failed to get the lock to access the socket.
1138 @retval EFI_NO_MAPPING The IP address configuration operation is not
1140 @retval EFI_NOT_STARTED The socket is not configured.
1151 Status
= EfiAcquireLockOrFail (&(Sock
->Lock
));
1152 if (EFI_ERROR (Status
)) {
1155 "SockRoute: Get the access for socket failed with %r",
1159 return EFI_ACCESS_DENIED
;
1162 if (SOCK_IS_NO_MAPPING (Sock
)) {
1163 Status
= EFI_NO_MAPPING
;
1167 if (SOCK_IS_UNCONFIGURED (Sock
)) {
1168 Status
= EFI_NOT_STARTED
;
1172 Status
= Sock
->ProtoHandler (Sock
, SOCK_ROUTE
, RouteInfo
);
1175 EfiReleaseLock (&(Sock
->Lock
));