# 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.

## Functions

| DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND (PACKET_UDP_CLIENT_FIND_SERVER)
| DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND (PACKET_UDP_SERVER_RESPONSE)
| DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND (PACKET_UDP_CLIENT_DETAIL_INFO)
| DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND (PACKET_UDP_SERVER_DETAIL_INFO)
| DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND (PACKET_UDP_SERVER_REGISTER)
| DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND (PACKET_UDP_MASTER_ACK_REGISTER)
| DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND (PACKET_UDP_CLIENT_GET_LIST)
| DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND (PACKET_UDP_MASTER_RESPONSE_LIST)
| DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND (PACKET_UDP_SERVER_UNREGISTER)
| DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND (PACKET_UDP_CLIENT_GET_NEWGRFS)
| DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND (PACKET_UDP_SERVER_NEWGRFS)
| DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND (PACKET_UDP_MASTER_SESSION_KEY)

## 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().