34 #ifndef AVBTS_OSNET_HPP
35 #define AVBTS_OSNET_HPP
45 #define FACTORY_NAME_LENGTH 48
46 #define DEFAULT_TIMEOUT 1
52 class LinkLayerAddress:public InterfaceLabel {
71 address_scalar <<= 16;
73 *ptr = (address_scalar & 0xFF00000000000000ULL) >> 56;
87 ++ptr, ++address_octet_array)
89 *ptr = *address_octet_array;
140 ++ptr, ++address_octet_array)
142 *address_octet_array = *ptr;
167 this->name =
new char[length + 1];
178 return strcmp(name, cmp.name) == 0 ?
true :
false;
188 return strcmp(name, cmp.name) < 0 ?
true :
false;
198 return strcmp(name, cmp.name) < 0 ?
true :
false;
209 if (length >= strlen(name) + 1) {
242 return strcmp(cmp.name, this->name) == 0 ?
true :
false;
252 return strcmp(cmp.name, this->name) < 0 ?
true :
false;
262 return strcmp(cmp.name, this->name) > 0 ?
true :
false;
272 typedef enum { net_trfail, net_fatal, net_succeed }
net_result;
325 typedef std::map < factory_name_t, OSNetworkInterfaceFactory * >
FactoryMap_t;
340 FactoryMap_t::iterator iter = factoryMap.find(
id);
341 if (iter != factoryMap.end())
343 factoryMap[id] = factory;
358 return factoryMap[id]->createInterface
359 (iface, iflabel, timestamper);
363 virtual bool createInterface
369 inline OSNetworkInterfaceFactory::~OSNetworkInterfaceFactory() { }
Definition: avbts_osnet.hpp:330
Definition: ieee1588.hpp:101
Definition: ieee1588.hpp:445
bool operator==(const factory_name_t &cmp)
Operator '==' overloading method Compares cmp to the factory name.
Definition: avbts_osnet.hpp:241
virtual void getLinkLayerAddress(LinkLayerAddress *addr)=0
Get Link Layer address (mac address)
InterfaceName()
Definition: avbts_osnet.hpp:160
bool toString(char *string, size_t length)
Gets interface name from the class' internal variable.
Definition: avbts_osnet.hpp:208
bool operator==(const LinkLayerAddress &cmp) const
Operator '==' overloading method. It provides a comparison between cmp and the class ethernet address...
Definition: avbts_osnet.hpp:100
void toOctetArray(uint8_t *address_octet_array)
Gets first 6 bytes from ethernet address of object LinkLayerAddress.
Definition: avbts_osnet.hpp:137
std::map< factory_name_t, OSNetworkInterfaceFactory * > FactoryMap_t
Definition: avbts_osnet.hpp:320
#define ETHER_ADDR_OCTETS
Definition: ptptypes.hpp:41
LinkLayerAddress()
Definition: avbts_osnet.hpp:60
factory_name_t(const char *name_a)
Definition: avbts_osnet.hpp:231
bool operator<(const InterfaceName &cmp) const
Operator '<' overloading method. Compares cmp to the interface name.
Definition: avbts_osnet.hpp:187
static bool buildInterface(OSNetworkInterface **iface, factory_name_t id, InterfaceLabel *iflabel, HWTimestamper *timestamper)
Builds the network interface.
Definition: avbts_osnet.hpp:356
Definition: avbts_osnet.hpp:52
LinkLayerAddress(uint64_t address_scalar)
Definition: avbts_osnet.hpp:69
bool operator>(const LinkLayerAddress &cmp) const
Operator '>' overloading method. It provides a comparison between cmp and the class ethernet addre...
Definition: avbts_osnet.hpp:124
bool operator<(const factory_name_t &cmp) const
Operator '<' overloading method Compares cmp to the factory name.
Definition: avbts_osnet.hpp:251
#define FACTORY_NAME_LENGTH
Definition: avbts_osnet.hpp:45
Definition: avbts_osnet.hpp:277
virtual net_result nrecv(LinkLayerAddress *addr, uint8_t *payload, size_t &length)=0
Receives data.
static bool registerFactory(factory_name_t id, OSNetworkInterfaceFactory *factory)
Registers network factory.
Definition: avbts_osnet.hpp:339
virtual ~OSNetworkInterface()=0
Definition: avbts_osnet.hpp:318
bool operator>(const InterfaceName &cmp) const
Operator '>' overloading method. Compares cmp to the interface name.
Definition: avbts_osnet.hpp:197
LinkLayerAddress(uint8_t *address_octet_array)
Definition: avbts_osnet.hpp:84
InterfaceName(char *name, int length)
Definition: avbts_osnet.hpp:166
net_result
Definition: avbts_osnet.hpp:272
bool operator==(const InterfaceName &cmp) const
Operator '==' overloading method. Compares parameter cmp to the interface name.
Definition: avbts_osnet.hpp:177
Definition: avbts_osnet.hpp:221
bool operator>(const factory_name_t &cmp) const
Operator '>' overloading method Compares cmp to the factory name.
Definition: avbts_osnet.hpp:261
virtual net_result send(LinkLayerAddress *addr, uint8_t *payload, size_t length, bool timestamp)=0
Sends a packet to a remote address.
Definition: avbts_osnet.hpp:152
virtual unsigned getPayloadOffset()=0
Provides generic method for getting the payload offset.
bool operator<(const LinkLayerAddress &cmp) const
Operator '<' overloading method. It provides a comparison between cmp and the class ethernet addre...
Definition: avbts_osnet.hpp:112