Files
@ 89a4bb14d085
Branch filter:
Location: vmkdrivers/BLD/build/HEADERS/vmkapi-current-all-public/vmkernel64/release/net/vmkapi_net_proto.h
89a4bb14d085
23.9 KiB
text/x-chdr
ESXi-5.5-U1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | /* **********************************************************
* Copyright 2011 VMware, Inc. All rights reserved.
* **********************************************************/
/*
* @VMKAPIMOD_LICENSE@
*/
/*
***********************************************************************
* NetProto */ /**
* \addtogroup Network
*@{
* \defgroup NetProto Network protocol header definitions
*@{
*
***********************************************************************
*/
#ifndef _VMKAPI_NET_PROTO_H_
#define _VMKAPI_NET_PROTO_H_
/** \cond never */
#ifndef VMK_HEADER_INCLUDED_FROM_VMKAPI_H
#error This vmkapi file should never be included directly but only via vmkapi.h
#endif
/** \endcond never */
#define VMK_ETH_ADDR_FMT_STR "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
#define VMK_ETH_ADDR_FMT_ARGS(addrPtr) ((vmk_uint8 *) (addrPtr))[0],\
((vmk_uint8 *) (addrPtr))[1],\
((vmk_uint8 *) (addrPtr))[2],\
((vmk_uint8 *) (addrPtr))[3],\
((vmk_uint8 *) (addrPtr))[4],\
((vmk_uint8 *) (addrPtr))[5]
#define VMK_ETH_PTR_ADDR_FMT_ARGS(addrPtr) &((vmk_uint8 *) (addrPtr))[0],\
&((vmk_uint8 *) (addrPtr))[1],\
&((vmk_uint8 *) (addrPtr))[2],\
&((vmk_uint8 *) (addrPtr))[3],\
&((vmk_uint8 *) (addrPtr))[4],\
&((vmk_uint8 *) (addrPtr))[5]
#define VMK_IPV4_ADDR_FMT_STR "%u.%u.%u.%u"
#define VMK_IPV4_ADDR_FMT_STR_ARGS(val) ((vmk_BE32ToCPU((vmk_uint32) (val)) >> 24) & 0xFF),\
((vmk_BE32ToCPU((vmk_uint32) (val)) >> 16) & 0xFF),\
((vmk_BE32ToCPU((vmk_uint32) (val)) >> 8) & 0xFF),\
(vmk_BE32ToCPU((vmk_uint32) (val)) & 0xFF)
#define VMK_IPV6_ADDR_FMT_STR "%08x:%08x:%08x:%08x"
#define VMK_IPV6_ADDR_FMT_STR_ARGS(addrPtr) vmk_BE32ToCPU(((vmk_uint32 *) (addrPtr))[0]),\
vmk_BE32ToCPU(((vmk_uint32 *) (addrPtr))[1]),\
vmk_BE32ToCPU(((vmk_uint32 *) (addrPtr))[2]),\
vmk_BE32ToCPU(((vmk_uint32 *) (addrPtr))[3])
/**
* \brief Ethernet type used in the ethernet header.
*/
typedef enum vmk_EthType {
/** Internet protocol version 4. */
VMK_ETH_TYPE_IPV4 = 0x0800,
/** Address resolution protocol. */
VMK_ETH_TYPE_ARP = 0x0806,
/** Cisco discovery protocol. */
VMK_ETH_TYPE_CDP = 0x2000,
/** Transparent interconnection of lots of links. */
VMK_ETH_TYPE_TRILL = 0x22f3,
/** Transparent Ethernet Bridging. */
VMK_ETH_TYPE_TRANSPARENT_ETH = 0x6558,
/** Reverse address resolution protocol. */
VMK_ETH_TYPE_RARP = 0x8035,
/** Apple talk. */
VMK_ETH_TYPE_ATALK = 0x809b,
/** Apple address resolution protocol. */
VMK_ETH_TYPE_AARP = 0x80f3,
/** Virtual LAN (IEEE 802.1q). */
VMK_ETH_TYPE_VLAN = 0x8100,
/** Internetwork packet exchange (alt). */
VMK_ETH_TYPE_IPX_ALT = 0x8137,
/** Internetwork packet exchange. */
VMK_ETH_TYPE_IPX = 0x8138,
/** SNMP over ethernet. */
VMK_ETH_TYPE_SNMP = 0x814c,
/** Internet protocol version 6. */
VMK_ETH_TYPE_IPV6 = 0x86dd,
/** Slow protocols (IEEE 802.3). */
VMK_ETH_TYPE_SLOW = 0x8809,
/** Multiprotocol label switching (unicast). */
VMK_ETH_TYPE_MPLS_UNICAST = 0x8847,
/** Multiprotocol label switching (multicast). */
VMK_ETH_TYPE_MPLS_MULTICAST = 0x8847,
/** PPP over ethernet (discovery). */
VMK_ETH_TYPE_PPPOE_DISCOVERY = 0x8863,
/** PPP over ethernet (session). */
VMK_ETH_TYPE_PPPOE_SESSION = 0x8864,
/** Jumbo frames. */
VMK_ETH_TYPE_JUMBO = 0x8870,
/** Provider bridging (IEEE 802.3ad). */
VMK_ETH_TYPE_PROVIDER_BRIDGING = 0x88a8,
/** Low level discovery protocol. */
VMK_ETH_TYPE_LLDP = 0x88cc,
/** Akimbi frames, (VMware VMlab). */
VMK_ETH_TYPE_AKIMBI = 0x88de,
/** Fiber channel over ethernet. */
VMK_ETH_TYPE_FCOE = 0x8906,
/** Fiber channel over ethernet (init). */
VMK_ETH_TYPE_FCOE_INIT = 0x8914,
/** VMware ESX beacon probing. */
VMK_ETH_TYPE_VMWARE = 0x8922,
/** QinQ tagging (IEEE 802.1ad). */
VMK_ETH_TYPE_QINQ = 0x9100,
/** DVfilter. */
VMK_ETH_TYPE_DVFILTER = 0xdfdf,
} vmk_EthType;
/**
* \brief Ethernet type used in the ethernet header, in network byte order.
*/
typedef enum {
/** Internet protocol version 4 (in net order). */
VMK_ETH_TYPE_IPV4_NBO = 0x0008,
/** Address resolution protocol (in net order). */
VMK_ETH_TYPE_ARP_NBO = 0x0608,
/** Cisco discovery protocol (in net order). */
VMK_ETH_TYPE_CDP_NBO = 0x0020,
/** Transparent interconnection of lots of links (in net order). */
VMK_ETH_TYPE_TRILL_NBO = 0xf322,
/** Transparent Ethernet Bridging (in net order). */
VMK_ETH_TYPE_TRANSPARENT_ETH_NBO = 0x5865,
/** Reverse address resolution protocol (in net order). */
VMK_ETH_TYPE_RARP_NBO = 0x3580,
/** Apple talk (in net order). */
VMK_ETH_TYPE_ATALK_NBO = 0x9b80,
/** Apple address resolution protocol (in net order). */
VMK_ETH_TYPE_AARP_NBO = 0xf380,
/** Virtual LAN (IEEE 802.1q) (in net order). */
VMK_ETH_TYPE_VLAN_NBO = 0x0081,
/** Internetwork packet exchange (alt) (in net order). */
VMK_ETH_TYPE_IPX_ALT_NBO = 0x3781,
/** Internetwork packet exchange (in net order). */
VMK_ETH_TYPE_IPX_NBO = 0x3881,
/** SNMP over ethernet (in net order). */
VMK_ETH_TYPE_SNMP_NBO = 0x4c81,
/** Internet protocol version 6 (in net order). */
VMK_ETH_TYPE_IPV6_NBO = 0xdd86,
/** Slow protocols (IEEE 802.3) (in net order). */
VMK_ETH_TYPE_SLOW_NBO = 0x0988,
/** Multiprotocol label switching (unicast) (in net order). */
VMK_ETH_TYPE_MPLS_UNICAST_NBO = 0x4788,
/** Multiprotocol label switching (multicast) (in net order). */
VMK_ETH_TYPE_MPLS_MULTICAST_NBO = 0x4788,
/** PPP over ethernet (discovery) (in net order). */
VMK_ETH_TYPE_PPPOE_DISCOVERY_NBO = 0x6388,
/** PPP over ethernet (session) (in net order). */
VMK_ETH_TYPE_PPPOE_SESSION_NBO = 0x6488,
/** Jumbo frames (in net order). */
VMK_ETH_TYPE_JUMBO_NBO = 0x7088,
/** Provider bridging (IEEE 802.3ad) (in net order). */
VMK_ETH_TYPE_PROVIDER_BRIDGING_NBO = 0xa888,
/** Low level discovery protocol (in net order). */
VMK_ETH_TYPE_LLDP_NBO = 0xcc88,
/** Akimbi frames, (VMware VMlab) (in net order). */
VMK_ETH_TYPE_AKIMBI_NBO = 0xde88,
/** Fiber channel over ethernet (in net order). */
VMK_ETH_TYPE_FCOE_NBO = 0x0689,
/** Fiber channel over ethernet (init) (in net order). */
VMK_ETH_TYPE_FCOE_INIT_NBO = 0x1489,
/** VMware ESX beacon probing (in net order). */
VMK_ETH_TYPE_VMWARE_NBO = 0x2289,
/** QinQ tagging (IEEE 802.1ad) (in net order). */
VMK_ETH_TYPE_QINQ_NBO = 0x0091,
/** DVfilter (in net order). */
VMK_ETH_TYPE_DVFILTER_NBO = 0xdfdf,
} vmk_EthTypeNBO;
/**
* \brief IP protocol numbers, used in IPv4 and IPv6 headers.
*/
typedef enum {
/** IPv6 hop-by-hop options. */
VMK_IP_PROTO_IPV6_HOPOPT = 0x00,
/** Internet control message protocol version 4. */
VMK_IP_PROTO_ICMPV4 = 0x01,
/** Internet group management protocol. */
VMK_IP_PROTO_IGMP = 0x02,
/** Internet protocol version 4. */
VMK_IP_PROTO_IPV4 = 0x04,
/** Transmission control protocol. */
VMK_IP_PROTO_TCP = 0x06,
/** Exterior gateway protocol. */
VMK_IP_PROTO_EGP = 0x08,
/** Interior gateway protocol. */
VMK_IP_PROTO_IGP = 0x09,
/** User datagram protocol. */
VMK_IP_PROTO_UDP = 0x11,
/** Internet protocol version 6. */
VMK_IP_PROTO_IPV6 = 0x29,
/** IPv6 routing option. */
VMK_IP_PROTO_IPV6_ROUTE = 0x2b,
/** IPv6 fragment option. */
VMK_IP_PROTO_IPV6_FRAG = 0x2c,
/** Generic routing encapsulation. */
VMK_IP_PROTO_GRE = 0x2f,
/** Encapsulating security payload. */
VMK_IP_PROTO_ESP = 0x32,
/** Authentication header. */
VMK_IP_PROTO_AH = 0x33,
/** Internet control message protocol version 6. */
VMK_IP_PROTO_ICMPV6 = 0x3a,
/** IPv6 no next header. */
VMK_IP_PROTO_IPV6_NONXT = 0x3b,
/** IPv6 destination options. */
VMK_IP_PROTO_IPV6_DSTOPTS = 0x3c,
/** Enhanced interior gateway routing protocol. */
VMK_IP_PROTO_EIGRP = 0x58,
/** Open shortest path first. */
VMK_IP_PROTO_OSPF = 0x59,
/** IP over IP. */
VMK_IP_PROTO_IPIP = 0x5e,
/** Protocol independant multicast. */
VMK_IP_PROTO_PIM = 0x67,
/** Virtual router redundancy protocol. */
VMK_IP_PROTO_VRRP = 0x70,
/** Layer 2 tunneling protocol. */
VMK_IP_PROTO_L2TP = 0x73,
/** Mobility IP. */
VMK_IP_PROTO_MOB = 0x87,
/** Host identity protocol. */
VMK_IP_PROTO_HIP = 0x8b,
} vmk_IPProto;
/**
* \brief Ethernet header.
*/
typedef struct vmk_EthHdr {
/** Destination MAC address. */
vmk_uint8 daddr[6];
/** Source MAC address. */
vmk_uint8 saddr[6];
/** Ethernet type of the payload. */
vmk_uint16 type;
} VMK_ATTRIBUTE_PACKED vmk_EthHdr;
/**
* \brief VLAN header, inserted after the type field of regular ethernet frames.
*/
typedef struct vmk_VLANHdr {
/** High four bits of the VLAN ID. */
vmk_uint8 vlanIDHigh:4;
/** The frame is eligible to be dropped in the presence of congestion. */
vmk_uint8 dropEligible:1;
/** Priority tag. */
vmk_uint8 priority:3;
/** Low eight bits of the VLAN ID. */
vmk_uint8 vlanIDLow;
/** Ethernet type of the payload. */
vmk_uint16 type;
} VMK_ATTRIBUTE_PACKED vmk_VLANHdr;
/** Helper macro to get the vlan ID in a vmk_VLANHdr. */
#define VMK_VLAN_HDR_GET_VID(hdr) \
(((hdr)->vlanIDHigh << 8) | (hdr)->vlanIDLow)
/** Helper macro to set the vlan ID in a vmk_VLANHdr. */
#define VMK_VLAN_HDR_SET_VID(hdr, val) do { \
(hdr)->vlanIDHigh = (val) >> 8; \
(hdr)->vlanIDLow = (val); \
} while (0)
/**
* \brief IPv4 header.
*/
typedef struct vmk_IPv4Hdr {
/** Length of the IP header, including options in 32-bit words. */
vmk_uint8 headerLength:4;
/** Internet protocol version. */
vmk_uint8 version:4;
/* This field has two different interpretations. */
union {
/** The old interpretation, TOS. */
struct {
/** Type of service. */
vmk_uint8 tos:5;
/** Precendence. */
vmk_uint8 precedence:3;
};
/** The new interpretation, DSCP. */
struct {
/** Explicit Congestion Notification. */
vmk_uint8 ecn:2;
/** Differentiated Services Code Point. */
vmk_uint8 dscp:6;
};
/** Global access. */
vmk_uint8 qosFlags;
};
/** Total length of the fragment. */
vmk_uint16 totalLength;
/** Identification of the fragment in the original packet. */
vmk_uint16 identification;
/** IP Fragment info. */
union {
/** Bitfield access. */
struct {
/** High five bits of this fragment's offset in the packet. */
vmk_uint8 fragmentOffsetHigh:5;
/** More fragments of this packets are available. */
vmk_uint8 moreFragments:1;
/** This packet must not be fragmented. */
vmk_uint8 dontFragment:1;
/** Reserved bit, must be zero. */
vmk_uint8 zero:1;
/** Low eight bits of the fragment offset. */
vmk_uint8 fragmentOffsetLow;
};
/* Global access. */
vmk_uint16 fragmentInfo;
};
/** Time to live. */
vmk_uint8 ttl;
/** Protocol number of the payload. */
vmk_uint8 protocol;
/** Checksum of the header. */
vmk_uint16 checksum;
/** Source address of the packet. */
vmk_uint32 saddr;
/** Destination address of the packet. */
vmk_uint32 daddr;
} VMK_ATTRIBUTE_PACKED vmk_IPv4Hdr;
/** Helper macro to get the fragment offset in a vmk_IPv4Hdr. */
#define VMK_IPV4_HDR_GET_FRAGMENT_OFFSET(hdr) \
(((hdr)->fragmentOffsetHigh << 8) | (hdr)->fragmentOffsetLow)
/** Helper macro to set the fragment offset in a vmk_IPv4Hdr. */
#define VMK_IPV4_HDR_SET_FRAGMENT_OFFSET(hdr, val) do { \
(hdr)->fragmentOffsetHigh = (val) >> 8; \
(hdr)->fragmentOffsetLow = (val); \
} while (0)
/**
* \brief IPv6 header.
*/
typedef struct vmk_IPv6Hdr {
/** High four bits of the traffic class. */
vmk_uint8 trafficClassHigh:4;
/** Internet protocol version. */
vmk_uint8 version:4;
/** High four bits of the flow label. */
vmk_uint8 flowLabelHigh:4;
/** Low four bits of the traffic class. */
vmk_uint8 trafficClassLow:4;
/** High sixteen bits of the flow label. */
vmk_uint16 flowLabelLow;
/** Length of this packets payload. */
vmk_uint16 payloadLength;
/** Next header's protocol number. */
vmk_uint8 nextHeader;
/** Hop limit (similar to TTL in IPv4). */
vmk_uint8 hopLimit;
/** Source address of the packet. */
vmk_uint8 saddr[16];
/** Destination address of the packet. */
vmk_uint8 daddr[16];
} VMK_ATTRIBUTE_PACKED vmk_IPv6Hdr;
/** Helper macro to get the traffic class in a vmk_IPv6Hdr. */
#define VMK_IPV6_HDR_GET_TRAFFIC_CLASS(hdr) \
(((hdr)->trafficClassHigh << 4) | (hdr)->trafficClassLow)
/** Helper macro to set the traffic class in a vmk_IPv6Hdr. */
#define VMK_IPV6_HDR_SET_TRAFFIC_CLASS(hdr, val) do { \
(hdr)->trafficClassHigh = (val) >> 4; \
(hdr)->trafficClassLow = (val); \
} while (0)
/** Helper macro to get the flow label in a vmk_IPv6Hdr. */
#define VMK_IPV6_HDR_GET_FLOW_LABEL(hdr) \
(((hdr)->flowLabelHigh << 16) | vmk_Ntohs((hdr)->flowLabelLow))
/** Helper macro to set the flow label in a vmk_IPv6Hdr. */
#define VMK_IPV6_HDR_SET_FLOW_LABEL(hdr, val) do { \
(hdr)->flowLabelHigh = (val) >> 16; \
(hdr)->flowLabelLow = vmk_Htons(val); \
} while (0)
/**
* \brief IPv6 extension header.
*/
typedef struct vmk_IPv6ExtHdr {
/** Next header's protocol number. */
vmk_uint8 nextHeader;
/** Length of this header, in 64-bit words (not including the first one). */
vmk_uint8 hdrExtLength;
/** Option-specific area. */
vmk_uint16 optPad1;
/** Option-specific area. */
vmk_uint32 optPad2;
} VMK_ATTRIBUTE_PACKED vmk_IPv6ExtHdr;
/**
* \brief ICMP header.
*/
typedef struct vmk_ICMPHdr {
/** Type of this ICMP message. */
vmk_uint8 type;
/** Code of this ICMP message. */
vmk_uint8 code;
/** Checksum of the entire ICMP message. */
vmk_uint16 checksum;
} VMK_ATTRIBUTE_PACKED vmk_ICMPHdr;
/**
* \brief IGMP header.
*/
typedef struct vmk_IGMPHdr {
/** Type of this IGMP message. */
vmk_uint8 type;
/** Maximum time for an IGMP report corresponding to the IGMP query. */
vmk_uint8 maxResponseTime;
/** Checksum of the entire IGMP message. */
vmk_uint16 checksum;
/** Multicast group on which this IGMP message operates. */
vmk_uint32 groupAddr;
} VMK_ATTRIBUTE_PACKED vmk_IGMPHdr;
/**
* \brief UDP header.
*/
typedef struct vmk_UDPHdr {
/** Source port. */
vmk_uint16 srcPort;
/** Destination port. */
vmk_uint16 dstPort;
/** Length of the entire UDP message (header + data). */
vmk_uint16 length;
/** Checksum of the UDP message. */
vmk_uint16 checksum;
} VMK_ATTRIBUTE_PACKED vmk_UDPHdr;
/**
* \brief TCP header.
*/
typedef struct vmk_TCPHdr {
/** Source port. */
vmk_uint16 srcPort;
/** Destination port. */
vmk_uint16 dstPort;
/** Sequence number. */
vmk_uint32 seq;
/** Acknowledgement number. */
vmk_uint32 ackSeq;
/** Reserved. */
vmk_uint8 reserved:4;
/** Length of the TCP header in 32-bit words. */
vmk_uint8 dataOffset:4;
/** TCP flags. */
union {
/** Bitfield access. */
struct {
/** FIN flag: no more data from sender. */
vmk_uint8 fin:1;
/** SYN flag: synchronize sequence numbers. */
vmk_uint8 syn:1;
/** RST flag: reset the connection. */
vmk_uint8 rst:1;
/** PSH flag: push data to application. */
vmk_uint8 psh:1;
/** ACK flag: acknowledgement field is significant. */
vmk_uint8 ack:1;
/** URG flag: urgent pointer field is significant. */
vmk_uint8 urg:1;
/** ECE flag: peer is ECN capable. */
vmk_uint8 ece:1;
/** CWR flag: congestion window has been reduced. */
vmk_uint8 cwr:1;
};
/** Global access. */
vmk_uint8 flags;
};
/** Size of the receive window. */
vmk_uint16 window;
/** Checksum of the TCP packet. */
vmk_uint16 checksum;
/** Last urgent data byte. */
vmk_uint16 urgPtr;
} VMK_ATTRIBUTE_PACKED vmk_TCPHdr;
/**
* \brief Fence header.
*/
typedef struct vmk_FenceHdr {
/** Fence header version. */
vmk_uint8 version:2;
/** Original ethernet frame is fragmented. */
vmk_uint8 frag:1;
/** Fragment ID. */
vmk_uint8 fragmentID:5;
/** Fence ID. */
vmk_uint32 fenceID:24;
} VMK_ATTRIBUTE_PACKED vmk_FenceHdr;
/**
* \brief VXLAN header.
*/
typedef struct vmk_VXLANHdr {
/** Flags. */
vmk_uint8 flags1:2;
/** Packet needs replication to multicast group (used for multicast proxy). */
vmk_uint8 locallyReplicate:1;
/** Instance ID flag, must be set to 1. */
vmk_uint8 instanceID:1;
/** Flags. */
vmk_uint8 flags2:4;
/** Reserved. */
vmk_uint32 reserved1:24;
/** VXLAN ID. */
vmk_uint32 vxlanID:24;
/** Reserved. */
vmk_uint8 reserved2:8;
} VMK_ATTRIBUTE_PACKED vmk_VXLANHdr;
/** Helper macro to check if a VXLAN ID is valid. */
#define VMK_VXLAN_ID_IS_VALID(vxlanID) (0 < (vxlanID) && (vxlanID) <= 0xffffff)
/**
* \brief GRE header.
*/
typedef struct vmk_GREHdr {
/** GRE flags. */
union {
/** Bitfield access. */
struct {
/** Recursion control. */
vmk_uint8 reserved1:3;
/** Strict source route. */
vmk_uint8 strictSourceRoute:1;
/** Sequence number field is present. */
vmk_uint8 sequencePresent:1;
/** Key field is present. */
vmk_uint8 keyPresent:1;
/** Routing field is present. */
vmk_uint8 routingPresent:1;
/** Checksum field is present. */
vmk_uint8 checksumPresent:1;
/** Version. */
vmk_uint8 version:3;
/** Flags. */
vmk_uint8 reserved2:5;
};
/** Global access. */
vmk_uint16 flags;
};
/** Protocol number of the inner packet. */
vmk_uint16 protocol;
/** Optionnal fields follow. */
vmk_uint32 options[0];
} VMK_ATTRIBUTE_PACKED vmk_GREHdr;
/**
* \brief PIM header.
*/
typedef struct vmk_PIMHdr {
/** PIM message type. */
vmk_uint8 type:4;
/** PIM version number. */
vmk_uint8 version:4;
/** Reserved. */
vmk_uint8 reserved;
/** Checksum of the entire PIM message. */
vmk_uint16 checksum;
} VMK_ATTRIBUTE_PACKED vmk_PIMHdr;
/*
************************************************************************
* vmk_VXLANConfiguredPortGetAll -- */ /**
*
* \brief Get all UDP port numbers configured as VXLAN UDP ports.
*
* \note Since IANA has not assigned a specific UDP port for VXLAN use,
* it is possible for deployed systems to have more than one
* UDP port used for VXLAN. To handle this case, we need to
* support at least two UDP port numbers.
*
* \note nPorts should be set to at least vmk_NetProtoVXLANMaxPorts to
* get all the configured ports, otherwise it is possible that
* only a partial list of UDP ports is returned.
*
* \param[out] portList List of ports configured for VXLAN use.
* \param[in,out] nPorts Number of ports memory allocated for (in)
* actual number of ports returned(out).
*
* \retval VMK_OK On success.
* \retval VMK_BAD_PARAM if bad arguments are passed.
************************************************************************
*/
VMK_ReturnStatus vmk_VXLANConfiguredPortGetAll(vmk_uint16 *portList,
vmk_uint8 *nPorts);
/*
***********************************************************************
* vmk_VXLANIsConfiguredPort -- */ /**
*
* \brief Checks to see if portNBO is one of the configured VXLAN ports.
*
* \param[in] portNBO Port number (in network byte order).
*
* \retval VMK_TRUE If portNBO is one of the configured
* VXLAN ports.
*
* \retval VMK_FALSE Otherwise.
*
***********************************************************************
*/
vmk_Bool vmk_VXLANIsConfiguredPort(vmk_uint16 portNBO);
/*
***********************************************************************
* vmk_VXLANConfiguredPortAdd -- */ /**
*
* \brief Add a port to the list of configured ports for VXLAN
*
* \param[in] portNBO Port number in network byte order.
*
* \retval VMK_OK On success.
* \retval VMK_EXISTS If the port number already exists.
* \retval VMK_LIMIT_EXCEEDED If the number of ports in the list
* already reached the maximum number
* of configurable ports.
***********************************************************************
*/
VMK_ReturnStatus vmk_VXLANConfiguredPortAdd(vmk_uint16 portNBO);
/*
***********************************************************************
* vmk_VXLANConfiguredPortRemove -- */ /**
*
* \brief Remove a port from the list of configured ports for VXLAN
*
* \param[in] portNBO Port number in network byte order.
*
* \retval VMK_OK On success.
* \retval VMK_NOT_FOUND If the port number is not found.
* \retval VMK_NOT_SUPPORTED If the removal of the port is not
* supported. This can happen if it
* is the last port in the list.
***********************************************************************
*/
VMK_ReturnStatus vmk_VXLANConfiguredPortRemove(vmk_uint16 portNBO);
/*
***********************************************************************
* vmk_VXLANConfiguredPortGetPrimary -- */ /**
*
* \brief Get the primary UDP port number configured for VXLAN.
*
* \retval Primary VXLAN UDP port number.
***********************************************************************
*/
vmk_uint16 vmk_VXLANConfiguredPortGetPrimary(void);
/*
***********************************************************************
* vmk_VXLANConfiguredPortSetPrimary -- */ /**
*
* \brief Sets the primary configured VXLAN UDP port.
*
* \param[in] portNBO Port number in network byte order.
*
***********************************************************************
*/
void vmk_VXLANConfiguredPortSetPrimary(vmk_uint16 portNBO);
#endif /* _VMKAPI_NET_PROTO_H_ */
/** @} */
/** @} */
|