summaryrefslogtreecommitdiff
path: root/ace/Addr.h
blob: 0d96f65cd3d093266d90d145fbbf26f715e2bf8c (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
/* -*- C++ -*- */
// $Id$

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

#if !defined (ACE_ADDR_H)
#define ACE_ADDR_H

#include "ace/ACE.h"

class ACE_Export ACE_Addr 
{
  //  = TITLE
  //     Defines the base class for the "address family independent"
  //     address format.
public:
  // = Initialization method.

  ACE_Addr (int type = -1,
            int size = -1);
  // Initializes instance variables. 

  // = Get/set the size of the address. 

  int get_size (void) const;
  // Return the size of the address.

  void set_size (int size);
  // Sets the size of the address. 

  // = Get/set the type of the address. 

  int get_type (void) const;
  // Get the type of the address. 

  void set_type (int type);
  // Set the type of the address. 

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

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

  // = Equality/inequality tests
  int operator == (const ACE_Addr &sap) const;
  // Check for address equality.

  int operator != (const ACE_Addr &sap) const;
  // Check for address inequality.

  void base_set (int type,
                 int size);
  // Initializes instance variables.

#if defined (ACE_HAS_BROKEN_SAP_ANY)
  static const ACE_Addr &sap_any (void);
  // Wild-card address.

  // This #define works around broken C++ compilers...
#define sap_any sap_any()
#else
  static const ACE_Addr sap_any;
  // Wild-card address.
#endif /* ACE_HAS_BROKEN_SAP_ANY */

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

  ACE_ALLOC_HOOK_DECLARE;
  // Declare the dynamic allocation hooks.

protected:
  int addr_type_; 
  // e.g., AF_UNIX, AF_INET, AF_SPIPE, etc.

  int addr_size_; 
  // Number of bytes in the address.
};

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

#endif /* ACE_ADDR_H */