MCPcopy Create free account
hub / github.com/EIPStackGroup/OpENer / HandleReceivedListServicesCommand

Function HandleReceivedListServicesCommand

source/src/enet_encap/encap.c:344–378  ·  view source on GitHub ↗

@brief generate reply with "Communications Services" + compatibility Flags. * @param receive_data pointer to structure with received data * @param outgoing_message The outgoing ENIP message */

Source from the content-addressed store, hash-verified

342 * @param outgoing_message The outgoing ENIP message
343 */
344void HandleReceivedListServicesCommand(
345 const EncapsulationData *const receive_data,
346 ENIPMessage *const outgoing_message) {
347
348 /* Create encapsulation header */
349 const size_t kListServicesCommandSpecificDataLength = sizeof(CipUint)
350 + sizeof(
351 g_interface_information);
352 GenerateEncapsulationHeader(receive_data,
353 kListServicesCommandSpecificDataLength,
354 0, /* Session handle will be ignored */
355 kEncapsulationProtocolSuccess, /* Protocol status */
356 outgoing_message);
357
358 /* Command specific data copy Interface data to msg for sending */
359 outgoing_message->used_message_length += AddIntToMessage(1,
360 &outgoing_message->current_message_position); // Item count
361 outgoing_message->used_message_length += AddIntToMessage(
362 g_interface_information.type_code,
363 &outgoing_message->current_message_position);
364 outgoing_message->used_message_length += AddIntToMessage(
365 (EipUint16) (g_interface_information.length - 4),
366 &outgoing_message->current_message_position);
367 outgoing_message->used_message_length += AddIntToMessage(
368 g_interface_information.encapsulation_protocol_version,
369 &outgoing_message->current_message_position);
370 outgoing_message->used_message_length += AddIntToMessage(
371 g_interface_information.capability_flags,
372 &outgoing_message->current_message_position);
373 memcpy(outgoing_message->current_message_position,
374 g_interface_information.name_of_service,
375 sizeof(g_interface_information.name_of_service) );
376 outgoing_message->used_message_length +=
377 sizeof(g_interface_information.name_of_service);
378}
379
380void HandleReceivedListInterfacesCommand(
381 const EncapsulationData *const receive_data,

Callers 3

TESTFunction · 0.85

Calls 2

AddIntToMessageFunction · 0.85

Tested by 1

TESTFunction · 0.68