diff --git a/app/src/incphub/include/incphub/incphub_client.h b/app/src/incphub/include/incphub/incphub_client.h index 5d6dc9b..75b682b 100644 --- a/app/src/incphub/include/incphub/incphub_client.h +++ b/app/src/incphub/include/incphub/incphub_client.h @@ -36,14 +36,14 @@ int incphub_get_msg_buffer(incphub_cli_t *cli, uint8_t **buffer_ptr, size_t leng /// @return INCPHUB_OK on success, an error otherwise int incphub_release_msg_buffer(incphub_cli_t *cli, uint8_t *buffer); -/// @brief Attempts to send a message to the local interface +/// @brief Attempts to send a message /// @param cli Current client handle /// @param buffer The message buffer (gets consumed) /// @param length The message length -/// @param dst_port The destination NTL port +/// @param dst_addr The destination address /// @param max_delay The maximum time to wait for a resources, in ticks /// @return INCPHUB_OK on success, an error otherwise -int incphub_send_local(incphub_cli_t *cli, uint8_t *buffer, size_t length, ntl_port_t dst_port, TickType_t max_delay); +int incphub_send_msg(incphub_cli_t *cli, uint8_t *buffer, size_t length, incphub_addr_t dst, TickType_t max_delay); /// @brief Awaits the receival of a message /// @param cli Current client handle diff --git a/app/src/incphub/src/incphub_client.c b/app/src/incphub/src/incphub_client.c index 1af0b3c..bb57eca 100644 --- a/app/src/incphub/src/incphub_client.c +++ b/app/src/incphub/src/incphub_client.c @@ -59,13 +59,13 @@ int incphub_release_msg_buffer(incphub_cli_t *cli, uint8_t *buffer) return release_msg_buffer(unwound); } -int incphub_send_local(incphub_cli_t *cli, uint8_t *buffer, size_t length, ntl_port_t dst_port, TickType_t max_delay) +int incphub_send_msg(incphub_cli_t *cli, uint8_t *buffer, size_t length, incphub_addr_t dst, TickType_t max_delay) { if (cli == NULL) return INCPHUB_EINVAL; if (buffer == NULL) return INCPHUB_EINVAL; - if (dst_port == NTL_PORT_EMPTY) + if (dst.port == NTL_PORT_EMPTY) return INCPHUB_EINVAL; // Unwind buffer pointer @@ -73,10 +73,10 @@ int incphub_send_local(incphub_cli_t *cli, uint8_t *buffer, size_t length, ntl_p nil_packet_t *nil_packet = (nil_packet_t*)(ntl_packet - sizeof(ntl_header_t)); // Populate NTL header - ntl_build_header(&ntl_packet->header, dst_port, cli->port, length); + ntl_build_header(&ntl_packet->header, dst.port, cli->port, length); // Populate NIL header - nil_build_header(&nil_packet->header, NIL_ADDR_LOCALHOST, INCPHUB_LOCAL_NIL_ADDR, length + sizeof(ntl_header_t)); + nil_build_header(&nil_packet->header, dst.addr, INCPHUB_LOCAL_NIL_ADDR, length + sizeof(ntl_header_t)); // Pass to ingest return enqueue_message_ingest((uint8_t *)nil_packet, max_delay);