MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / Get_Connection_Parameters

Function Get_Connection_Parameters

dds/FACE/FaceTSS.cpp:175–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175void Get_Connection_Parameters(CONNECTION_NAME_TYPE& connection_name,
176 CONNECTION_ID_TYPE& connection_id /* 0 if an out param */,
177 TRANSPORT_CONNECTION_STATUS_TYPE& status,
178 RETURN_CODE_TYPE& return_code)
179{
180 try {
181 // connection_name is optional, if absent populate from connection_id lookup
182 // connection_id is also optional, if absent populate from connection_name lookup
183 // if both provided, validate
184 // if neither present, return error
185 Entities& entities = *Entities::instance();
186
187 if (connection_id != 0 && entities.connections_.count(connection_id)) {
188 // connection_id was provided
189 // if validated or populated, set return_code so status will be populated
190 if (connection_name[0]) {
191 // Validate provided connection_name
192 OPENDDS_STRING conn_name = entities.connections_[connection_id].connection_name;
193 if (std::strcmp(connection_name, conn_name.c_str()) == 0) {
194 return_code = RC_NO_ERROR;
195 } else {
196 return_code = INVALID_PARAM;
197 }
198 } else {
199 // connection_name not provided
200 // so populate from connection_id lookup
201 // and set return code so status will be populated
202 entities.connections_[connection_id].connection_name.copy(connection_name,
203 sizeof(CONNECTION_NAME_TYPE));
204 connection_name[sizeof(CONNECTION_NAME_TYPE) - 1] = 0;
205 return_code = RC_NO_ERROR;
206 }
207
208 } else if (connection_name[0] && connection_id == 0) {
209 // connection_id was not specified, but name was provided.
210 // lookup connection_id and if found set return code to populate status
211 ConnectionSettings settings;
212 if (0 == parser.find_connection(connection_name, settings)) {
213 connection_id = settings.connection_id_;
214 return_code = RC_NO_ERROR;
215 } else {
216 // could not find connection for connection_name
217 return_code = INVALID_PARAM;
218 }
219 } else {
220 //Neither connection_id or connection_name provided
221 // a valid connection
222 return_code = INVALID_PARAM;
223 }
224 if (return_code == RC_NO_ERROR) {
225 TRANSPORT_CONNECTION_STATUS_TYPE& cur_status = entities.connections_[connection_id].connection_status;
226 if (cur_status.CONNECTION_DIRECTION == FACE::DESTINATION) {
227 Entities::FaceReceiver& receiver = *entities.receivers_[connection_id];
228 if (receiver.status_valid != FACE::VALID) {
229 if (OpenDDS::DCPS::DCPS_debug_level > 3) {
230 ACE_DEBUG((LM_DEBUG, "Get_Connection_Parameters: returning NOT_AVAILABLE due to receiver's status not valid\n"));
231 }
232 return_code = NOT_AVAILABLE;

Callers 6

ACE_TMAINFunction · 0.85
ACE_TMAINFunction · 0.85
ACE_TMAINFunction · 0.85
ACE_TMAINFunction · 0.85
ACE_TMAINFunction · 0.85
ACE_TMAINFunction · 0.85

Calls 5

instanceFunction · 0.85
find_connectionMethod · 0.80
countMethod · 0.45
copyMethod · 0.45
messages_waitingMethod · 0.45

Tested by

no test coverage detected