3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 The helper routines to access UDP service. It is used by both
30 #include <Protocol/Udp4.h>
32 #include <Library/UdpIoLib.h>
33 #include <Library/NetLib.h>
35 typedef struct _UDP_IO_PORT UDP_IO_PORT
;
38 UDP_IO_RX_SIGNATURE
= EFI_SIGNATURE_32 ('U', 'D', 'P', 'R'),
39 UDP_IO_TX_SIGNATURE
= EFI_SIGNATURE_32 ('U', 'D', 'P', 'T'),
40 UDP_IO_SIGNATURE
= EFI_SIGNATURE_32 ('U', 'D', 'P', 'I'),
51 // This prototype is used by both receive and transmission.
52 // When receiving Netbuf is allocated by UDP access point, and
53 // released by user. When transmitting, the NetBuf is from user,
54 // and provided to the callback as a reference.
60 IN UDP_POINTS
*Points
,
61 IN EFI_STATUS IoStatus
,
66 // Each receive request is wrapped in an UDP_RX_TOKEN. Upon completion,
67 // the CallBack will be called. Only one receive request is send to UDP.
68 // HeadLen gives the length of the application's header. UDP_IO will
69 // make the application's header continous before delivery up.
75 UDP_IO_CALLBACK CallBack
;
79 EFI_UDP4_COMPLETION_TOKEN UdpToken
;
83 // Each transmit request is wrapped in an UDP_TX_TOKEN. Upon completion,
84 // the CallBack will be called. There can be several transmit requests.
91 UDP_IO_CALLBACK CallBack
;
95 EFI_UDP4_SESSION_DATA UdpSession
;
96 EFI_IPv4_ADDRESS Gateway
;
98 EFI_UDP4_COMPLETION_TOKEN UdpToken
;
99 EFI_UDP4_TRANSMIT_DATA UdpTxData
;
102 struct _UDP_IO_PORT
{
108 // Handle used to create/destory UDP child
110 EFI_HANDLE Controller
;
112 EFI_HANDLE UdpHandle
;
114 EFI_UDP4_PROTOCOL
*Udp
;
115 EFI_UDP4_CONFIG_DATA UdpConfig
;
116 EFI_SIMPLE_NETWORK_MODE SnpMode
;
118 NET_LIST_ENTRY SentDatagram
;
119 UDP_RX_TOKEN
*RecvRequest
;
125 IN UDP_IO_PORT
*UdpIo
,
131 (*UDP_IO_TO_CANCEL
) (
132 IN UDP_TX_TOKEN
*Token
,
138 IN EFI_HANDLE Controller
,
139 IN EFI_HANDLE ImageHandle
,
140 IN UDP_IO_CONFIG Configure
,
146 IN UDP_IO_PORT
*UdpIo
151 IN UDP_IO_PORT
*UdpIo
156 IN UDP_IO_PORT
*UdpIo
,
158 IN UDP_POINTS
*EndPoint
, OPTIONAL
160 IN UDP_IO_CALLBACK CallBack
,
165 UdpIoCancelSentDatagram (
166 IN UDP_IO_PORT
*UdpIo
,
172 IN UDP_IO_PORT
*UdpIo
,
173 IN UDP_IO_CALLBACK CallBack
,