]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/Library/NetLib.h
Use Mde library and definition instead of some native definitions in NetLib, to simpl...
[mirror_edk2.git] / MdeModulePkg / Include / Library / NetLib.h
1 /** @file
2
3 Copyright (c) 2005 - 2007, 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
8
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.
11
12 Module Name:
13
14 NetLib.h
15
16 Abstract:
17
18 Library for the UEFI network stack.
19
20
21 **/
22
23 #ifndef _NET_LIB_H_
24 #define _NET_LIB_H_
25
26 #include <PiDxe.h>
27 #include <Library/BaseMemoryLib.h>
28 #include <Library/MemoryAllocationLib.h>
29 #include <Protocol/DriverBinding.h>
30 #include <Protocol/ComponentName.h>
31 #include <Protocol/DriverConfiguration.h>
32 #include <Protocol/DriverDiagnostics.h>
33 #include <Protocol/Dpc.h>
34
35 typedef UINT32 IP4_ADDR;
36 typedef UINT32 TCP_SEQNO;
37 typedef UINT16 TCP_PORTNO;
38
39 enum {
40 NET_ETHER_ADDR_LEN = 6,
41 NET_IFTYPE_ETHERNET = 0x01,
42
43 EFI_IP_PROTO_UDP = 0x11,
44 EFI_IP_PROTO_TCP = 0x06,
45 EFI_IP_PROTO_ICMP = 0x01,
46
47 //
48 // The address classfication
49 //
50 IP4_ADDR_CLASSA = 1,
51 IP4_ADDR_CLASSB,
52 IP4_ADDR_CLASSC,
53 IP4_ADDR_CLASSD,
54 IP4_ADDR_CLASSE,
55
56 IP4_MASK_NUM = 33,
57 };
58
59 #pragma pack(1)
60
61 //
62 // Ethernet head definition
63 //
64 typedef struct {
65 UINT8 DstMac [NET_ETHER_ADDR_LEN];
66 UINT8 SrcMac [NET_ETHER_ADDR_LEN];
67 UINT16 EtherType;
68 } ETHER_HEAD;
69
70
71 //
72 // The EFI_IP4_HEADER is hard to use because the source and
73 // destination address are defined as EFI_IPv4_ADDRESS, which
74 // is a structure. Two structures can't be compared or masked
75 // directly. This is why there is an internal representation.
76 //
77 typedef struct {
78 UINT8 HeadLen : 4;
79 UINT8 Ver : 4;
80 UINT8 Tos;
81 UINT16 TotalLen;
82 UINT16 Id;
83 UINT16 Fragment;
84 UINT8 Ttl;
85 UINT8 Protocol;
86 UINT16 Checksum;
87 IP4_ADDR Src;
88 IP4_ADDR Dst;
89 } IP4_HEAD;
90
91
92 //
93 // ICMP head definition. ICMP message is categoried as either an error
94 // message or query message. Two message types have their own head format.
95 //
96 typedef struct {
97 UINT8 Type;
98 UINT8 Code;
99 UINT16 Checksum;
100 } IP4_ICMP_HEAD;
101
102 typedef struct {
103 IP4_ICMP_HEAD Head;
104 UINT32 Fourth; // 4th filed of the head, it depends on Type.
105 IP4_HEAD IpHead;
106 } IP4_ICMP_ERROR_HEAD;
107
108 typedef struct {
109 IP4_ICMP_HEAD Head;
110 UINT16 Id;
111 UINT16 Seq;
112 } IP4_ICMP_QUERY_HEAD;
113
114
115 //
116 // UDP header definition
117 //
118 typedef struct {
119 UINT16 SrcPort;
120 UINT16 DstPort;
121 UINT16 Length;
122 UINT16 Checksum;
123 } EFI_UDP4_HEADER;
124
125
126 //
127 // TCP header definition
128 //
129 typedef struct {
130 TCP_PORTNO SrcPort;
131 TCP_PORTNO DstPort;
132 TCP_SEQNO Seq;
133 TCP_SEQNO Ack;
134 UINT8 Res : 4;
135 UINT8 HeadLen : 4;
136 UINT8 Flag;
137 UINT16 Wnd;
138 UINT16 Checksum;
139 UINT16 Urg;
140 } TCP_HEAD;
141
142 #pragma pack()
143
144 #define NET_MAC_EQUAL(pMac1, pMac2, Len) \
145 (CompareMem ((pMac1), (pMac2), Len) == 0)
146
147 #define NET_MAC_IS_MULTICAST(Mac, BMac, Len) \
148 (((*((UINT8 *) Mac) & 0x01) == 0x01) && (!NET_MAC_EQUAL (Mac, BMac, Len)))
149
150 #define NTOHL(x) (UINT32)((((UINT32) (x) & 0xff) << 24) | \
151 (((UINT32) (x) & 0xff00) << 8) | \
152 (((UINT32) (x) & 0xff0000) >> 8) | \
153 (((UINT32) (x) & 0xff000000) >> 24))
154
155 #define HTONL(x) NTOHL(x)
156
157 #define NTOHS(x) (UINT16)((((UINT16) (x) & 0xff) << 8) | \
158 (((UINT16) (x) & 0xff00) >> 8))
159
160 #define HTONS(x) NTOHS(x)
161
162 //
163 // Test the IP's attribute, All the IPs are in host byte order.
164 //
165 #define IP4_IS_MULTICAST(Ip) (((Ip) & 0xF0000000) == 0xE0000000)
166 #define IP4_IS_LOCAL_BROADCAST(Ip) ((Ip) == 0xFFFFFFFF)
167 #define IP4_NET_EQUAL(Ip1, Ip2, NetMask) (((Ip1) & (NetMask)) == ((Ip2) & (NetMask)))
168 #define IP4_IS_VALID_NETMASK(Ip) (NetGetMaskLength (Ip) != IP4_MASK_NUM)
169
170 //
171 // Convert the EFI_IP4_ADDRESS to plain UINT32 IP4 address.
172 //
173 #define EFI_IP4(EfiIpAddr) (*(IP4_ADDR *) ((EfiIpAddr).Addr))
174 #define EFI_NTOHL(EfiIp) (NTOHL (EFI_IP4 ((EfiIp))))
175 #define EFI_IP4_EQUAL(Ip1, Ip2) (CompareMem ((Ip1), (Ip2), sizeof (EFI_IPv4_ADDRESS)) == 0)
176
177 INTN
178 NetGetMaskLength (
179 IN IP4_ADDR Mask
180 );
181
182 INTN
183 NetGetIpClass (
184 IN IP4_ADDR Addr
185 );
186
187 BOOLEAN
188 Ip4IsUnicast (
189 IN IP4_ADDR Ip,
190 IN IP4_ADDR NetMask
191 );
192
193 extern IP4_ADDR mIp4AllMasks [IP4_MASK_NUM];
194
195
196 extern EFI_IPv4_ADDRESS mZeroIp4Addr;
197
198 #define NET_IS_DIGIT(Ch) (('0' <= (Ch)) && ((Ch) <= '9'))
199 #define NET_ROUNDUP(size, unit) (((size) + (unit) - 1) & (~((unit) - 1)))
200 #define NET_IS_LOWER_CASE_CHAR(Ch) (('a' <= (Ch)) && ((Ch) <= 'z'))
201 #define NET_IS_UPPER_CASE_CHAR(Ch) (('A' <= (Ch)) && ((Ch) <= 'Z'))
202
203 //
204 // Lock primitives: the stack implements its lock primitives according
205 // to the standard EFI enviornment. It will NOT consider multiprocessor.
206 //
207 //#define NET_TPL_LOCK TPL_CALLBACK
208 //#define NET_TPL_EVENT TPL_NOTIFY
209 //#define NET_TPL_RECYCLE TPL_NOTIFY
210 //#define NET_TPL_TIMER NET_TPL_LOCK
211
212 //#define NET_LOCK EFI_LOCK
213 //#define NET_LOCK_INIT(x) EfiInitializeLock (x, NET_TPL_LOCK)
214 //#define NET_RECYCLE_LOCK_INIT(x) EfiInitializeLock (x, NET_TPL_RECYCLE)
215 //#define NET_TRYLOCK(x) EfiAcquireLockOrFail (x)
216 //#define NET_UNLOCK(x) EfiReleaseLock (x)
217
218 //#define NET_RAISE_TPL(x) (gBS->RaiseTPL (x))
219 //#define NET_RESTORE_TPL(x) (gBS->RestoreTPL (x))
220
221 #define TICKS_PER_MS 10000U
222 #define TICKS_PER_SECOND 10000000U
223
224 #define NET_RANDOM(Seed) ((UINT32) ((UINT32) (Seed) * 1103515245UL + 12345) % 4294967295UL)
225
226
227 UINT32
228 NetGetUint32 (
229 IN UINT8 *Buf
230 );
231
232 VOID
233 NetPutUint32 (
234 IN UINT8 *Buf,
235 IN UINT32 Data
236 );
237
238 UINT32
239 NetRandomInitSeed (
240 VOID
241 );
242
243
244 //
245 // Double linked list entry functions, this extends the
246 // EFI list functions.
247 //
248 //typedef LIST_ENTRY LIST_ENTRY;
249
250 //#define NetListInit(Head) InitializeListHead(Head)
251 //#define NetListInsertHead(Head, Entry) InsertHeadList((Head), (Entry))
252 //#define NetListInsertTail(Head, Entry) InsertTailList((Head), (Entry))
253 //#define NetListIsEmpty(List) IsListEmpty(List)
254
255 #define NET_LIST_USER_STRUCT(Entry, Type, Field) \
256 _CR(Entry, Type, Field)
257
258 #define NET_LIST_USER_STRUCT_S(Entry, Type, Field, Sig) \
259 CR(Entry, Type, Field, Sig)
260
261 //
262 // Iterate through the doule linked list. It is NOT delete safe
263 //
264 #define NET_LIST_FOR_EACH(Entry, ListHead) \
265 for(Entry = (ListHead)->ForwardLink; Entry != (ListHead); Entry = Entry->ForwardLink)
266
267 //
268 // Iterate through the doule linked list. This is delete-safe.
269 // Don't touch NextEntry. Also, don't use this macro if list
270 // entries other than the Entry may be deleted when processing
271 // the current Entry.
272 //
273 #define NET_LIST_FOR_EACH_SAFE(Entry, NextEntry, ListHead) \
274 for(Entry = (ListHead)->ForwardLink, NextEntry = Entry->ForwardLink; \
275 Entry != (ListHead); \
276 Entry = NextEntry, NextEntry = Entry->ForwardLink \
277 )
278
279 //
280 // Make sure the list isn't empty before get the frist/last record.
281 //
282 #define NET_LIST_HEAD(ListHead, Type, Field) \
283 NET_LIST_USER_STRUCT((ListHead)->ForwardLink, Type, Field)
284
285 #define NET_LIST_TAIL(ListHead, Type, Field) \
286 NET_LIST_USER_STRUCT((ListHead)->BackLink, Type, Field)
287
288 //#define NetListRemoveEntry(Entry) RemoveEntryList (Entry)
289
290 LIST_ENTRY*
291 NetListRemoveHead (
292 LIST_ENTRY *Head
293 );
294
295 LIST_ENTRY*
296 NetListRemoveTail (
297 LIST_ENTRY *Head
298 );
299
300 VOID
301 NetListInsertAfter (
302 IN LIST_ENTRY *PrevEntry,
303 IN LIST_ENTRY *NewEntry
304 );
305
306 VOID
307 NetListInsertBefore (
308 IN LIST_ENTRY *PostEntry,
309 IN LIST_ENTRY *NewEntry
310 );
311
312
313 //
314 // Object container: EFI network stack spec defines various kinds of
315 // tokens. The drivers can share code to manage those objects.
316 //
317 typedef struct {
318 LIST_ENTRY Link;
319 VOID *Key;
320 VOID *Value;
321 } NET_MAP_ITEM;
322
323 typedef struct {
324 LIST_ENTRY Used;
325 LIST_ENTRY Recycled;
326 UINTN Count;
327 } NET_MAP;
328
329 #define NET_MAP_INCREAMENT 64
330
331 VOID
332 NetMapInit (
333 IN NET_MAP *Map
334 );
335
336 VOID
337 NetMapClean (
338 IN NET_MAP *Map
339 );
340
341 BOOLEAN
342 NetMapIsEmpty (
343 IN NET_MAP *Map
344 );
345
346 UINTN
347 NetMapGetCount (
348 IN NET_MAP *Map
349 );
350
351 EFI_STATUS
352 NetMapInsertHead (
353 IN NET_MAP *Map,
354 IN VOID *Key,
355 IN VOID *Value OPTIONAL
356 );
357
358 EFI_STATUS
359 NetMapInsertTail (
360 IN NET_MAP *Map,
361 IN VOID *Key,
362 IN VOID *Value OPTIONAL
363 );
364
365 NET_MAP_ITEM *
366 NetMapFindKey (
367 IN NET_MAP *Map,
368 IN VOID *Key
369 );
370
371 VOID *
372 NetMapRemoveItem (
373 IN NET_MAP *Map,
374 IN NET_MAP_ITEM *Item,
375 OUT VOID **Value OPTIONAL
376 );
377
378 VOID *
379 NetMapRemoveHead (
380 IN NET_MAP *Map,
381 OUT VOID **Value OPTIONAL
382 );
383
384 VOID *
385 NetMapRemoveTail (
386 IN NET_MAP *Map,
387 OUT VOID **Value OPTIONAL
388 );
389
390 typedef
391 EFI_STATUS
392 (*NET_MAP_CALLBACK) (
393 IN NET_MAP *Map,
394 IN NET_MAP_ITEM *Item,
395 IN VOID *Arg
396 );
397
398 EFI_STATUS
399 NetMapIterate (
400 IN NET_MAP *Map,
401 IN NET_MAP_CALLBACK CallBack,
402 IN VOID *Arg OPTIONAL
403 );
404
405
406 //
407 // Helper functions to implement driver binding and service binding protocols.
408 //
409 EFI_STATUS
410 NetLibCreateServiceChild (
411 IN EFI_HANDLE ControllerHandle,
412 IN EFI_HANDLE ImageHandle,
413 IN EFI_GUID *ServiceBindingGuid,
414 OUT EFI_HANDLE *ChildHandle
415 );
416
417 EFI_STATUS
418 NetLibDestroyServiceChild (
419 IN EFI_HANDLE ControllerHandle,
420 IN EFI_HANDLE ImageHandle,
421 IN EFI_GUID *ServiceBindingGuid,
422 IN EFI_HANDLE ChildHandle
423 );
424
425 EFI_STATUS
426 NetLibGetMacString (
427 IN EFI_HANDLE SnpHandle,
428 IN EFI_HANDLE ImageHandle,
429 IN OUT CHAR16 **MacString
430 );
431
432 VOID
433 NetLibCreateIPv4DPathNode (
434 IN OUT IPv4_DEVICE_PATH *Node,
435 IN EFI_HANDLE Controller,
436 IN IP4_ADDR LocalIp,
437 IN UINT16 LocalPort,
438 IN IP4_ADDR RemoteIp,
439 IN UINT16 RemotePort,
440 IN UINT16 Protocol,
441 IN BOOLEAN UseDefaultAddress
442 );
443
444 EFI_HANDLE
445 NetLibGetNicHandle (
446 IN EFI_HANDLE Controller,
447 IN EFI_GUID *ProtocolGuid
448 );
449
450 EFI_STATUS
451 NetLibQueueDpc (
452 IN EFI_TPL DpcTpl,
453 IN EFI_DPC_PROCEDURE DpcProcedure,
454 IN VOID *DpcContext OPTIONAL
455 );
456
457 EFI_STATUS
458 NetLibDispatchDpc (
459 VOID
460 );
461
462 EFI_STATUS
463 EFIAPI
464 NetLibDefaultUnload (
465 IN EFI_HANDLE ImageHandle
466 );
467
468 enum {
469 //
470 //Various signatures
471 //
472 NET_BUF_SIGNATURE = EFI_SIGNATURE_32 ('n', 'b', 'u', 'f'),
473 NET_VECTOR_SIGNATURE = EFI_SIGNATURE_32 ('n', 'v', 'e', 'c'),
474 NET_QUE_SIGNATURE = EFI_SIGNATURE_32 ('n', 'b', 'q', 'u'),
475
476
477 NET_PROTO_DATA = 64, // Opaque buffer for protocols
478 NET_BUF_HEAD = 1, // Trim or allocate space from head
479 NET_BUF_TAIL = 0, // Trim or allocate space from tail
480 NET_VECTOR_OWN_FIRST = 0x01, // We allocated the 1st block in the vector
481 };
482
483 #define NET_CHECK_SIGNATURE(PData, SIGNATURE) \
484 ASSERT (((PData) != NULL) && ((PData)->Signature == (SIGNATURE)))
485
486 #define NET_SWAP_SHORT(Value) \
487 ((((Value) & 0xff) << 8) | (((Value) >> 8) & 0xff))
488
489 //
490 // Single memory block in the vector.
491 //
492 typedef struct {
493 UINT32 Len; // The block's length
494 UINT8 *Bulk; // The block's Data
495 } NET_BLOCK;
496
497 typedef VOID (*NET_VECTOR_EXT_FREE) (VOID *Arg);
498
499 //
500 //NET_VECTOR contains several blocks to hold all packet's
501 //fragments and other house-keeping stuff for sharing. It
502 //doesn't specify the where actual packet fragment begins.
503 //
504 typedef struct {
505 UINT32 Signature;
506 INTN RefCnt; // Reference count to share NET_VECTOR.
507 NET_VECTOR_EXT_FREE Free; // external function to free NET_VECTOR
508 VOID *Arg; // opeque argument to Free
509 UINT32 Flag; // Flags, NET_VECTOR_OWN_FIRST
510 UINT32 Len; // Total length of the assocated BLOCKs
511
512 UINT32 BlockNum;
513 NET_BLOCK Block[1];
514 } NET_VECTOR;
515
516 //
517 //NET_BLOCK_OP operate on the NET_BLOCK, It specifies
518 //where the actual fragment begins and where it ends
519 //
520 typedef struct {
521 UINT8 *BlockHead; // Block's head, or the smallest valid Head
522 UINT8 *BlockTail; // Block's tail. BlockTail-BlockHead=block length
523 UINT8 *Head; // 1st byte of the data in the block
524 UINT8 *Tail; // Tail of the data in the block, Tail-Head=Size
525 UINT32 Size; // The size of the data
526 } NET_BLOCK_OP;
527
528
529 //
530 //NET_BUF is the buffer manage structure used by the
531 //network stack. Every network packet may be fragmented,
532 //and contains multiple fragments. The Vector points to
533 //memory blocks used by the each fragment, and BlockOp
534 //specifies where each fragment begins and ends.
535 //
536 //It also contains a opaque area for protocol to store
537 //per-packet informations. Protocol must be caution not
538 //to overwrite the members after that.
539 //
540 typedef struct {
541 UINT32 Signature;
542 INTN RefCnt;
543 LIST_ENTRY List; // The List this NET_BUF is on
544
545 IP4_HEAD *Ip; // Network layer header, for fast access
546 TCP_HEAD *Tcp; // Transport layer header, for fast access
547 UINT8 ProtoData [NET_PROTO_DATA]; //Protocol specific data
548
549 NET_VECTOR *Vector; // The vector containing the packet
550
551 UINT32 BlockOpNum; // Total number of BlockOp in the buffer
552 UINT32 TotalSize; // Total size of the actual packet
553 NET_BLOCK_OP BlockOp[1]; // Specify the position of actual packet
554 } NET_BUF;
555
556
557 //
558 //A queue of NET_BUFs, It is just a thin extension of
559 //NET_BUF functions.
560 //
561 typedef struct {
562 UINT32 Signature;
563 INTN RefCnt;
564 LIST_ENTRY List; // The List this buffer queue is on
565
566 LIST_ENTRY BufList; // list of queued buffers
567 UINT32 BufSize; // total length of DATA in the buffers
568 UINT32 BufNum; // total number of buffers on the chain
569 } NET_BUF_QUEUE;
570
571 //
572 // Pseudo header for TCP and UDP checksum
573 //
574 #pragma pack(1)
575 typedef struct {
576 IP4_ADDR SrcIp;
577 IP4_ADDR DstIp;
578 UINT8 Reserved;
579 UINT8 Protocol;
580 UINT16 Len;
581 } NET_PSEUDO_HDR;
582 #pragma pack()
583
584 //
585 // The fragment entry table used in network interfaces. This is
586 // the same as NET_BLOCK now. Use two different to distinguish
587 // the two in case that NET_BLOCK be enhanced later.
588 //
589 typedef struct {
590 UINT32 Len;
591 UINT8 *Bulk;
592 } NET_FRAGMENT;
593
594 #define NET_GET_REF(PData) ((PData)->RefCnt++)
595 #define NET_PUT_REF(PData) ((PData)->RefCnt--)
596 #define NETBUF_FROM_PROTODATA(Info) _CR((Info), NET_BUF, ProtoData)
597
598 #define NET_BUF_SHARED(Buf) \
599 (((Buf)->RefCnt > 1) || ((Buf)->Vector->RefCnt > 1))
600
601 #define NET_VECTOR_SIZE(BlockNum) \
602 (sizeof (NET_VECTOR) + ((BlockNum) - 1) * sizeof (NET_BLOCK))
603
604 #define NET_BUF_SIZE(BlockOpNum) \
605 (sizeof (NET_BUF) + ((BlockOpNum) - 1) * sizeof (NET_BLOCK_OP))
606
607 #define NET_HEADSPACE(BlockOp) \
608 (UINTN)((BlockOp)->Head - (BlockOp)->BlockHead)
609
610 #define NET_TAILSPACE(BlockOp) \
611 (UINTN)((BlockOp)->BlockTail - (BlockOp)->Tail)
612
613 NET_BUF *
614 NetbufAlloc (
615 IN UINT32 Len
616 );
617
618 VOID
619 NetbufFree (
620 IN NET_BUF *Nbuf
621 );
622
623
624 UINT8 *
625 NetbufGetByte (
626 IN NET_BUF *Nbuf,
627 IN UINT32 Offset,
628 OUT UINT32 *Index OPTIONAL
629 );
630
631 NET_BUF *
632 NetbufClone (
633 IN NET_BUF *Nbuf
634 );
635
636 NET_BUF *
637 NetbufDuplicate (
638 IN NET_BUF *Nbuf,
639 IN NET_BUF *Duplicate OPTIONAL,
640 IN UINT32 HeadSpace
641 );
642
643 NET_BUF *
644 NetbufGetFragment (
645 IN NET_BUF *Nbuf,
646 IN UINT32 Offset,
647 IN UINT32 Len,
648 IN UINT32 HeadSpace
649 );
650
651 VOID
652 NetbufReserve (
653 IN NET_BUF *Nbuf,
654 IN UINT32 Len
655 );
656
657 UINT8 *
658 NetbufAllocSpace (
659 IN NET_BUF *Nbuf,
660 IN UINT32 Len,
661 IN BOOLEAN FromHead
662 );
663
664 UINT32
665 NetbufTrim (
666 IN NET_BUF *Nbuf,
667 IN UINT32 Len,
668 IN BOOLEAN FromHead
669 );
670
671 UINT32
672 NetbufCopy (
673 IN NET_BUF *Nbuf,
674 IN UINT32 Offset,
675 IN UINT32 Len,
676 IN UINT8 *Dest
677 );
678
679 NET_BUF *
680 NetbufFromExt (
681 IN NET_FRAGMENT *ExtFragment,
682 IN UINT32 ExtNum,
683 IN UINT32 HeadSpace,
684 IN UINT32 HeadLen,
685 IN NET_VECTOR_EXT_FREE ExtFree,
686 IN VOID *Arg OPTIONAL
687 );
688
689 EFI_STATUS
690 NetbufBuildExt (
691 IN NET_BUF *Nbuf,
692 IN NET_FRAGMENT *ExtFragment,
693 IN UINT32 *ExtNum
694 );
695
696 NET_BUF *
697 NetbufFromBufList (
698 IN LIST_ENTRY *BufList,
699 IN UINT32 HeadSpace,
700 IN UINT32 HeaderLen,
701 IN NET_VECTOR_EXT_FREE ExtFree,
702 IN VOID *Arg OPTIONAL
703 );
704
705 VOID
706 NetbufFreeList (
707 IN LIST_ENTRY *Head
708 );
709
710 VOID
711 NetbufQueInit (
712 IN NET_BUF_QUEUE *NbufQue
713 );
714
715 NET_BUF_QUEUE *
716 NetbufQueAlloc (
717 VOID
718 );
719
720 VOID
721 NetbufQueFree (
722 IN NET_BUF_QUEUE *NbufQue
723 );
724
725 NET_BUF *
726 NetbufQueRemove (
727 IN NET_BUF_QUEUE *NbufQue
728 );
729
730 VOID
731 NetbufQueAppend (
732 IN NET_BUF_QUEUE *NbufQue,
733 IN NET_BUF *Nbuf
734 );
735
736 UINT32
737 NetbufQueCopy (
738 IN NET_BUF_QUEUE *NbufQue,
739 IN UINT32 Offset,
740 IN UINT32 Len,
741 IN UINT8 *Dest
742 );
743
744 UINT32
745 NetbufQueTrim (
746 IN NET_BUF_QUEUE *NbufQue,
747 IN UINT32 Len
748 );
749
750 VOID
751 NetbufQueFlush (
752 IN NET_BUF_QUEUE *NbufQue
753 );
754
755 UINT16
756 NetblockChecksum (
757 IN UINT8 *Bulk,
758 IN UINT32 Len
759 );
760
761 UINT16
762 NetAddChecksum (
763 IN UINT16 Checksum1,
764 IN UINT16 Checksum2
765 );
766
767 UINT16
768 NetbufChecksum (
769 IN NET_BUF *Nbuf
770 );
771
772 UINT16
773 NetPseudoHeadChecksum (
774 IN IP4_ADDR Src,
775 IN IP4_ADDR Dst,
776 IN UINT8 Proto,
777 IN UINT16 Len
778 );
779
780 #endif