| 38 | } |
| 39 | |
| 40 | int ACE_TMAIN(int, ACE_TCHAR*[]) |
| 41 | { |
| 42 | FACE::RETURN_CODE_TYPE status = FACE::RC_NO_ERROR; |
| 43 | FACE::TS::Initialize("face_config.ini", status); |
| 44 | FACE::MESSAGE_SIZE_TYPE max_msg_size = 0; |
| 45 | |
| 46 | if (!status) { |
| 47 | FACE::CONNECTION_DIRECTION_TYPE dir; |
| 48 | FACE::TS::Create_Connection("sub", FACE::PUB_SUB, connId, dir, max_msg_size, FACE::INF_TIME_VALUE, status); |
| 49 | } |
| 50 | |
| 51 | if (!status) { |
| 52 | FACE::CONNECTION_NAME_TYPE name = {}; |
| 53 | FACE::TRANSPORT_CONNECTION_STATUS_TYPE connectionStatus; |
| 54 | FACE::TS::Get_Connection_Parameters(name, connId, connectionStatus, status); |
| 55 | if (status != FACE::NOT_AVAILABLE) { |
| 56 | std::cout << "ERROR: Get_Connection_Parameters after creating connection returned " << status |
| 57 | << " not FACE::NOT_AVAILABLE (" << FACE::NOT_AVAILABLE << ")" << std::endl; |
| 58 | return EXIT_FAILURE; |
| 59 | } |
| 60 | status = FACE::RC_NO_ERROR; |
| 61 | } |
| 62 | |
| 63 | ACE_DEBUG((LM_INFO, "Subscriber: about to Register_Callback()\n")); |
| 64 | FACE::TS::Register_Callback(connId, 0, callback, max_msg_size, status); |
| 65 | if (status != FACE::RC_NO_ERROR) return static_cast<int>(status); |
| 66 | |
| 67 | bool post_reg_callback_check_ok = true; |
| 68 | if (!status) { |
| 69 | FACE::CONNECTION_NAME_TYPE name = {}; |
| 70 | FACE::TRANSPORT_CONNECTION_STATUS_TYPE connectionStatus; |
| 71 | FACE::TS::Get_Connection_Parameters(name, connId, connectionStatus, status); |
| 72 | if (status != FACE::RC_NO_ERROR) { |
| 73 | std::cout << "ERROR: Get_Connection_Parameters after registering callback returned " << status << std::endl; |
| 74 | return static_cast<int>(status); |
| 75 | } |
| 76 | if (connectionStatus.CONNECTION_DIRECTION != FACE::DESTINATION || |
| 77 | connectionStatus.LAST_MSG_VALIDITY != FACE::INVALID || |
| 78 | connectionStatus.MESSAGE != 0 || |
| 79 | connectionStatus.MAX_MESSAGE != 300 || |
| 80 | connectionStatus.MAX_MESSAGE_SIZE != 300 || |
| 81 | connectionStatus.WAITING_PROCESSES_OR_MESSAGES != 0 || |
| 82 | connectionStatus.REFRESH_PERIOD != 0) { |
| 83 | std::cout << "ERROR: Get_Connection_Parameters after registering callback Connection Status values were not as expected" << std::endl; |
| 84 | post_reg_callback_check_ok = false; |
| 85 | } else { |
| 86 | std::cout << "Get_Connection_Parameters after registering callback Connection Status values were as expected" << std::endl; |
| 87 | } |
| 88 | std::cout << "\tMESSAGE: " << connectionStatus.MESSAGE << " should be 0\n" |
| 89 | << "\tMAX_MESSAGE: " << connectionStatus.MAX_MESSAGE << " should be " << 300 << "\n" |
| 90 | << "\tMAX_MESSAGE_SIZE: " << connectionStatus.MAX_MESSAGE_SIZE << " should be 300\n" |
| 91 | << "\tCONNECTION_DIRECTION: " << connectionStatus.CONNECTION_DIRECTION << " should be " << FACE::DESTINATION << "\n" |
| 92 | << "\tWAITING_PROCESSES_OR_MESSAGES: " << connectionStatus.WAITING_PROCESSES_OR_MESSAGES << " should be 0\n" |
| 93 | << "\tREFRESH_PERIOD: " << connectionStatus.REFRESH_PERIOD << " should be 0\n" |
| 94 | << "\tLAST_MSG_VALIDITY: " << connectionStatus.LAST_MSG_VALIDITY << " should be " << FACE::INVALID << std::endl; |
| 95 | } |
| 96 | if (!post_reg_callback_check_ok ) { |
| 97 | return EXIT_FAILURE; |
nothing calls this directly
no test coverage detected