OpenDDS
Snapshot(2023/04/28-20:55)
|
#include <GuidGenerator.h>
Public Member Functions | |
GuidGenerator () | |
int | interfaceName (const char *nic) |
void | populate (DCPS::GUID_t &container) |
ACE_UINT16 | getCount (bool doIncrement=true) |
Private Types | |
enum | { NODE_ID_SIZE = 6 } |
typedef unsigned char | Node_ID[NODE_ID_SIZE] |
Private Attributes | |
Node_ID | node_id_ |
pid_t | pid_ |
ACE_Thread_Mutex | counter_lock_ |
ACE_UINT16 | counter_ |
OPENDDS_STRING | interface_name_ |
Generate GuidPrefix_t values for use with RTPS Also see GuidConverter.h in dds/DCPS 0 GUID_t.guidPrefix[ 0] == VendorId_t == 0x01 for OCI (used for OpenDDS) 1 GUID_t.guidPrefix[ 1] == VendorId_t == 0x03 for OCI (used for OpenDDS) 2 GUID_t.guidPrefix[ 2] == MAC Address 3 GUID_t.guidPrefix[ 3] == MAC Address 4 GUID_t.guidPrefix[ 4] == MAC Address 5 GUID_t.guidPrefix[ 5] == MAC Address 6 GUID_t.guidPrefix[ 6] == MAC Address 7 GUID_t.guidPrefix[ 7] == MAC Address 8 GUID_t.guidPrefix[ 8] == Process ID (MS byte) 9 GUID_t.guidPrefix[ 9] == Process ID (LS byte) 10 GUID_t.guidPrefix[10] == Counter (MS byte) 11 GUID_t.guidPrefix[11] == Counter (LS byte)
Definition at line 43 of file GuidGenerator.h.
|
private |
Borrowed from ACE::UUID_Node, definition of the MAC address holder type
Definition at line 64 of file GuidGenerator.h.
|
private |
OpenDDS::RTPS::GuidGenerator::GuidGenerator | ( | ) |
Definition at line 51 of file GuidGenerator.cpp.
References ACE_UINT16_MAX, counter_, ACE_OS::getmacaddress(), getpid(), ACE_OS::memcpy(), ACE_OS::macaddr_node_t::node, node_id_, NODE_ID_SIZE, pid_, and ACE_OS::rand_r().
ACE_UINT16 OpenDDS::RTPS::GuidGenerator::getCount | ( | bool | doIncrement = true | ) |
Definition at line 90 of file GuidGenerator.cpp.
References counter_, and counter_lock_.
Referenced by populate().
int OpenDDS::RTPS::GuidGenerator::interfaceName | ( | const char * | nic | ) |
override the MAC address to use a specific network interface instead of just the first (non-loopback) interface
Definition at line 100 of file GuidGenerator.cpp.
References ACE_ERROR, AF_INET, AF_UNSPEC, ACE_Wide_To_Ascii::char_rep(), ACE_OS::close(), OpenDDS::DCPS::LogLevel::Error, ACE_Allocator::free(), ACE_Allocator::instance(), interface_name_, ACE_OS::ioctl(), LM_ERROR, OpenDDS::DCPS::log_level, ACE_Allocator::malloc(), name, node_id_, PF_INET, SIOCGIFCONF, SIOCGIFHWADDR, SOCK_DGRAM, and ACE_OS::socket().
Referenced by OpenDDS::RTPS::RtpsDiscovery::add_domain_participant(), and OpenDDS::RTPS::RtpsDiscovery::generate_participant_guid().
void OpenDDS::RTPS::GuidGenerator::populate | ( | DCPS::GUID_t & | container | ) |
populate a GUID container with a unique ID. This will increment the counter, and use a lock (if compiled with MT ACE) while doing so.
Definition at line 259 of file GuidGenerator.cpp.
References getCount(), OpenDDS::DCPS::GUID_t::guidPrefix, ACE_OS::memcpy(), node_id_, NODE_ID_SIZE, OPENDDS_END_VERSIONED_NAMESPACE_DECL, pid_, and OpenDDS::DCPS::VENDORID_OCI.
Referenced by OpenDDS::RTPS::RtpsDiscovery::add_domain_participant(), and OpenDDS::RTPS::RtpsDiscovery::generate_participant_guid().
|
private |
Definition at line 69 of file GuidGenerator.h.
Referenced by getCount(), and GuidGenerator().
|
private |
Definition at line 68 of file GuidGenerator.h.
Referenced by getCount().
|
private |
Definition at line 70 of file GuidGenerator.h.
Referenced by interfaceName().
|
private |
Definition at line 66 of file GuidGenerator.h.
Referenced by GuidGenerator(), interfaceName(), and populate().
|
private |
Definition at line 67 of file GuidGenerator.h.
Referenced by GuidGenerator(), and populate().