OverSim
TransportAddress.h File Reference
#include <oversim_mapset.h>
#include <omnetpp.h>
#include <IPvXAddress.h>

Go to the source code of this file.

Classes

class  TransportAddress
 This class implements a common transport address. More...
class  TransportAddress::hashFcn
 defines a hash function for TransportAddress More...

Typedefs

typedef std::vector
< TransportAddress
TransportAddressVector

Functions

void doPacking (cCommBuffer *buf, TransportAddress &addr)
 netPack for TransportAddress
void doUnpacking (cCommBuffer *buf, TransportAddress &addr)
 netUnpack for TransportAddress

Detailed Description

Author
Markus Mauch
Sebastian Mies
Ingmar Baumgart

Definition in file TransportAddress.h.

Typedef Documentation

Definition at line 35 of file TransportAddress.h.

Function Documentation

void doPacking ( cCommBuffer *  buf,
TransportAddress addr 
)
inline

netPack for TransportAddress

Parameters
bufthe buffer
addrthe TransportAddress to serialise

Definition at line 321 of file TransportAddress.h.

{
doPacking(buf, addr.getIp());
doPacking(buf, addr.getPort());
doPacking(buf, static_cast<uint8_t>(addr.getNatType()));
doPacking(buf, static_cast<uint8_t>(addr.getSourceRouteSize()));
for (size_t i = 0; i < addr.getSourceRouteSize(); i++) {
// TODO: ugly const_cast should be avoided
doPacking(buf, const_cast<TransportAddress&>(addr.getSourceRoute()[i]));
}
}
void doUnpacking ( cCommBuffer *  buf,
TransportAddress addr 
)
inline

netUnpack for TransportAddress

Parameters
bufthe buffer
addrthe TransportAddress to unserialise

Definition at line 339 of file TransportAddress.h.

{
IPvXAddress ip;
int port;
uint8_t natType = 0;
doUnpacking(buf, ip);
doUnpacking(buf, port);
doUnpacking(buf, natType);
addr.setIp(ip, port, static_cast<TransportAddress::NatType>(natType));
uint8_t sourceRouteSize;
TransportAddress sourceRouteEntry;
doUnpacking(buf, sourceRouteSize);
for (size_t i = 0; i < sourceRouteSize; i++) {
doUnpacking(buf, sourceRouteEntry);
addr.appendSourceRoute(sourceRouteEntry);
}
}