]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/EfiSocketLib/Ip4.c
ShellPkg: Fix ICC11 build failure.
[mirror_edk2.git] / StdLib / EfiSocketLib / Ip4.c
CommitLineData
a88c3163 1/** @file\r
2 Implement the IP4 driver support for the socket layer.\r
3\r
4 Copyright (c) 2011, Intel Corporation\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include "Socket.h"\r
16\r
17\r
18/**\r
19 Get the local socket address\r
20\r
21 This routine returns the IPv4 address associated with the local\r
22 socket.\r
23\r
24 This routine is called by ::EslSocketGetLocalAddress to determine the\r
25 network address for the SOCK_RAW socket.\r
26\r
27 @param [in] pPort Address of an ::ESL_PORT structure.\r
28\r
29 @param [out] pAddress Network address to receive the local system address\r
30\r
31**/\r
32VOID\r
33EslIp4LocalAddressGet (\r
34 IN ESL_PORT * pPort,\r
35 OUT struct sockaddr * pAddress\r
36 )\r
37{\r
38 struct sockaddr_in * pLocalAddress;\r
39 ESL_IP4_CONTEXT * pIp4;\r
40\r
41 DBG_ENTER ( );\r
42\r
43 //\r
44 // Return the local address\r
45 //\r
46 pIp4 = &pPort->Context.Ip4;\r
47 pLocalAddress = (struct sockaddr_in *)pAddress;\r
48 pLocalAddress->sin_family = AF_INET;\r
49 CopyMem ( &pLocalAddress->sin_addr,\r
50 &pIp4->ModeData.ConfigData.StationAddress.Addr[0],\r
51 sizeof ( pLocalAddress->sin_addr ));\r
52\r
53 DBG_EXIT ( );\r
54}\r
55\r
56\r
57/**\r
58 Set the local port address.\r
59\r
60 This routine sets the local port address.\r
61\r
62 This support routine is called by ::EslSocketPortAllocate.\r
63\r
64 @param [in] pPort Address of an ESL_PORT structure\r
65 @param [in] pSockAddr Address of a sockaddr structure that contains the\r
66 connection point on the local machine. An IPv4 address\r
67 of INADDR_ANY specifies that the connection is made to\r
68 all of the network stacks on the platform. Specifying a\r
69 specific IPv4 address restricts the connection to the\r
70 network stack supporting that address. Specifying zero\r
71 for the port causes the network layer to assign a port\r
72 number from the dynamic range. Specifying a specific\r
73 port number causes the network layer to use that port.\r
74\r
75 @param [in] bBindTest TRUE = run bind testing\r
76\r
77 @retval EFI_SUCCESS The operation was successful\r
78\r
79 **/\r
80EFI_STATUS\r
81EslIp4LocalAddressSet (\r
82 IN ESL_PORT * pPort,\r
83 IN CONST struct sockaddr * pSockAddr,\r
84 IN BOOLEAN bBindTest\r
85 )\r
86{\r
87 EFI_IP4_CONFIG_DATA * pConfig;\r
88 CONST struct sockaddr_in * pIpAddress;\r
89 CONST UINT8 * pIpv4Address;\r
90 EFI_STATUS Status;\r
91\r
92 DBG_ENTER ( );\r
93\r
94 //\r
95 // Validate the address\r
96 //\r
97 pIpAddress = (struct sockaddr_in *)pSockAddr;\r
98 if ( INADDR_BROADCAST == pIpAddress->sin_addr.s_addr ) {\r
99 //\r
100 // The local address must not be the broadcast address\r
101 //\r
102 Status = EFI_INVALID_PARAMETER;\r
103 pPort->pSocket->errno = EADDRNOTAVAIL;\r
104 }\r
105 else {\r
106 Status = EFI_SUCCESS;\r
107\r
108 //\r
109 // Set the local address\r
110 //\r
111 pIpAddress = (struct sockaddr_in *)pSockAddr;\r
112 pIpv4Address = (UINT8 *)&pIpAddress->sin_addr.s_addr;\r
113 pConfig = &pPort->Context.Ip4.ModeData.ConfigData;\r
114 pConfig->StationAddress.Addr[0] = pIpv4Address[0];\r
115 pConfig->StationAddress.Addr[1] = pIpv4Address[1];\r
116 pConfig->StationAddress.Addr[2] = pIpv4Address[2];\r
117 pConfig->StationAddress.Addr[3] = pIpv4Address[3];\r
118\r
119 //\r
120 // Determine if the default address is used\r
121 //\r
122 pConfig->UseDefaultAddress = (BOOLEAN)( 0 == pIpAddress->sin_addr.s_addr );\r
123\r
124 //\r
125 // Display the local address\r
126 //\r
127 DEBUG (( DEBUG_BIND,\r
128 "0x%08x: Port, Local IP4 Address: %d.%d.%d.%d\r\n",\r
129 pPort,\r
130 pConfig->StationAddress.Addr[0],\r
131 pConfig->StationAddress.Addr[1],\r
132 pConfig->StationAddress.Addr[2],\r
133 pConfig->StationAddress.Addr[3]));\r
134\r
135 //\r
136 // Set the subnet mask\r
137 //\r
138 if ( pConfig->UseDefaultAddress ) {\r
139 pConfig->SubnetMask.Addr[0] = 0;\r
140 pConfig->SubnetMask.Addr[1] = 0;\r
141 pConfig->SubnetMask.Addr[2] = 0;\r
142 pConfig->SubnetMask.Addr[3] = 0;\r
143 }\r
144 else {\r
145 pConfig->SubnetMask.Addr[0] = 0xff;\r
146 pConfig->SubnetMask.Addr[1] = 0xff;\r
147 pConfig->SubnetMask.Addr[2] = 0xff;\r
148 pConfig->SubnetMask.Addr[3] = 0xff;\r
149 }\r
150 }\r
151\r
152 //\r
153 // Return the operation status\r
154 //\r
155 DBG_EXIT_STATUS ( Status );\r
156 return Status;\r
157}\r
158\r
159\r
160/**\r
161 Get the option value\r
162\r
163 This routine handles the IPv4 level options.\r
164\r
165 The ::EslSocketOptionGet routine calls this routine to retrieve\r
166 the IPv4 options one at a time by name.\r
167\r
168 @param [in] pSocket Address of an ::ESL_SOCKET structure\r
169 @param [in] OptionName Name of the option\r
170 @param [out] ppOptionData Buffer to receive address of option value\r
171 @param [out] pOptionLength Buffer to receive the option length\r
172\r
173 @retval EFI_SUCCESS - Socket data successfully received\r
174\r
175 **/\r
176EFI_STATUS\r
177EslIp4OptionGet (\r
178 IN ESL_SOCKET * pSocket,\r
179 IN int OptionName,\r
180 OUT CONST void ** __restrict ppOptionData,\r
181 OUT socklen_t * __restrict pOptionLength\r
182 )\r
183{\r
184 EFI_STATUS Status;\r
185\r
186 DBG_ENTER ( );\r
187\r
188 //\r
189 // Assume success\r
190 //\r
191 pSocket->errno = 0;\r
192 Status = EFI_SUCCESS;\r
193\r
194 //\r
195 // Attempt to get the option\r
196 //\r
197 switch ( OptionName ) {\r
198 default:\r
199 //\r
200 // Option not supported\r
201 //\r
202 pSocket->errno = ENOPROTOOPT;\r
203 Status = EFI_INVALID_PARAMETER;\r
204 break;\r
205\r
206 case IP_HDRINCL:\r
58081f2c 207 *ppOptionData = (void *)&pSocket->bIncludeHeader;\r
a88c3163 208 *pOptionLength = sizeof ( pSocket->bIncludeHeader );\r
209 break;\r
210 }\r
211\r
212 //\r
213 // Return the operation status\r
214 //\r
215 DBG_EXIT_STATUS ( Status );\r
216 return Status;\r
217}\r
218\r
219\r
220/**\r
221 Set the option value\r
222\r
223 This routine handles the IPv4 level options.\r
224\r
225 The ::EslSocketOptionSet routine calls this routine to adjust\r
226 the IPv4 options one at a time by name.\r
227\r
228 @param [in] pSocket Address of an ::ESL_SOCKET structure\r
229 @param [in] OptionName Name of the option\r
230 @param [in] pOptionValue Buffer containing the option value\r
231 @param [in] OptionLength Length of the buffer in bytes\r
232\r
233 @retval EFI_SUCCESS - Option successfully set\r
234\r
235 **/\r
236EFI_STATUS\r
237EslIp4OptionSet (\r
238 IN ESL_SOCKET * pSocket,\r
239 IN int OptionName,\r
240 IN CONST void * pOptionValue,\r
241 IN socklen_t OptionLength\r
242 )\r
243{\r
244 BOOLEAN bTrueFalse;\r
245 socklen_t LengthInBytes;\r
246 UINT8 * pOptionData;\r
247 EFI_STATUS Status;\r
248\r
249 DBG_ENTER ( );\r
250\r
251 //\r
252 // Assume success\r
253 //\r
254 pSocket->errno = 0;\r
255 Status = EFI_SUCCESS;\r
256\r
257 //\r
258 // Determine if the option protocol matches\r
259 //\r
260 LengthInBytes = 0;\r
261 pOptionData = NULL;\r
262 switch ( OptionName ) {\r
263 default:\r
264 //\r
265 // Protocol level not supported\r
266 //\r
267 DEBUG (( DEBUG_INFO | DEBUG_OPTION, "ERROR - Invalid protocol option\r\n" ));\r
268 pSocket->errno = ENOTSUP;\r
269 Status = EFI_UNSUPPORTED;\r
270 break;\r
271\r
272 case IP_HDRINCL:\r
273\r
274 //\r
275 // Validate the option length\r
276 //\r
277 if ( sizeof ( UINT32 ) == OptionLength ) {\r
278 //\r
279 // Restrict the input to TRUE or FALSE\r
280 //\r
281 bTrueFalse = TRUE;\r
282 if ( 0 == *(UINT32 *)pOptionValue ) {\r
283 bTrueFalse = FALSE;\r
284 }\r
285 pOptionValue = &bTrueFalse;\r
286\r
287 //\r
288 // Set the option value\r
289 //\r
290 pOptionData = (UINT8 *)&pSocket->bIncludeHeader;\r
291 LengthInBytes = sizeof ( pSocket->bIncludeHeader );\r
292 }\r
293 break;\r
294 }\r
295\r
296 //\r
297 // Return the operation status\r
298 //\r
299 DBG_EXIT_STATUS ( Status );\r
300 return Status;\r
301}\r
302\r
303\r
304/**\r
305 Free a receive packet\r
306\r
307 This routine performs the network specific operations necessary\r
308 to free a receive packet.\r
309\r
310 This routine is called by ::EslSocketPortCloseTxDone to free a\r
311 receive packet.\r
312\r
313 @param [in] pPacket Address of an ::ESL_PACKET structure.\r
314 @param [in, out] pRxBytes Address of the count of RX bytes\r
315\r
316**/\r
317VOID\r
318EslIp4PacketFree (\r
319 IN ESL_PACKET * pPacket,\r
320 IN OUT size_t * pRxBytes\r
321 )\r
322{\r
323 EFI_IP4_RECEIVE_DATA * pRxData;\r
324 DBG_ENTER ( );\r
325\r
326 //\r
327 // Account for the receive bytes\r
328 //\r
329 pRxData = pPacket->Op.Ip4Rx.pRxData;\r
330 *pRxBytes -= pRxData->HeaderLength + pRxData->DataLength;\r
331\r
332 //\r
333 // Disconnect the buffer from the packet\r
334 //\r
335 pPacket->Op.Ip4Rx.pRxData = NULL;\r
336\r
337 //\r
338 // Return the buffer to the IP4 driver\r
339 //\r
340 gBS->SignalEvent ( pRxData->RecycleSignal );\r
341 DBG_EXIT ( );\r
342}\r
343\r
344\r
345/**\r
346 Initialize the network specific portions of an ::ESL_PORT structure.\r
347\r
348 This routine initializes the network specific portions of an\r
349 ::ESL_PORT structure for use by the socket.\r
350\r
351 This support routine is called by ::EslSocketPortAllocate\r
352 to connect the socket with the underlying network adapter\r
353 running the IPv4 protocol.\r
354\r
355 @param [in] pPort Address of an ESL_PORT structure\r
356 @param [in] DebugFlags Flags for debug messages\r
357\r
358 @retval EFI_SUCCESS - Socket successfully created\r
359\r
360 **/\r
361EFI_STATUS\r
362EslIp4PortAllocate (\r
363 IN ESL_PORT * pPort,\r
364 IN UINTN DebugFlags\r
365 )\r
366{\r
367 EFI_IP4_CONFIG_DATA * pConfig;\r
368 ESL_SOCKET * pSocket;\r
369 EFI_STATUS Status;\r
370\r
371 DBG_ENTER ( );\r
372\r
373 //\r
374 // Initialize the port\r
375 //\r
376 pSocket = pPort->pSocket;\r
377 pSocket->TxPacketOffset = OFFSET_OF ( ESL_PACKET, Op.Ip4Tx.TxData );\r
378 pSocket->TxTokenEventOffset = OFFSET_OF ( ESL_IO_MGMT, Token.Ip4Tx.Event );\r
379 pSocket->TxTokenOffset = OFFSET_OF ( EFI_IP4_COMPLETION_TOKEN, Packet.TxData );\r
380\r
381 //\r
382 // Save the cancel, receive and transmit addresses\r
383 //\r
384 pPort->pfnConfigure = (PFN_NET_CONFIGURE)pPort->pProtocol.IPv4->Configure;\r
385 pPort->pfnRxCancel = (PFN_NET_IO_START)pPort->pProtocol.IPv4->Cancel;\r
3bdf9aae 386 pPort->pfnRxPoll = (PFN_NET_POLL)pPort->pProtocol.IPv4->Poll;\r
a88c3163 387 pPort->pfnRxStart = (PFN_NET_IO_START)pPort->pProtocol.IPv4->Receive;\r
388 pPort->pfnTxStart = (PFN_NET_IO_START)pPort->pProtocol.IPv4->Transmit;\r
389\r
390 //\r
391 // Set the configuration flags\r
392 //\r
393 pConfig = &pPort->Context.Ip4.ModeData.ConfigData;\r
394 pConfig->AcceptIcmpErrors = FALSE;\r
395 pConfig->AcceptBroadcast = FALSE;\r
396 pConfig->AcceptPromiscuous = FALSE;\r
397 pConfig->TypeOfService = 0;\r
398 pConfig->TimeToLive = 255;\r
399 pConfig->DoNotFragment = FALSE;\r
400 pConfig->RawData = FALSE;\r
401 pConfig->ReceiveTimeout = 0;\r
402 pConfig->TransmitTimeout = 0;\r
403\r
404 //\r
405 // Set the default protocol\r
406 //\r
407 pConfig->DefaultProtocol = (UINT8)pSocket->Protocol;\r
408 pConfig->AcceptAnyProtocol = (BOOLEAN)( 0 == pConfig->DefaultProtocol );\r
409 Status = EFI_SUCCESS;\r
410\r
411 //\r
412 // Return the operation status\r
413 //\r
414 DBG_EXIT_STATUS ( Status );\r
415 return Status;\r
416}\r
417\r
418\r
419/**\r
420 Receive data from a network connection.\r
421\r
422 This routine attempts to return buffered data to the caller. The\r
423 data is removed from the urgent queue if the message flag MSG_OOB\r
424 is specified, otherwise data is removed from the normal queue.\r
425 See the \ref ReceiveEngine section.\r
426\r
427 This routine is called by ::EslSocketReceive to handle the network\r
428 specific receive operation to support SOCK_RAW sockets.\r
429\r
430 @param [in] pPort Address of an ::ESL_PORT structure.\r
431\r
432 @param [in] pPacket Address of an ::ESL_PACKET structure.\r
433 \r
434 @param [in] pbConsumePacket Address of a BOOLEAN indicating if the packet is to be consumed\r
435 \r
436 @param [in] BufferLength Length of the the buffer\r
437 \r
438 @param [in] pBuffer Address of a buffer to receive the data.\r
439 \r
440 @param [in] pDataLength Number of received data bytes in the buffer.\r
441\r
442 @param [out] pAddress Network address to receive the remote system address\r
443\r
444 @param [out] pSkipBytes Address to receive the number of bytes skipped\r
445\r
446 @return Returns the address of the next free byte in the buffer.\r
447\r
448 **/\r
449UINT8 *\r
450EslIp4Receive (\r
451 IN ESL_PORT * pPort,\r
452 IN ESL_PACKET * pPacket,\r
453 IN BOOLEAN * pbConsumePacket,\r
454 IN size_t BufferLength,\r
455 IN UINT8 * pBuffer,\r
456 OUT size_t * pDataLength,\r
457 OUT struct sockaddr * pAddress,\r
458 OUT size_t * pSkipBytes\r
459 )\r
460{\r
461 size_t DataBytes;\r
462 size_t HeaderBytes;\r
463 size_t LengthInBytes;\r
464 struct sockaddr_in * pRemoteAddress;\r
465 EFI_IP4_RECEIVE_DATA * pRxData;\r
466\r
467 DBG_ENTER ( );\r
468\r
469 //\r
470 // Return the remote system address if requested\r
471 //\r
472 pRxData = pPacket->Op.Ip4Rx.pRxData;\r
473 if ( NULL != pAddress ) {\r
474 //\r
475 // Build the remote address\r
476 //\r
477 DEBUG (( DEBUG_RX,\r
478 "Getting packet remote address: %d.%d.%d.%d\r\n",\r
479 pRxData->Header->SourceAddress.Addr[0],\r
480 pRxData->Header->SourceAddress.Addr[1],\r
481 pRxData->Header->SourceAddress.Addr[2],\r
482 pRxData->Header->SourceAddress.Addr[3]));\r
483 pRemoteAddress = (struct sockaddr_in *)pAddress;\r
484 CopyMem ( &pRemoteAddress->sin_addr,\r
485 &pRxData->Header->SourceAddress.Addr[0],\r
486 sizeof ( pRemoteAddress->sin_addr ));\r
487 }\r
488\r
489 //\r
490 // Copy the IP header\r
491 //\r
492 HeaderBytes = pRxData->HeaderLength;\r
493 if ( HeaderBytes > BufferLength ) {\r
494 HeaderBytes = BufferLength;\r
495 }\r
496 DEBUG (( DEBUG_RX,\r
497 "0x%08x --> 0x%08x: Copy header 0x%08x bytes\r\n",\r
498 pRxData->Header,\r
499 pBuffer,\r
500 HeaderBytes ));\r
501 CopyMem ( pBuffer, pRxData->Header, HeaderBytes );\r
502 pBuffer += HeaderBytes;\r
503 LengthInBytes = HeaderBytes;\r
504\r
505 //\r
506 // Copy the received data\r
507 //\r
508 if ( 0 < ( BufferLength - LengthInBytes )) {\r
509 pBuffer = EslSocketCopyFragmentedBuffer ( pRxData->FragmentCount,\r
510 &pRxData->FragmentTable[0],\r
511 BufferLength - LengthInBytes,\r
512 pBuffer,\r
513 &DataBytes );\r
514 LengthInBytes += DataBytes;\r
515 }\r
516\r
517 //\r
518 // Determine if the data is being read\r
519 //\r
520 if ( *pbConsumePacket ) {\r
521 //\r
522 // Display for the bytes consumed\r
523 //\r
524 DEBUG (( DEBUG_RX,\r
525 "0x%08x: Port account for 0x%08x bytes\r\n",\r
526 pPort,\r
527 LengthInBytes ));\r
528\r
529 //\r
530 // Account for any discarded data\r
531 //\r
532 *pSkipBytes = pRxData->HeaderLength + pRxData->DataLength - LengthInBytes;\r
533 }\r
534\r
535 //\r
536 // Return the data length and the buffer address\r
537 //\r
538 *pDataLength = LengthInBytes;\r
539 DBG_EXIT_HEX ( pBuffer );\r
540 return pBuffer;\r
541}\r
542\r
543\r
544/**\r
545 Get the remote socket address\r
546\r
547 This routine returns the address of the remote connection point\r
548 associated with the SOCK_RAW socket.\r
549\r
550 This routine is called by ::EslSocketGetPeerAddress to detemine\r
551 the IPv4 address associated with the network adapter.\r
552\r
553 @param [in] pPort Address of an ::ESL_PORT structure.\r
554\r
555 @param [out] pAddress Network address to receive the remote system address\r
556\r
557**/\r
558VOID\r
559EslIp4RemoteAddressGet (\r
560 IN ESL_PORT * pPort,\r
561 OUT struct sockaddr * pAddress\r
562 )\r
563{\r
564 struct sockaddr_in * pRemoteAddress;\r
565 ESL_IP4_CONTEXT * pIp4;\r
566\r
567 DBG_ENTER ( );\r
568\r
569 //\r
570 // Return the remote address\r
571 //\r
572 pIp4 = &pPort->Context.Ip4;\r
573 pRemoteAddress = (struct sockaddr_in *)pAddress;\r
574 pRemoteAddress->sin_family = AF_INET;\r
575 CopyMem ( &pRemoteAddress->sin_addr,\r
576 &pIp4->DestinationAddress.Addr[0],\r
577 sizeof ( pRemoteAddress->sin_addr ));\r
578\r
579 DBG_EXIT ( );\r
580}\r
581\r
582\r
583/**\r
584 Set the remote address\r
585\r
586 This routine sets the remote address in the port.\r
587\r
588 This routine is called by ::EslSocketConnect to specify the\r
589 remote network address.\r
590\r
591 @param [in] pPort Address of an ::ESL_PORT structure.\r
592\r
593 @param [in] pSockAddr Network address of the remote system.\r
594\r
595 @param [in] SockAddrLength Length in bytes of the network address.\r
596\r
597 @retval EFI_SUCCESS The operation was successful\r
598\r
599 **/\r
600EFI_STATUS\r
601EslIp4RemoteAddressSet (\r
602 IN ESL_PORT * pPort,\r
603 IN CONST struct sockaddr * pSockAddr,\r
604 IN socklen_t SockAddrLength\r
605 )\r
606{\r
607 ESL_IP4_CONTEXT * pIp4;\r
608 CONST struct sockaddr_in * pRemoteAddress;\r
609 EFI_STATUS Status;\r
610\r
611 DBG_ENTER ( );\r
612\r
613 //\r
614 // Set the remote address\r
615 //\r
616 pIp4 = &pPort->Context.Ip4;\r
617 pRemoteAddress = (struct sockaddr_in *)pSockAddr;\r
618 pIp4->DestinationAddress.Addr[0] = (UINT8)( pRemoteAddress->sin_addr.s_addr );\r
619 pIp4->DestinationAddress.Addr[1] = (UINT8)( pRemoteAddress->sin_addr.s_addr >> 8 );\r
620 pIp4->DestinationAddress.Addr[2] = (UINT8)( pRemoteAddress->sin_addr.s_addr >> 16 );\r
621 pIp4->DestinationAddress.Addr[3] = (UINT8)( pRemoteAddress->sin_addr.s_addr >> 24 );\r
622 Status = EFI_SUCCESS;\r
623\r
624 //\r
625 // Return the operation status\r
626 //\r
627 DBG_EXIT_STATUS ( Status );\r
628 return Status;\r
629}\r
630\r
631\r
632/**\r
633 Process the receive completion\r
634\r
635 This routine keeps the IPv4 driver's buffer and queues it in\r
636 in FIFO order to the data queue. The IP4 driver's buffer will\r
637 be returned by either ::EslIp4Receive or ::EslSocketPortCloseTxDone.\r
638 See the \ref ReceiveEngine section.\r
639\r
640 This routine is called by the IPv4 driver when data is\r
641 received.\r
642\r
643 @param [in] Event The receive completion event\r
644\r
645 @param [in] pIo The address of an ::ESL_IO_MGMT structure\r
646\r
647**/\r
648VOID\r
649EslIp4RxComplete (\r
650 IN EFI_EVENT Event,\r
651 IN ESL_IO_MGMT * pIo\r
652 )\r
653{\r
654 size_t LengthInBytes;\r
655 ESL_PORT * pPort;\r
656 ESL_PACKET * pPacket;\r
657 EFI_IP4_RECEIVE_DATA * pRxData;\r
658 EFI_STATUS Status;\r
659 \r
660 DBG_ENTER ( );\r
661 \r
662 //\r
663 // Get the operation status.\r
664 //\r
665 pPort = pIo->pPort;\r
666 Status = pIo->Token.Ip4Rx.Status;\r
667\r
668 //\r
669 // Get the packet length\r
670 //\r
671 pRxData = pIo->Token.Ip4Rx.Packet.RxData;\r
672 LengthInBytes = pRxData->HeaderLength + pRxData->DataLength;\r
673\r
674 //\r
675 // +--------------------+ +----------------------+\r
676 // | ESL_IO_MGMT | | Data Buffer |\r
677 // | | | (Driver owned) |\r
678 // | +---------------+ +----------------------+\r
679 // | | Token | ^\r
680 // | | Rx Event | |\r
681 // | | | +----------------------+\r
682 // | | RxData --> | EFI_IP4_RECEIVE_DATA |\r
683 // +----+---------------+ | (Driver owned) |\r
684 // +----------------------+\r
685 // +--------------------+ ^\r
686 // | ESL_PACKET | .\r
687 // | | .\r
688 // | +---------------+ .\r
689 // | | pRxData --> NULL .......\r
690 // +----+---------------+\r
691 //\r
692 //\r
693 // Save the data in the packet\r
694 //\r
695 pPacket = pIo->pPacket;\r
696 pPacket->Op.Ip4Rx.pRxData = pRxData;\r
697\r
698 //\r
699 // Complete this request\r
700 //\r
701 EslSocketRxComplete ( pIo, Status, LengthInBytes, FALSE );\r
702 DBG_EXIT ( );\r
703}\r
704\r
705\r
706/**\r
707 Determine if the socket is configured.\r
708\r
709 This routine uses the flag ESL_SOCKET::bConfigured to determine\r
710 if the network layer's configuration routine has been called.\r
711 This routine calls the ::EslSocketBind and configuration routines\r
712 if they were not already called. After the port is configured,\r
713 the \ref ReceiveEngine is started.\r
714\r
715 This routine is called by EslSocketIsConfigured to verify\r
716 that the socket is configured.\r
717\r
718 @param [in] pSocket Address of an ::ESL_SOCKET structure\r
719 \r
720 @retval EFI_SUCCESS - The port is connected\r
721 @retval EFI_NOT_STARTED - The port is not connected\r
722\r
723 **/\r
724 EFI_STATUS\r
725 EslIp4SocketIsConfigured (\r
726 IN ESL_SOCKET * pSocket\r
727 )\r
728{\r
729 UINTN Index;\r
730 ESL_PORT * pPort;\r
731 ESL_PORT * pNextPort;\r
732 ESL_IP4_CONTEXT * pIp4;\r
733 EFI_IP4_PROTOCOL * pIp4Protocol;\r
734 EFI_STATUS Status;\r
735 struct sockaddr_in LocalAddress;\r
736\r
737 DBG_ENTER ( );\r
738\r
739 //\r
740 // Assume success\r
741 //\r
742 Status = EFI_SUCCESS;\r
743\r
744 //\r
745 // Configure the port if necessary\r
746 //\r
747 if ( !pSocket->bConfigured ) {\r
748 //\r
749 // Fill in the port list if necessary\r
750 //\r
751 if ( NULL == pSocket->pPortList ) {\r
752 LocalAddress.sin_len = sizeof ( LocalAddress );\r
753 LocalAddress.sin_family = AF_INET;\r
754 LocalAddress.sin_addr.s_addr = 0;\r
755 LocalAddress.sin_port = 0;\r
756 Status = EslSocketBind ( &pSocket->SocketProtocol,\r
757 (struct sockaddr *)&LocalAddress,\r
758 LocalAddress.sin_len,\r
759 &pSocket->errno );\r
760 }\r
761\r
762 //\r
763 // Walk the port list\r
764 //\r
765 pPort = pSocket->pPortList;\r
766 while ( NULL != pPort ) {\r
767 //\r
768 // Update the raw setting\r
769 //\r
770 pIp4 = &pPort->Context.Ip4;\r
771 if ( pSocket->bIncludeHeader ) {\r
772 //\r
773 // IP header will be included with the data on transmit\r
774 //\r
775 pIp4->ModeData.ConfigData.RawData = TRUE;\r
776 }\r
777\r
778 //\r
779 // Attempt to configure the port\r
780 //\r
781 pNextPort = pPort->pLinkSocket;\r
782 pIp4Protocol = pPort->pProtocol.IPv4;\r
783 DEBUG (( DEBUG_TX,\r
784 "0x%08x: pPort Configuring for %d.%d.%d.%d --> %d.%d.%d.%d\r\n",\r
785 pPort,\r
786 pIp4->ModeData.ConfigData.StationAddress.Addr[0],\r
787 pIp4->ModeData.ConfigData.StationAddress.Addr[1],\r
788 pIp4->ModeData.ConfigData.StationAddress.Addr[2],\r
789 pIp4->ModeData.ConfigData.StationAddress.Addr[3],\r
790 pIp4->DestinationAddress.Addr[0],\r
791 pIp4->DestinationAddress.Addr[1],\r
792 pIp4->DestinationAddress.Addr[2],\r
793 pIp4->DestinationAddress.Addr[3]));\r
794 Status = pIp4Protocol->Configure ( pIp4Protocol,\r
795 &pIp4->ModeData.ConfigData );\r
796 if ( !EFI_ERROR ( Status )) {\r
797 //\r
798 // Update the configuration data\r
799 //\r
800 Status = pIp4Protocol->GetModeData ( pIp4Protocol,\r
801 &pIp4->ModeData,\r
802 NULL,\r
803 NULL );\r
804 }\r
805 if ( EFI_ERROR ( Status )) {\r
806 DEBUG (( DEBUG_LISTEN,\r
807 "ERROR - Failed to configure the Ip4 port, Status: %r\r\n",\r
808 Status ));\r
809 switch ( Status ) {\r
810 case EFI_ACCESS_DENIED:\r
811 pSocket->errno = EACCES;\r
812 break;\r
813\r
814 default:\r
815 case EFI_DEVICE_ERROR:\r
816 pSocket->errno = EIO;\r
817 break;\r
818\r
819 case EFI_INVALID_PARAMETER:\r
820 pSocket->errno = EADDRNOTAVAIL;\r
821 break;\r
822\r
823 case EFI_NO_MAPPING:\r
824 pSocket->errno = EAFNOSUPPORT;\r
825 break;\r
826\r
827 case EFI_OUT_OF_RESOURCES:\r
828 pSocket->errno = ENOBUFS;\r
829 break;\r
830\r
831 case EFI_UNSUPPORTED:\r
832 pSocket->errno = EOPNOTSUPP;\r
833 break;\r
834 }\r
835 }\r
836 else {\r
837 DEBUG (( DEBUG_TX,\r
838 "0x%08x: pPort Configured for %d.%d.%d.%d --> %d.%d.%d.%d\r\n",\r
839 pPort,\r
840 pIp4->ModeData.ConfigData.StationAddress.Addr[0],\r
841 pIp4->ModeData.ConfigData.StationAddress.Addr[1],\r
842 pIp4->ModeData.ConfigData.StationAddress.Addr[2],\r
843 pIp4->ModeData.ConfigData.StationAddress.Addr[3],\r
844 pIp4->DestinationAddress.Addr[0],\r
845 pIp4->DestinationAddress.Addr[1],\r
846 pIp4->DestinationAddress.Addr[2],\r
847 pIp4->DestinationAddress.Addr[3]));\r
848 DEBUG (( DEBUG_TX,\r
849 "Subnet Mask: %d.%d.%d.%d\r\n",\r
850 pIp4->ModeData.ConfigData.SubnetMask.Addr[0],\r
851 pIp4->ModeData.ConfigData.SubnetMask.Addr[1],\r
852 pIp4->ModeData.ConfigData.SubnetMask.Addr[2],\r
853 pIp4->ModeData.ConfigData.SubnetMask.Addr[3]));\r
854 DEBUG (( DEBUG_TX,\r
855 "Route Count: %d\r\n",\r
856 pIp4->ModeData.RouteCount ));\r
857 for ( Index = 0; pIp4->ModeData.RouteCount > Index; Index++ ) {\r
858 if ( 0 == Index ) {\r
859 DEBUG (( DEBUG_TX, "Route Table:\r\n" ));\r
860 }\r
861 DEBUG (( DEBUG_TX,\r
862 "%5d: %d.%d.%d.%d, %d.%d.%d.%d ==> %d.%d.%d.%d\r\n",\r
863 Index,\r
864 pIp4->ModeData.RouteTable[Index].SubnetAddress.Addr[0],\r
865 pIp4->ModeData.RouteTable[Index].SubnetAddress.Addr[1],\r
866 pIp4->ModeData.RouteTable[Index].SubnetAddress.Addr[2],\r
867 pIp4->ModeData.RouteTable[Index].SubnetAddress.Addr[3],\r
868 pIp4->ModeData.RouteTable[Index].SubnetMask.Addr[0],\r
869 pIp4->ModeData.RouteTable[Index].SubnetMask.Addr[1],\r
870 pIp4->ModeData.RouteTable[Index].SubnetMask.Addr[2],\r
871 pIp4->ModeData.RouteTable[Index].SubnetMask.Addr[3],\r
872 pIp4->ModeData.RouteTable[Index].GatewayAddress.Addr[0],\r
873 pIp4->ModeData.RouteTable[Index].GatewayAddress.Addr[1],\r
874 pIp4->ModeData.RouteTable[Index].GatewayAddress.Addr[2],\r
875 pIp4->ModeData.RouteTable[Index].GatewayAddress.Addr[3]));\r
876 }\r
877 pPort->bConfigured = TRUE;\r
878\r
879 //\r
880 // Start the first read on the port\r
881 //\r
882 EslSocketRxStart ( pPort );\r
883\r
884 //\r
885 // The socket is connected\r
886 //\r
887 pSocket->State = SOCKET_STATE_CONNECTED;\r
888 }\r
889\r
890 //\r
891 // Set the next port\r
892 //\r
893 pPort = pNextPort;\r
894 }\r
895\r
896 //\r
897 // Determine the configuration status\r
898 //\r
899 if ( NULL != pSocket->pPortList ) {\r
900 pSocket->bConfigured = TRUE;\r
901 }\r
902 }\r
903\r
904 //\r
905 // Determine the socket configuration status\r
906 //\r
907 if ( !EFI_ERROR ( Status )) {\r
908 Status = pSocket->bConfigured ? EFI_SUCCESS : EFI_NOT_STARTED;\r
909 }\r
910 \r
911 //\r
912 // Return the port connected state.\r
913 //\r
914 DBG_EXIT_STATUS ( Status );\r
915 return Status;\r
916}\r
917\r
918\r
919/**\r
920 Buffer data for transmission over a network connection.\r
921\r
922 This routine buffers data for the transmit engine in the normal\r
923 data queue. When the \ref TransmitEngine has resources, this\r
924 routine will start the transmission of the next buffer on the\r
925 network connection.\r
926\r
927 This routine is called by ::EslSocketTransmit to buffer\r
928 data for transmission. The data is copied into a local buffer\r
929 freeing the application buffer for reuse upon return. When\r
930 necessary, this routine starts the transmit engine that\r
931 performs the data transmission on the network connection. The\r
932 transmit engine transmits the data a packet at a time over the\r
933 network connection.\r
934\r
935 Transmission errors are returned during the next transmission or\r
936 during the close operation. Only buffering errors are returned\r
937 during the current transmission attempt.\r
938\r
939 @param [in] pSocket Address of an ::ESL_SOCKET structure\r
940\r
941 @param [in] Flags Message control flags\r
942\r
943 @param [in] BufferLength Length of the the buffer\r
944\r
945 @param [in] pBuffer Address of a buffer to receive the data.\r
946\r
947 @param [in] pDataLength Number of received data bytes in the buffer.\r
948\r
949 @param [in] pAddress Network address of the remote system address\r
950\r
951 @param [in] AddressLength Length of the remote network address structure\r
952\r
953 @retval EFI_SUCCESS - Socket data successfully buffered\r
954\r
955**/\r
956EFI_STATUS\r
957EslIp4TxBuffer (\r
958 IN ESL_SOCKET * pSocket,\r
959 IN int Flags,\r
960 IN size_t BufferLength,\r
961 IN CONST UINT8 * pBuffer,\r
962 OUT size_t * pDataLength,\r
963 IN const struct sockaddr * pAddress,\r
964 IN socklen_t AddressLength\r
965 )\r
966{\r
967 ESL_PACKET * pPacket;\r
968 ESL_PACKET * pPreviousPacket;\r
969 ESL_PORT * pPort;\r
970 const struct sockaddr_in * pRemoteAddress;\r
971 ESL_IP4_CONTEXT * pIp4;\r
972 size_t * pTxBytes;\r
973 ESL_IP4_TX_DATA * pTxData;\r
974 EFI_STATUS Status;\r
975 EFI_TPL TplPrevious;\r
976\r
977 DBG_ENTER ( );\r
978\r
979 //\r
980 // Assume failure\r
981 //\r
982 Status = EFI_UNSUPPORTED;\r
983 pSocket->errno = ENOTCONN;\r
984 *pDataLength = 0;\r
985\r
986 //\r
987 // Verify that the socket is connected\r
988 //\r
989 if ( SOCKET_STATE_CONNECTED == pSocket->State ) {\r
990 //\r
991 // Locate the port\r
992 //\r
993 pPort = pSocket->pPortList;\r
994 if ( NULL != pPort ) {\r
995 //\r
996 // Determine the queue head\r
997 //\r
998 pIp4 = &pPort->Context.Ip4;\r
999 pTxBytes = &pSocket->TxBytes;\r
1000\r
1001 //\r
1002 // Verify that there is enough room to buffer another\r
1003 // transmit operation\r
1004 //\r
1005 if ( pSocket->MaxTxBuf > *pTxBytes ) {\r
1006 //\r
1007 // Attempt to allocate the packet\r
1008 //\r
1009 Status = EslSocketPacketAllocate ( &pPacket,\r
1010 sizeof ( pPacket->Op.Ip4Tx )\r
1011 - sizeof ( pPacket->Op.Ip4Tx.Buffer )\r
1012 + BufferLength,\r
1013 0,\r
1014 DEBUG_TX );\r
1015 if ( !EFI_ERROR ( Status )) {\r
1016 //\r
1017 // Initialize the transmit operation\r
1018 //\r
1019 pTxData = &pPacket->Op.Ip4Tx;\r
1020 pTxData->TxData.DestinationAddress.Addr[0] = pIp4->DestinationAddress.Addr[0];\r
1021 pTxData->TxData.DestinationAddress.Addr[1] = pIp4->DestinationAddress.Addr[1];\r
1022 pTxData->TxData.DestinationAddress.Addr[2] = pIp4->DestinationAddress.Addr[2];\r
1023 pTxData->TxData.DestinationAddress.Addr[3] = pIp4->DestinationAddress.Addr[3];\r
1024 pTxData->TxData.OverrideData = NULL;\r
1025 pTxData->TxData.OptionsLength = 0;\r
1026 pTxData->TxData.OptionsBuffer = NULL;\r
1027 pTxData->TxData.TotalDataLength = (UINT32) BufferLength;\r
1028 pTxData->TxData.FragmentCount = 1;\r
1029 pTxData->TxData.FragmentTable[0].FragmentLength = (UINT32) BufferLength;\r
1030 pTxData->TxData.FragmentTable[0].FragmentBuffer = &pPacket->Op.Ip4Tx.Buffer[0];\r
1031\r
1032 //\r
1033 // Set the remote system address if necessary\r
1034 //\r
1035 if ( NULL != pAddress ) {\r
1036 pRemoteAddress = (const struct sockaddr_in *)pAddress;\r
1037 pTxData->Override.SourceAddress.Addr[0] = pIp4->ModeData.ConfigData.StationAddress.Addr[0];\r
1038 pTxData->Override.SourceAddress.Addr[1] = pIp4->ModeData.ConfigData.StationAddress.Addr[1];\r
1039 pTxData->Override.SourceAddress.Addr[2] = pIp4->ModeData.ConfigData.StationAddress.Addr[2];\r
1040 pTxData->Override.SourceAddress.Addr[3] = pIp4->ModeData.ConfigData.StationAddress.Addr[3];\r
1041 pTxData->TxData.DestinationAddress.Addr[0] = (UINT8)pRemoteAddress->sin_addr.s_addr;\r
1042 pTxData->TxData.DestinationAddress.Addr[1] = (UINT8)( pRemoteAddress->sin_addr.s_addr >> 8 );\r
1043 pTxData->TxData.DestinationAddress.Addr[2] = (UINT8)( pRemoteAddress->sin_addr.s_addr >> 16 );\r
1044 pTxData->TxData.DestinationAddress.Addr[3] = (UINT8)( pRemoteAddress->sin_addr.s_addr >> 24 );\r
1045 pTxData->Override.GatewayAddress.Addr[0] = 0;\r
1046 pTxData->Override.GatewayAddress.Addr[1] = 0;\r
1047 pTxData->Override.GatewayAddress.Addr[2] = 0;\r
1048 pTxData->Override.GatewayAddress.Addr[3] = 0;\r
1049 pTxData->Override.Protocol = (UINT8)pSocket->Protocol;\r
1050 pTxData->Override.TypeOfService = 0;\r
1051 pTxData->Override.TimeToLive = 255;\r
1052 pTxData->Override.DoNotFragment = FALSE;\r
1053\r
1054 //\r
1055 // Use the remote system address when sending this packet\r
1056 //\r
1057 pTxData->TxData.OverrideData = &pTxData->Override;\r
1058 }\r
1059\r
1060 //\r
1061 // Copy the data into the buffer\r
1062 //\r
1063 CopyMem ( &pPacket->Op.Ip4Tx.Buffer[0],\r
1064 pBuffer,\r
1065 BufferLength );\r
1066\r
1067 //\r
1068 // Synchronize with the socket layer\r
1069 //\r
1070 RAISE_TPL ( TplPrevious, TPL_SOCKETS );\r
1071\r
1072 //\r
1073 // Stop transmission after an error\r
1074 //\r
1075 if ( !EFI_ERROR ( pSocket->TxError )) {\r
1076 //\r
1077 // Display the request\r
1078 //\r
1079 DEBUG (( DEBUG_TX,\r
1080 "Send %d bytes from 0x%08x, %d.%d.%d.%d --> %d.%d.%d.%d\r\n",\r
1081 BufferLength,\r
1082 pBuffer,\r
1083 pIp4->ModeData.ConfigData.StationAddress.Addr[0],\r
1084 pIp4->ModeData.ConfigData.StationAddress.Addr[1],\r
1085 pIp4->ModeData.ConfigData.StationAddress.Addr[2],\r
1086 pIp4->ModeData.ConfigData.StationAddress.Addr[3],\r
1087 pTxData->TxData.DestinationAddress.Addr[0],\r
1088 pTxData->TxData.DestinationAddress.Addr[1],\r
1089 pTxData->TxData.DestinationAddress.Addr[2],\r
1090 pTxData->TxData.DestinationAddress.Addr[3]));\r
1091\r
1092 //\r
1093 // Queue the data for transmission\r
1094 //\r
1095 pPacket->pNext = NULL;\r
1096 pPreviousPacket = pSocket->pTxPacketListTail;\r
1097 if ( NULL == pPreviousPacket ) {\r
1098 pSocket->pTxPacketListHead = pPacket;\r
1099 }\r
1100 else {\r
1101 pPreviousPacket->pNext = pPacket;\r
1102 }\r
1103 pSocket->pTxPacketListTail = pPacket;\r
1104 DEBUG (( DEBUG_TX,\r
1105 "0x%08x: Packet on transmit list\r\n",\r
1106 pPacket ));\r
1107\r
1108 //\r
1109 // Account for the buffered data\r
1110 //\r
1111 *pTxBytes += BufferLength;\r
1112 *pDataLength = BufferLength;\r
1113\r
1114 //\r
1115 // Start the transmit engine if it is idle\r
1116 //\r
1117 if ( NULL != pPort->pTxFree ) {\r
1118 EslSocketTxStart ( pPort,\r
1119 &pSocket->pTxPacketListHead,\r
1120 &pSocket->pTxPacketListTail,\r
1121 &pPort->pTxActive,\r
1122 &pPort->pTxFree );\r
1123 }\r
1124 }\r
1125 else {\r
1126 //\r
1127 // Previous transmit error\r
1128 // Stop transmission\r
1129 //\r
1130 Status = pSocket->TxError;\r
1131 pSocket->errno = EIO;\r
1132\r
1133 //\r
1134 // Free the packet\r
1135 //\r
1136 EslSocketPacketFree ( pPacket, DEBUG_TX );\r
1137 }\r
1138\r
1139 //\r
1140 // Release the socket layer synchronization\r
1141 //\r
1142 RESTORE_TPL ( TplPrevious );\r
1143 }\r
1144 else {\r
1145 //\r
1146 // Packet allocation failed\r
1147 //\r
1148 pSocket->errno = ENOMEM;\r
1149 }\r
1150 }\r
1151 else {\r
1152 //\r
1153 // Not enough buffer space available\r
1154 //\r
1155 pSocket->errno = EAGAIN;\r
1156 Status = EFI_NOT_READY;\r
1157 }\r
1158 }\r
1159 }\r
1160\r
1161 //\r
1162 // Return the operation status\r
1163 //\r
1164 DBG_EXIT_STATUS ( Status );\r
1165 return Status;\r
1166}\r
1167\r
1168\r
1169/**\r
1170 Process the transmit completion\r
1171\r
1172 This routine use ::EslSocketTxComplete to perform the transmit\r
1173 completion processing for data packets.\r
1174\r
1175 This routine is called by the IPv4 network layer when a data\r
1176 transmit request completes.\r
1177\r
1178 @param [in] Event The normal transmit completion event\r
1179\r
1180 @param [in] pIo The address of an ::ESL_IO_MGMT structure\r
1181\r
1182**/\r
1183VOID\r
1184EslIp4TxComplete (\r
1185 IN EFI_EVENT Event,\r
1186 IN ESL_IO_MGMT * pIo\r
1187 )\r
1188{\r
1189 UINT32 LengthInBytes;\r
1190 ESL_PORT * pPort;\r
1191 ESL_PACKET * pPacket;\r
1192 ESL_SOCKET * pSocket;\r
1193 EFI_STATUS Status;\r
1194 \r
1195 DBG_ENTER ( );\r
1196 \r
1197 //\r
1198 // Locate the active transmit packet\r
1199 //\r
1200 pPacket = pIo->pPacket;\r
1201 pPort = pIo->pPort;\r
1202 pSocket = pPort->pSocket;\r
1203\r
1204 //\r
1205 // Get the transmit length and status\r
1206 //\r
1207 LengthInBytes = pPacket->Op.Ip4Tx.TxData.TotalDataLength;\r
1208 pSocket->TxBytes -= LengthInBytes;\r
1209 Status = pIo->Token.Ip4Tx.Status;\r
1210\r
1211 //\r
1212 // Complete the transmit operation\r
1213 //\r
1214 EslSocketTxComplete ( pIo,\r
1215 LengthInBytes,\r
1216 Status,\r
1217 "Raw ",\r
1218 &pSocket->pTxPacketListHead,\r
1219 &pSocket->pTxPacketListTail,\r
1220 &pPort->pTxActive,\r
1221 &pPort->pTxFree );\r
1222 DBG_EXIT ( );\r
1223}\r
1224\r
1225\r
1226/**\r
1227 Interface between the socket layer and the network specific\r
1228 code that supports SOCK_RAW sockets over IPv4.\r
1229**/\r
1230CONST ESL_PROTOCOL_API cEslIp4Api = {\r
1231 "IPv4",\r
1232 IPPROTO_IP,\r
1233 OFFSET_OF ( ESL_PORT, Context.Ip4.ModeData.ConfigData ),\r
1234 OFFSET_OF ( ESL_LAYER, pIp4List ),\r
1235 OFFSET_OF ( struct sockaddr_in, sin_zero ),\r
1236 sizeof ( struct sockaddr_in ),\r
1237 AF_INET,\r
1238 sizeof (((ESL_PACKET *)0 )->Op.Ip4Rx ),\r
1239 sizeof (((ESL_PACKET *)0 )->Op.Ip4Rx ),\r
1240 OFFSET_OF ( ESL_IO_MGMT, Token.Ip4Rx.Packet.RxData ),\r
1241 FALSE,\r
1242 EADDRNOTAVAIL,\r
1243 NULL, // Accept\r
1244 NULL, // ConnectPoll\r
1245 NULL, // ConnectStart\r
1246 EslIp4SocketIsConfigured,\r
1247 EslIp4LocalAddressGet,\r
1248 EslIp4LocalAddressSet,\r
1249 NULL, // Listen\r
1250 EslIp4OptionGet,\r
1251 EslIp4OptionSet,\r
1252 EslIp4PacketFree,\r
1253 EslIp4PortAllocate,\r
1254 NULL, // PortClose\r
1255 NULL, // PortCloseOp\r
1256 TRUE,\r
1257 EslIp4Receive,\r
1258 EslIp4RemoteAddressGet,\r
1259 EslIp4RemoteAddressSet,\r
1260 EslIp4RxComplete,\r
1261 NULL, // RxStart\r
1262 EslIp4TxBuffer,\r
1263 EslIp4TxComplete,\r
1264 NULL // TxOobComplete\r
1265};\r