@brief Initializes session list and interface information. */
| 120 | |
| 121 | /* @brief Initializes session list and interface information. */ |
| 122 | void EncapsulationInit(void) { |
| 123 | |
| 124 | DetermineEndianess(); |
| 125 | |
| 126 | /*initialize random numbers for random delayed response message generation |
| 127 | * we use the ip address as seed as suggested in the spec */ |
| 128 | srand(interface_configuration_.ip_address); |
| 129 | |
| 130 | /* initialize Sessions to invalid == free session */ |
| 131 | for (size_t i = 0; i < OPENER_NUMBER_OF_SUPPORTED_SESSIONS; i++) { |
| 132 | g_registered_sessions[i] = kEipInvalidSocket; |
| 133 | } |
| 134 | |
| 135 | for (size_t i = 0; i < ENCAP_NUMBER_OF_SUPPORTED_DELAYED_ENCAP_MESSAGES; |
| 136 | i++) { |
| 137 | g_delayed_encapsulation_messages[i].socket = kEipInvalidSocket; |
| 138 | } |
| 139 | |
| 140 | /*TODO make the interface information configurable*/ |
| 141 | /* initialize interface information */ |
| 142 | g_interface_information.type_code = kCipItemIdListServiceResponse; |
| 143 | g_interface_information.length = sizeof(g_interface_information); |
| 144 | g_interface_information.encapsulation_protocol_version = 1; |
| 145 | g_interface_information.capability_flags = kCapabilityFlagsCipTcp |
| 146 | | kCapabilityFlagsCipUdpClass0or1; |
| 147 | snprintf( (char *) g_interface_information.name_of_service, |
| 148 | sizeof(g_interface_information.name_of_service), |
| 149 | "Communications" ); |
| 150 | } |
| 151 | |
| 152 | int HandleReceivedExplictTcpData(int socket, |
| 153 | EipUint8 *buffer, |
no test coverage detected