OpenDDS  Snapshot(2023/04/07-19:43)
Public Member Functions | Public Attributes | List of all members
OpenDDS::DCPS::NetworkResource Struct Reference

Defines a wrapper around address info which is used for advertise. More...

#include <NetworkResource.h>

Collaboration diagram for OpenDDS::DCPS::NetworkResource:
Collaboration graph
[legend]

Public Member Functions

 NetworkResource ()
 
 NetworkResource (const ACE_INET_Addr &addr)
 
 NetworkResource (const String &addr)
 
 ~NetworkResource ()
 
void dump () const
 
void to_addr (ACE_INET_Addr &addr) const
 

Public Attributes

CORBA::Octet reserved_
 
String addr_
 The address in string format. e.g. ip:port, hostname:port. More...
 

Detailed Description

Defines a wrapper around address info which is used for advertise.

This is used to send/receive an address information through transport.

Definition at line 45 of file NetworkResource.h.

Constructor & Destructor Documentation

◆ NetworkResource() [1/3]

OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE OpenDDS::DCPS::NetworkResource::NetworkResource ( )

Definition at line 16 of file NetworkResource.inl.

References ACE_INLINE, and DBG_ENTRY_LVL.

17  : reserved_(0)
18 {
19  DBG_ENTRY_LVL("NetworkResource","NetworkResource",6);
20 }
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68

◆ NetworkResource() [2/3]

ACE_INLINE OpenDDS::DCPS::NetworkResource::NetworkResource ( const ACE_INET_Addr addr)
explicit

Definition at line 23 of file NetworkResource.inl.

References ACE_INLINE, ACE_TEXT_ALWAYS_CHAR, addr_, ACE_INET_Addr::addr_to_string(), DBG_ENTRY_LVL, and MAXHOSTNAMELEN.

24  : reserved_(0)
25 {
26  DBG_ENTRY_LVL("NetworkResource","NetworkResource",6);
27 
28  ACE_TCHAR addr_s[MAXHOSTNAMELEN + 1];
29  addr.addr_to_string(addr_s, sizeof (addr_s), 1 /* ipaddr_format */);
30 
31  this->addr_ = ACE_TEXT_ALWAYS_CHAR(addr_s);
32 }
#define ACE_TEXT_ALWAYS_CHAR(STRING)
char ACE_TCHAR
#define MAXHOSTNAMELEN
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68
String addr_
The address in string format. e.g. ip:port, hostname:port.
virtual int addr_to_string(ACE_TCHAR buffer[], size_t size, int ipaddr_format=1) const

◆ NetworkResource() [3/3]

ACE_INLINE OpenDDS::DCPS::NetworkResource::NetworkResource ( const String addr)
explicit

Definition at line 35 of file NetworkResource.inl.

References ACE_INLINE, addr_, and DBG_ENTRY_LVL.

36  : reserved_(0)
37 {
38  DBG_ENTRY_LVL("NetworkResource","NetworkResource",6);
39 
40  addr_ = addr;
41 }
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68
String addr_
The address in string format. e.g. ip:port, hostname:port.

◆ ~NetworkResource()

ACE_INLINE OpenDDS::DCPS::NetworkResource::~NetworkResource ( )

Definition at line 44 of file NetworkResource.inl.

References ACE_INLINE.

45 {
46 }

Member Function Documentation

◆ dump()

ACE_INLINE void OpenDDS::DCPS::NetworkResource::dump ( void  ) const

Definition at line 57 of file NetworkResource.inl.

References ACE_DEBUG, addr_, LM_DEBUG, OPENDDS_END_VERSIONED_NAMESPACE_DECL, and reserved_.

58 {
59  ACE_DEBUG((LM_DEBUG, "(%P|%t) NetworkResource addr: %C reserved: %d\n", addr_.c_str(), reserved_));
60 }
#define ACE_DEBUG(X)
String addr_
The address in string format. e.g. ip:port, hostname:port.

◆ to_addr()

ACE_INLINE void OpenDDS::DCPS::NetworkResource::to_addr ( ACE_INET_Addr addr) const

Accessor to populate the provided ACE_INET_Addr object from the address string received through transport.

Definition at line 49 of file NetworkResource.inl.

References ACE_INLINE, addr_, OpenDDS::DCPS::choose_single_coherent_address(), DBG_ENTRY_LVL, ACE_INET_Addr::get_host_addr(), LM_DEBUG, and VDBG_LVL.

Referenced by OpenDDS::DCPS::UdpTransport::blob_to_key(), OpenDDS::DCPS::UdpTransport::get_connection_addr(), and OpenDDS::DCPS::AssociationData::get_remote_address().

50 {
51  DBG_ENTRY_LVL("NetworkResource","to_addr",6);
52  addr = choose_single_coherent_address(addr_.c_str(), true /*prefer_loopback*/);
53  VDBG_LVL((LM_DEBUG, "(%P|%t) NetworkResource::to_addr() - Resolving address for %C to be %C\n", addr_.c_str(), addr.get_host_addr()), 2);
54 }
const char * get_host_addr(char *addr, int addr_size) const
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68
ACE_INET_Addr choose_single_coherent_address(const ACE_INET_Addr &address, bool prefer_loopback)
#define VDBG_LVL(DBG_ARGS, LEVEL)
String addr_
The address in string format. e.g. ip:port, hostname:port.

Member Data Documentation

◆ addr_

String OpenDDS::DCPS::NetworkResource::addr_

The address in string format. e.g. ip:port, hostname:port.

Definition at line 63 of file NetworkResource.h.

Referenced by dump(), NetworkResource(), operator<<(), operator>>(), and to_addr().

◆ reserved_

CORBA::Octet OpenDDS::DCPS::NetworkResource::reserved_

Reserve byte for some feature supports in the future. e.g. version support.

Definition at line 60 of file NetworkResource.h.

Referenced by dump(), operator<<(), and operator>>().


The documentation for this struct was generated from the following files: