37 #ifndef RTPBYTEADDRESS_H 39 #define RTPBYTEADDRESS_H 41 #include "rtpconfig.h" 46 #define RTPBYTEADDRESS_MAXLENGTH 128 51 class RTPMemoryManager;
61 RTPByteAddress(
const uint8_t hostaddress[RTPBYTEADDRESS_MAXLENGTH],
size_t addrlen, uint16_t port = 0) :
RTPAddress(ByteAddress) {
if (addrlen > RTPBYTEADDRESS_MAXLENGTH) addrlen = RTPBYTEADDRESS_MAXLENGTH; memcpy(RTPByteAddress::hostaddress, hostaddress, addrlen); RTPByteAddress::addresslength = addrlen; RTPByteAddress::port = port; }
64 void SetHostAddress(
const uint8_t hostaddress[RTPBYTEADDRESS_MAXLENGTH],
size_t addrlen) {
if (addrlen > RTPBYTEADDRESS_MAXLENGTH) addrlen = RTPBYTEADDRESS_MAXLENGTH; memcpy(RTPByteAddress::hostaddress, hostaddress, addrlen); RTPByteAddress::addresslength = addrlen; }
67 void SetPort(uint16_t port) { RTPByteAddress::port = port; }
79 bool IsSameAddress(
const RTPAddress *addr)
const;
80 bool IsFromSameHost(
const RTPAddress *addr)
const;
82 std::string GetAddressString()
const;
85 uint8_t hostaddress[RTPBYTEADDRESS_MAXLENGTH];
92 #endif // RTPBYTEADDRESS_H uint16_t GetPort() const
Returns the port number stored in this instance.
Definition: rtpbyteaddress.h:76
void SetHostAddress(const uint8_t hostaddress[RTPBYTEADDRESS_MAXLENGTH], size_t addrlen)
Sets the host address to the first addrlen bytes of hostaddress.
Definition: rtpbyteaddress.h:64
This class is an abstract class which is used to specify destinations, multicast groups etc...
Definition: rtpaddress.h:50
RTPByteAddress(const uint8_t hostaddress[RTPBYTEADDRESS_MAXLENGTH], size_t addrlen, uint16_t port=0)
Creates an instance of the class using addrlen bytes of hostaddress as host identification, and using port as the port number.
Definition: rtpbyteaddress.h:61
Definition: rtpfaketransmitter.h:64
A memory manager.
Definition: rtpmemorymanager.h:150
void SetPort(uint16_t port)
Sets the port number to port.
Definition: rtpbyteaddress.h:67
const uint8_t * GetHostAddress() const
Returns a pointer to the stored host address.
Definition: rtpbyteaddress.h:70
size_t GetHostAddressLength() const
Returns the length in bytes of the stored host address.
Definition: rtpbyteaddress.h:73
A very general kind of address consisting of a port number and a number of bytes describing the host ...
Definition: rtpbyteaddress.h:56