NetBurner 3.5.0
PDF Version
 
UDP Packet Object

The NetBurner UDP protocol API is implemented in two ways: More...

Topics

 UDP Error Codes
 

Classes

class  UDPPacket
 UDP Packet Class. More...
 

Functions

bool RegisterUDPFifo (uint16_t listenPort, OS_FIFO *pFifo)
 Register a FIFO to receive incoming UDP packets.
 
bool RegisterUDPFifoVia (uint16_t listenPort, OS_FIFO *pFifo, int interface)
 Register a FIFO to receive incoming UDP packets on the specified network interface.
 
uint16_t RegisterEphemeralFifo (OS_FIFO *pfifo, int ifn=-1)
 Register a UDP FIFO with a random port number to receive incoming UDP packets.
 
bool RegisterUDPFifoWithNotify (uint16_t listenPort, OS_FIFO *pFifo, udp_data_notify *pNotifyFunction)
 Register a FIFO to receive incoming UDP packets and a callback function to receive a notification when a packet is received.
 
bool RegisterUDPFifoWithNotifyVia (uint16_t listenPort, OS_FIFO *pFifo, udp_data_notify *pNotifyFunction, int interface)
 Register a FIFO to receive incoming UDP packets and a callback function to receive a notification when a packet is received. Same as RegisterUDPFifoWithNotify() with the additional parameter to specify the local network interface.
 
void UnregisterUDPFifo (uint16_t listenPort, bool drain=false)
 Unregister a UDP FIFO.
 

Detailed Description

The NetBurner UDP protocol API is implemented in two ways:

  1. As a C++ class, which makes memory management easier UDPPacket.
  2. Wrapper functions that implement a standard UDP sockets interface. For example, sendto() and recvfrom().

#include< udp.h >

Function Documentation

◆ RegisterEphemeralFifo()

uint16_t RegisterEphemeralFifo ( OS_FIFO * pfifo,
int ifn = -1 )

#include <udp.h>

Register a UDP FIFO with a random port number to receive incoming UDP packets.

A OS_FIFO is used to receive incoming UDP Packets. This function registers an OS_FIFO to listen on a random unused UDP port number, which can be useful when sending a UDP packet to a remote host that will respond to the received packet source port number.

Parameters
pfifoPointer to the OS_FIFO to register
ifnOptional local interface number to listen on
Returns
The registered port number of success, 0 on failure.
See also
RegisterUDPFifoWithNotify(), UnregisterUDPFifo()

◆ RegisterUDPFifo()

bool RegisterUDPFifo ( uint16_t listenPort,
OS_FIFO * pFifo )

#include <udp.h>

Register a FIFO to receive incoming UDP packets.

A OS_FIFO is used to receive incoming UDP Packets. This function registers an OS_FIFO to listen to a specific UDP port number.

Parameters
listenPortPort to listen on for incoming packets
pFifoPointer to the OS_FIFO to register
Returns
true if successful
See also
RegisterUDPFifoWithNotify(), UnregisterUDPFifo(), RegisterEphemeralFifo()

◆ RegisterUDPFifoVia()

bool RegisterUDPFifoVia ( uint16_t listenPort,
OS_FIFO * pFifo,
int interface )

#include <udp.h>

Register a FIFO to receive incoming UDP packets on the specified network interface.

A OS_FIFO is used to receive incoming UDP Packets. This function registers an OS_FIFO to listen to a specific UDP port number and local network interface.

Parameters
listenPortPort to listen on for incoming packets
pFifoPointer to the OS_FIFO to register
interfaceLocal network interface number
Returns
true if successful
See also
RegisterUDPFifo(), RegisterUDPFifoWithNotify(), UnregisterUDPFifo(), RegisterEphemeralFifo()

◆ RegisterUDPFifoWithNotify()

bool RegisterUDPFifoWithNotify ( uint16_t listenPort,
OS_FIFO * pFifo,
udp_data_notify * pNotifyFunction )

#include <udp.h>

Register a FIFO to receive incoming UDP packets and a callback function to receive a notification when a packet is received.

A OS_FIFO is used to receive incoming UDP Packets. This function registers an OS_FIFO to listen to a specific UDP port number and a notification callback function.

Parameters
listenPortPort to listen on for incoming packets
pFifoPointer to the OS_FIFO to register
pNotifyFunctionPointer to callback function to receive notification
Returns
true if successful
See also
RegisterUDPFifo(), UnregisterUDPFifo()

◆ RegisterUDPFifoWithNotifyVia()

bool RegisterUDPFifoWithNotifyVia ( uint16_t listenPort,
OS_FIFO * pFifo,
udp_data_notify * pNotifyFunction,
int interface )

#include <udp.h>

Register a FIFO to receive incoming UDP packets and a callback function to receive a notification when a packet is received. Same as RegisterUDPFifoWithNotify() with the additional parameter to specify the local network interface.

A OS_FIFO is used to receive incoming UDP Packets. This function registers an OS_FIFO to listen to a specific UDP port number and a notification callback function.

Parameters
listenPortPort to listen on for incoming packets
pFifoPointer to the OS_FIFO to register
pNotifyFunctionPointer to callback function to receive notification
interfaceLocal network interface number
Returns
true if successful
See also
RegisterUDPFifo(), UnregisterUDPFifo()

◆ UnregisterUDPFifo()

void UnregisterUDPFifo ( uint16_t listenPort,
bool drain = false )

#include <udp.h>

Unregister a UDP FIFO.

Parameters
listenPortPort to listen on for incoming packets.
drainOptional, default if false. If set to true, will free all queued pool pointers.
See also
RegisterUDPFifo(), RegisterUDPFifoWithNotify()