summaryrefslogtreecommitdiff
path: root/ace/UNIX_Addr.i
blob: 88fcc688cc5d80577f8cefa232c60843868dc878 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* -*- C++ -*- */
// $Id$

// UNIX_Addr.i

#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)

// Return a pointer to the underlying address. 

ACE_INLINE void *
ACE_UNIX_Addr::get_addr (void) const
{
  return (void *) &this->unix_addr_;
}

// Transform the string into the current addressing format.

ACE_INLINE int 
ACE_UNIX_Addr::string_to_addr (const char addr[])
{
  ACE_OS::strncpy (this->unix_addr_.sun_path, addr, 
	     sizeof this->unix_addr_.sun_path);
  return 0;
}

// Transform the current address into string format. 

ACE_INLINE int
ACE_UNIX_Addr::addr_to_string (char s[], size_t len) const
{
  ACE_OS::strncpy (s, this->unix_addr_.sun_path, len);
  return 0;
}

// Compare two addresses for equality.

ACE_INLINE int
ACE_UNIX_Addr::operator == (const ACE_Addr &sap) const
{
  return ACE_OS::strncmp (this->unix_addr_.sun_path, 
		   ((const ACE_UNIX_Addr &) sap).unix_addr_.sun_path,
		   sizeof this->unix_addr_.sun_path) == 0;
}

// Compare two addresses for inequality. 

ACE_INLINE int
ACE_UNIX_Addr::operator != (const ACE_Addr &sap) const
{
  return !((*this) == sap);	// This is lazy, of course... ;-) 
}

// Return the path name used for the rendezvous point. 

ACE_INLINE const char *
ACE_UNIX_Addr::get_path_name (void) const
{
  return this->unix_addr_.sun_path;
}

#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */