# udp.cpp File Reference

Basic functions to receive and send UDP packets. More...

`#include "../../stdafx.h"`
`#include "../../date_func.h"`
`#include "../../debug.h"`
`#include "udp.h"`

Go to the source code of this file.

## Defines
#define | UDP_COMMAND(type) case type: this->NetworkPacketReceive_ ## type ## _command(p, client_addr); break;
| Defines a simple (switch) case for each network packet.
#define | DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND(type)
| Create stub implementations for all receive commands that only show a warning that the given command is not available for the socket where the packet came from.

## Detailed Description

Basic functions to receive and send UDP packets.

Definition in file udp.cpp.

## Define Documentation

#define DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND | ( | type |  | ) |

Value:

    void NetworkUDPSocketHandler::NetworkPacketReceive_## type ##_command(\
        Packet *p, NetworkAddress *client_addr) { \
      DEBUG(net, 0, "[udp] received packet type %d on wrong port from %s", \
          type, client_addr->GetAddressAsString()); \
    }

Create stub implementations for all receive commands that only show a warning that the given command is not available for the socket where the packet came from.

Parameters:

  | type | the packet type to create the stub for

Definition at line 332 of file udp.cpp.

#define UDP_COMMAND | ( | type |  | ) | case type: this->NetworkPacketReceive_ ## type ## _command(p, client_addr); break;

Defines a simple (switch) case for each network packet.

Parameters:

  | type | the packet type to create the case for

Definition at line 286 of file udp.cpp.

Referenced by NetworkUDPSocketHandler::HandleUDPPacket().