summaryrefslogtreecommitdiff
path: root/ace/SPIPE_Addr.h
blob: f6a1f14c7a4b51d645c8ff15fb21a02dfefa87d6 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    ace
//
// = FILENAME
//    SPIPE_Addr.h
//
// = AUTHOR
//    Doug Schmidt
//
// ============================================================================

#ifndef ACE_SPIPE_ADDR_H
#define ACE_SPIPE_ADDR_H

#include "ace/Addr.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/ACE.h"

class ACE_Export ACE_SPIPE_Addr : public ACE_Addr
{
  // = TITLE
  //    Defines the SVR4 STREAM pipe address family address format.
public:
  // = Initialization methods.
  ACE_SPIPE_Addr (void);
  // Default constructor.

  ACE_SPIPE_Addr (const ACE_SPIPE_Addr &sa);
  // Copy constructor.

  ACE_SPIPE_Addr (LPCTSTR rendezvous_point, gid_t = 0, uid_t = 0);
  // Create a ACE_SPIPE_Addr from a rendezvous point in the file
  // system.

  int set (const ACE_SPIPE_Addr &sa);
  // Acts like a copy constructor...

  int set (LPCTSTR rendezvous_point, gid_t = 0, uid_t = 0);
  // Create a ACE_SPIPE_Addr from a rendezvous point in the file
  // system.

  virtual void *get_addr (void) const;
  // Return a pointer to the address.

  virtual void set_addr (void *addr, int len);
  // Set a pointer to the underlying network address.

#if defined (UNICODE)
  virtual int addr_to_string (wchar_t *addr, size_t) const;
  // Transform the current address into string format.

  virtual int string_to_addr (const wchar_t *addr);
  // Transform the string into the current addressing format.
#endif /* UNICODE */

  virtual int addr_to_string (char *addr, size_t) const;
  // Transform the current address into string format.

  virtual int string_to_addr (const char *addr);
  // Transform the string into the current addressing format.

  // = Equality/inequality tests
  int operator == (const ACE_SPIPE_Addr &SAP) const;
  // Check for equality.

  int operator != (const ACE_SPIPE_Addr &SAP) const;
  // Check for inequality

  // = SPIPE-specific address operations
  LPCTSTR get_path_name (void) const;
  // Pathname of rendezvous point in file system.

  uid_t user_id (void) const;
  // Get user id.
  void user_id (uid_t uid);
  // Set user id.

  void group_id (gid_t gid);
  // Set group ids.
  gid_t group_id (void) const;
  // Get group ids.

  void dump (void) const;
  // Dump the state of an object.

  ACE_ALLOC_HOOK_DECLARE;
  // Declare the dynamic allocation hooks.

private:
  struct SPIPE_Addr
  {
    // = TITLE
    //     Contains security attributes.

    gid_t gid_;
    // Group id.

    uid_t uid_;
    // User id.

    TCHAR rendezvous_[MAXNAMLEN + 1];
    // Pathname in the file system.

  } SPIPE_addr_;
  // Contents of an SPIPE address.
};

#if defined (__ACE_INLINE__)
#include "ace/SPIPE_Addr.i"
#endif /* __ACE_INLINE__ */

#endif /* ACE_SPIPE_ADDR_H */