#ifndef NETWORK_TARGET_HH
#define NETWORK_TARGET_HH
/**
* @file
*
* Abstract NetworkTarget definition
*/
#include "Channel.hh"
#include "Packet.hh"
/**
* Abstract interface for sending NetworkPackets to some NetworkSession-related destination, either a single
* NetworkNode or a NetworkGroup of nodes.
*/
class NetworkTarget {
friend class NetworkGroup;
protected:
/**
* Send the given packet directly
*/
virtual void send_pkt (const NetworkPacketBuffer &pkt, bool reliable = true) = 0;
public:
/**
* Send a raw packet prepared using NetworkSession::write_packet_header. This does not need to copy the packet data around.
*
* XXX: this interface needs fixing to be less procedural
*
* @param pkt the NetworkPacket prepared using write_packet_header
* @param reliable whether to use TCP or UDP
*
* @see write_packet_header
*/
void send_raw (const NetworkPacketBuffer &pkt, bool reliable = true);
/**
* Send the given packet to this destination.
*
* @param pkt the NetworkChannelPacket to send
* @param reliable Whether to use TCP or UDP
*/
void send (const NetworkChannelPacket &pkt, bool reliable = true);
};
#endif /* NETWORK_TARGET_HH */