blob: d876498ffb711cb0b56d233a04b5f92726eb3482 (
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
/* -*- C++ -*- */
// $Id$
// ============================================================================
//
// = LIBRARY
// ACE
//
// = FILENAME
// CLASSIX_SAP.cpp
//
// = AUTHOR(S)
// Wei Chiang
//
// = COPYRIGHT
// Copyright 1998 ???
//
// ============================================================================
#include "CLASSIX/SAP.h"
#if !defined (__ACE_INLINE__)
#include "CLASSIX/SAP.i"
#endif /* __ACE_INLINE__ */
ACE_ALLOC_HOOK_DEFINE(ACE_CLASSIX_SAP)
/* ------------------------------------------------------------------------- */
int
ACE_CLASSIX_SAP::get_addr(ACE_Addr& theAddr) const
{
if (theAddr.get_size() < this->local_addr_.get_size() ||
theAddr.get_type() != this->local_addr_.get_type())
{
return -1;
}
else
{
theAddr.set_addr(this->local_addr_.get_addr(),
this->local_addr_.get_size());
return 0;
}
}
void
ACE_CLASSIX_SAP::set_addr(const ACE_Addr& theAddr)
{
this->local_addr_.set_addr(theAddr.get_addr(), theAddr.get_size());
}
void
ACE_CLASSIX_SAP::set_addr(const ACE_CLASSIX_Port_Core& thePort)
{
this->local_addr_.set_addr(thePort.get_addr(),
sizeof (ACE_CLASSIX_Port_Core::Addr));
}
int
ACE_CLASSIX_SAP::set(const KnUniqueId& theId)
{
return this->local_addr_.set(theId);
}
void
ACE_CLASSIX_SAP::set_handle(ACE_HANDLE theHandle)
{
if (this->local_addr_.set_handle(theHandle) == -1)
ACE_DEBUG((LM_DEBUG, "ACE_CLASSIX_SAP::set_handle()::"
"Handle invalid\n"));
}
int
ACE_CLASSIX_SAP::set(const ACE_Addr& theAddr)
{
this->set_addr(theAddr);
return 0;
}
int
ACE_CLASSIX_SAP::open(const ACE_Addr& theAddr)
{
this->set_addr(theAddr);
return 0;
}
int
ACE_CLASSIX_SAP::set(const ACE_CLASSIX_Port_Core& thePort)
{
this->set_addr(thePort);
return 0;
}
int
ACE_CLASSIX_SAP::open(const ACE_CLASSIX_Port_Core* thePort)
{
if (thePort)
{
this->set_addr(ACE_CLASSIX_Port(*thePort));
return 0;
}
else
return -1;
}
int
ACE_CLASSIX_SAP::close(void)
{
// Disable receiving
this->unselectable();
//*** Do something to flush out potential messages on the local port
// e.g. have a separte thread call ipcReceive on each disabled SAP.
this->local_addr_.clear();
return 0;
}
int
ACE_CLASSIX_SAP::selectable(int thePriority)
{
if (!this->enabled_)
{
int result = this->local_addr_.enable(thePriority);
if (result == 0)
this->enabled_ = 1;
return result;
}
else
return 0;
}
int
ACE_CLASSIX_SAP::unselectable(int)
{
if (this->enabled_)
{
int result = this->local_addr_.disable();
if (result == 0)
this->enabled_ = 0;
return result;
}
else
return 0;
}
void
ACE_CLASSIX_SAP::dump(void) const
{
ACE_DEBUG ((LM_INFO, "ACE_CLASSIX_SAP...\n"));
this->local_addr_.dump();
ACE_DEBUG ((LM_INFO, ACE_END_DUMP));
}
|