NDN-DPDK
High-Speed Named Data Networking Forwarder
Data Structures | Macros | Typedefs | Enumerations | Variables
api.h File Reference
#include "../../csrc/ethface/xdp-locator.h"
#include "../../csrc/ndni/an.h"
#include <linux/bpf.h>
#include <linux/if_ether.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <linux/udp.h>
#include <bpf/bpf_endian.h>
#include <bpf/bpf_helpers.h>

Go to the source code of this file.

Data Structures

struct  vlanhdr
 
struct  vxlanhdr
 
struct  VxlanInnerHdr
 
struct  GtpInnerHdr
 

Macros

#define PacketPtrAs_(ptr, size, ...)
 
#define PacketPtrAs(ptr, ...)   PacketPtrAs_((ptr), ##__VA_ARGS__, sizeof(*(ptr)))
 Perform bounds-checking on packet pointer. More...
 

Typedefs

typedef struct VxlanInnerHdr VxlanInnerHdr
 
typedef struct GtpInnerHdr GtpInnerHdr
 

Enumerations

enum  { UDPPortVXLAN = 4789 , UDPPortGTP = 2152 }
 

Variables

struct vlanhdr __rte_packed
 

Macro Definition Documentation

◆ PacketPtrAs

#define PacketPtrAs (   ptr,
  ... 
)    PacketPtrAs_((ptr), ##__VA_ARGS__, sizeof(*(ptr)))

Perform bounds-checking on packet pointer.

This can be used within an XDP program, where `struct xdp_md* ctx` is declared. If the structure dereferenced from the given pointer is within the bounds of the packet, this returns the pointer; otherwise, the packet is dropped.

const Header* hdr = PacketPtrAs((const Header*)pkt);
const Header* hdr = PacketPtrAs((const Header*)pkt, HDR_LEN);
#define PacketPtrAs(ptr,...)
Perform bounds-checking on packet pointer.
Definition: api.h:67

◆ PacketPtrAs_

#define PacketPtrAs_ (   ptr,
  size,
  ... 
)
Value:
__extension__({ \
if ((const uint8_t*)ptr + (size_t)(size) > (const uint8_t*)(long)ctx->data_end) { \
return XDP_DROP; \
} \
pkt; \
})

Typedef Documentation

◆ GtpInnerHdr

typedef struct GtpInnerHdr GtpInnerHdr

◆ VxlanInnerHdr

typedef struct VxlanInnerHdr VxlanInnerHdr

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
UDPPortVXLAN 
UDPPortGTP 

Variable Documentation

◆ __rte_packed

struct vxlanhdr __rte_packed