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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
/* -*- C++ -*- */
// $Id$
// ============================================================================
//
// = LIBRARY
// ace
//
// = FILENAME
// CLASSIX_SAP.h
//
// = AUTHOR(S)
// Nokia Telecommunications
//
// ============================================================================
#ifndef ACE_CLASSIX_SAP_H
#include "ace/pre.h"
#define ACE_CLASSIX_SAP_H
/* ------------------------------------------------------------------------- */
#include "ace/CLASSIX/CLASSIX_Port.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
class ACE_CLASSIX_SAP
// = TITLE
// Class implementing the SAP over a Chorus port.
//
// = DESCRIPTION
// A SAP has a port which is referred to as the local port.
// This class provides methods to manipulate this port.
//
// The SAP will always put the port in DISABLED state on exit.
//
// In CLASSIX, a local SAP is always a port, a peer SAP can be
// a port or a group of port. This class is for local SAP and
// <ACE_Peer_SAP> is for peer SAP.
//
// = SEE ALSO
// <ACE_Peer_SAP>
//
{
public:
enum
{
DEFAULT_PRIORITY = 10
};
// = INITIALIZATION
ACE_CLASSIX_SAP(void);
// Creates a SAP, using the address of the actor's default port.
ACE_CLASSIX_SAP(const ACE_Addr&);
// Creates a SAP, using the specified address as the local address.
virtual ~ACE_CLASSIX_SAP(void);
// = ACCESS
void set_addr(const ACE_Addr&);
void set_addr(const ACE_CLASSIX_Port_Core&);
// Sets the <local_addr_> based on the given address information.
// The caller should make sure that the original address can be removed!
int set(const ACE_Addr&);
// Returns 0, if successful; returns -1, otherwise
// same as set_addr(const ACE_Addr&);
int set(const ACE_CLASSIX_Port_Core&);
// Returns 0, if successful; returns -1, otherwise
// same as void set_addr(const ACE_CLASSIX_Port_Core&);
int set (const KnUniqueId&);
// Returns 0, if successful; returns -1, otherwise
void set_handle (ACE_HANDLE /* port_no */);
// Sets the port address according to <port_no>
int get_addr(ACE_Addr& /* return_addr */) const;
// Returns address information to the supplied location.
// if successful, return 0 and the return_addr parameter contains the
// address info.
// Otherwise, return -1
const ACE_CLASSIX_Port& get_addr(void) const;
// Returns a reference to the address information
ACE_HANDLE get_handle(void) const;
// Get handles that the Reactor uses
virtual int is_configured(void) const;
// Returns 1, if address information is proper; Returns 0 otherwise
int is_selectable(void) const;
// Retruns 1, if the local SAP is enabled.
// = CONTROL
int selectable(int = ACE_CLASSIX_SAP::DEFAULT_PRIORITY /* priority */);
// Puts the SAP in the ENABLED state so that data the port associated
// with its local addess can be monitored by the CLASSIX's Reactor.
int unselectable(int = 0 /* not used */);
// Makes the SAP DISABLED and therefore the SAP can not be monitored
// by the CLASSIX's Reactor..
int open(const ACE_Addr&);
int open(const ACE_CLASSIX_Port_Core*);
// Sets the address information according to the supplied port
// Returns 0 on success; returns -1 otherwise
int close(void);
// removes the port information
// Returns 0 on success (always); returns -1 otherwise
void clear(void);
// erase local port info
#if 0
int control(u_int = K_BROADMODE);
int control(u_int, /* mode */ int /* site */ );
// Interface for CLASSIX' send mode
#endif
// = HELPER
void dump(void) const;
// dump the state of an object
ACE_ALLOC_HOOK_DECLARE;
// declare the dynamic allocation hooks
protected:
#if 0
virtual set_mode_(u_int = K_BROADMODE); /* theMode */
// Sets the addressing mode with the current setting of coTarget
virtual set_mode_(u_int, /* mode */ int /* site */);
// Sets the addressing mode as well as the coTarget
#endif
// Disable copy constructor/assignment
ACE_CLASSIX_SAP(ACE_CLASSIX_SAP const&);
ACE_CLASSIX_SAP const& operator=(ACE_CLASSIX_SAP const&);
ACE_CLASSIX_Port local_addr_;
int enabled_; // 1 if enabled, 0 if disabled (Default)
};
/* ------------------------------------------------------------------------- */
#if defined (__ACE_INLINE__)
#include "ace/CLASSIX/CLASSIX_SAP.i"
#endif /* __ACE_INLINE__ */
#include "ace/post.h"
#endif /* ACE_CLASSIX_SAP_H */
|