Macros | |
#define | htonl(x) lwip_htonl(x) |
#define | htons(x) lwip_htons(x) |
#define | LWIP_MAKE_U16(a, b) ((a << 8) | b) |
#define | LWIP_MAX(x, y) (((x) > (y)) ? (x) : (y)) |
#define | LWIP_MIN(x, y) (((x) < (y)) ? (x) : (y)) |
#define | LWIP_PLATFORM_BYTESWAP 0 |
#define | LWIP_U32_DIFF(a, b) (((a) >= (b)) ? ((a) - (b)) : (((a) + ((b) ^ 0xFFFFFFFF) + 1))) |
Get the absolute difference between 2 u32_t values (correcting overflows) 'a' is expected to be 'higher' (without overflow) than 'b'. More... | |
#define | ntohl(x) lwip_ntohl(x) |
#define | ntohs(x) lwip_ntohs(x) |
#define | NULL ((void *)0) |
#define | PP_HTONL(x) |
#define | PP_HTONS(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8)) |
#define | PP_NTOHL(x) PP_HTONL(x) |
#define | PP_NTOHS(x) PP_HTONS(x) |
Functions | |
u32_t | lwip_htonl (u32_t x) |
Convert an u32_t from host- to network byte order. More... | |
u16_t | lwip_htons (u16_t x) |
These are reference implementations of the byte swapping functions. More... | |
u32_t | lwip_ntohl (u32_t x) |
Convert an u32_t from network- to host byte order. More... | |
u16_t | lwip_ntohs (u16_t x) |
Convert an u16_t from network- to host byte order. More... | |
#define htonl | ( | x | ) | lwip_htonl(x) |
#define htons | ( | x | ) | lwip_htons(x) |
Referenced by etharp_arp_input(), etharp_raw(), ethernet_input(), inet_chksum_pseudo(), inet_chksum_pseudo_partial(), ip_frag(), ip_reass(), lwip_accept(), lwip_getaddrname(), lwip_recvfrom(), portTASK_FUNCTION(), tcp_create_segment(), tcp_output_alloc_header(), tcp_output_segment(), tcp_rst(), tftpd_read_file(), tftpd_send_error(), and tftpd_write_file().
#define LWIP_MAKE_U16 | ( | a, | |
b | |||
) | ((a << 8) | b) |
#define LWIP_MAX | ( | x, | |
y | |||
) | (((x) > (y)) ? (x) : (y)) |
Referenced by lwip_listen().
#define LWIP_MIN | ( | x, | |
y | |||
) | (((x) < (y)) ? (x) : (y)) |
Referenced by dhcp_parse_reply(), lwip_listen(), pbuf_alloc(), tcp_eff_send_mss(), tcp_output(), tcp_pbuf_prealloc(), tcp_slowtmr(), and tcp_update_rcv_ann_wnd().
#define LWIP_PLATFORM_BYTESWAP 0 |
#define LWIP_U32_DIFF | ( | a, | |
b | |||
) | (((a) >= (b)) ? ((a) - (b)) : (((a) + ((b) ^ 0xFFFFFFFF) + 1))) |
Get the absolute difference between 2 u32_t values (correcting overflows) 'a' is expected to be 'higher' (without overflow) than 'b'.
#define ntohl | ( | x | ) | lwip_ntohl(x) |
Referenced by dhcp_decline(), dhcp_parse_reply(), dhcp_rebind(), dhcp_reboot(), dhcp_recv(), dhcp_renew(), dhcp_select(), tcp_debug_print(), tcp_enqueue_flags(), tcp_input(), tcp_output(), tcp_output_segment(), tcp_parseopt(), tcp_process(), tcp_receive(), tcp_rexmit(), tcp_rexmit_fast(), and tcp_write().
#define ntohs | ( | x | ) | lwip_ntohs(x) |
#define NULL ((void *)0) |
Referenced by accept_function(), alloc_socket(), arp_timer(), configure_console(), dhcp_arp_reply(), dhcp_bind(), dhcp_check(), dhcp_cleanup(), dhcp_coarse_tmr(), dhcp_create_msg(), dhcp_delete_msg(), dhcp_fine_tmr(), dhcp_inform(), dhcp_option_trailer(), dhcp_parse_reply(), dhcp_rebind(), dhcp_recv(), dhcp_renew(), dhcp_select(), dhcp_set_struct(), dhcp_start(), dhcp_stop(), dhcp_timer_coarse(), dhcp_timer_fine(), do_bind(), do_close(), do_close_internal(), do_connect(), do_connected(), do_delconn(), do_getaddr(), do_listen(), do_newconn(), do_recv(), do_send(), do_write(), do_writemore(), emac_dev_read(), emac_dev_set_rx_callback(), emac_dev_set_tx_wakeup_callback(), emac_init_mem(), err_tcp(), eTaskGetState(), etharp_arp_input(), etharp_find_addr(), etharp_output(), etharp_query(), etharp_raw(), ethernet_configure_interface(), ethernetif_init(), ethernetif_input(), event_callback(), find_entry(), free_entry(), free_socket(), get_socket(), icmp_input(), icmp_send_response(), if(), inet_chksum_pbuf(), inet_chksum_pseudo(), inet_chksum_pseudo_partial(), ip_frag(), ip_frag_free_pbuf_custom_ref(), ip_input(), ip_output(), ip_output_if(), ip_reass(), ip_reass_chain_frag_into_datagram_and_validate(), ip_reass_dequeue_datagram(), ip_reass_enqueue_new_datagram(), ip_reass_free_complete_datagram(), ip_reass_remove_oldest_datagram(), ip_reass_timer(), ip_reass_tmr(), ip_route(), ipaddr_ntoa_r(), ipfrag_free_pbuf_custom(), low_level_init(), low_level_input(), low_level_output(), lwip_accept(), lwip_close(), lwip_getsockopt(), lwip_getsockopt_internal(), lwip_read(), lwip_recv(), lwip_recvfrom(), lwip_select(), lwip_selscan(), lwip_send(), lwip_sendto(), lwip_setsockopt(), lwip_setsockopt_internal(), lwip_shutdown(), lwip_socket(), main(), mem_free(), mem_malloc(), mem_trim(), memp_free(), memp_init(), netbuf_alloc(), netbuf_chain(), netbuf_data(), netbuf_delete(), netbuf_first(), netbuf_free(), netbuf_new(), netbuf_next(), netbuf_ref(), netconn_accept(), netconn_alloc(), netconn_bind(), netconn_close_shutdown(), netconn_connect(), netconn_delete(), netconn_disconnect(), netconn_drain(), netconn_free(), netconn_getaddr(), netconn_listen_with_backlog(), netconn_new_with_proto_and_callback(), netconn_recv(), netconn_recv_data(), netconn_recv_tcp_pbuf(), netconn_recved(), netconn_send(), netconn_sendto(), netconn_write(), netif_add(), netif_find(), netif_init(), netif_remove(), netif_set_default(), netif_set_ipaddr(), pbuf_alloc(), pbuf_alloced_custom(), pbuf_cat(), pbuf_clen(), pbuf_coalesce(), pbuf_copy(), pbuf_copy_partial(), pbuf_dechain(), pbuf_free(), pbuf_free_ooseq(), pbuf_get_at(), pbuf_header(), pbuf_memcmp(), pbuf_pool_is_empty(), pbuf_realloc(), pbuf_ref(), pbuf_strstr(), pbuf_take(), pcb_new(), poll_tcp(), portTASK_FUNCTION(), prvAddNewTaskToReadyList(), prvCopyDataToQueue(), prvInitialiseNewQueue(), prvInitialiseNewTask(), prvTaskIsTaskSuspended(), prvUnlockQueue(), prvweb_ParseHTMLRequest(), pvPortMalloc(), raw_input(), raw_new(), raw_remove(), raw_sendto(), recv_raw(), recv_tcp(), recv_udp(), sent_tcp(), stdio_serial_init(), sys_arch_mbox_fetch(), sys_arch_mbox_tryfetch(), sys_arch_sem_wait(), sys_mbox_free(), sys_mbox_new(), sys_mbox_post(), sys_mbox_set_invalid(), sys_mbox_trypost(), sys_sem_free(), sys_sem_new(), sys_sem_set_invalid(), sys_sem_signal(), sys_thread_new(), sys_timeouts_init(), tcp_abandon(), tcp_alloc(), tcp_bind(), tcp_close_shutdown(), tcp_connect(), tcp_create_segment(), tcp_debug_print_pcbs(), tcp_eff_send_mss(), tcp_enqueue_flags(), tcp_fasttmr(), tcp_input(), tcp_keepalive(), tcp_kill_prio(), tcp_kill_timewait(), tcp_listen_input(), tcp_listen_with_backlog(), tcp_new_port(), tcp_oos_insert_segment(), tcp_output(), tcp_output_alloc_header(), tcp_output_segment(), tcp_pbuf_prealloc(), tcp_pcb_purge(), tcp_pcb_remove(), tcp_pcbs_sane(), tcp_process(), tcp_receive(), tcp_recv_null(), tcp_rexmit(), tcp_rexmit_fast(), tcp_rexmit_rto(), tcp_rst(), tcp_seg_copy(), tcp_seg_free(), tcp_segs_free(), tcp_send_empty_ack(), tcp_send_fin(), tcp_shutdown(), tcp_slowtmr(), tcp_timer_needed(), tcp_write(), tcp_write_checks(), tcp_zero_window_probe(), tcpip_callback_with_block(), tcpip_init(), tcpip_input(), tcpip_tcp_timer(), tcpip_thread(), tcpip_timeout(), tcpip_untimeout(), tryget_socket(), udp_bind(), udp_connect(), udp_input(), udp_new(), udp_remove(), update_arp_entry(), uxEventGroupGetNumber(), uxListRemove(), uxTaskGetSystemState(), uxTaskGetTaskNumber(), vListInitialiseItem(), vPortFree(), vStartEthernetTaskLauncher(), vStartLEDFlashTasks(), vTaskDelete(), vTaskGetInfo(), vTaskList(), vTaskNotifyGiveFromISR(), vTaskResume(), vTaskSetTaskNumber(), vTaskStartScheduler(), vTaskSuspend(), xEventGroupCreate(), xQueueGenericCreate(), xQueueGenericSend(), xQueueGenericSendFromISR(), xQueueGiveFromISR(), xQueuePeek(), xQueuePeekFromISR(), xQueueReceive(), xQueueReceiveFromISR(), xStreamBufferGenericCreate(), xStreamBufferReceive(), xStreamBufferReceiveCompletedFromISR(), xStreamBufferReset(), xStreamBufferSend(), xStreamBufferSendCompletedFromISR(), xTaskGenericNotify(), xTaskGenericNotifyFromISR(), xTaskIncrementTick(), xTaskNotifyWait(), and xTaskResumeAll().
#define PP_HTONL | ( | x | ) |
Referenced by dhcp_bind(), and dhcp_create_msg().
#define PP_HTONS | ( | x | ) | ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8)) |
Referenced by etharp_arp_input(), etharp_raw(), etharp_send_ip(), ethernet_input(), icmp_input(), ip_input(), and tcp_rst().
#define PP_NTOHL | ( | x | ) | PP_HTONL(x) |
#define PP_NTOHS | ( | x | ) | PP_HTONS(x) |
Referenced by ip_reass().
Convert an u32_t from host- to network byte order.
n | u32_t in host byte order |
Referenced by ip4_addr_netmask_valid(), and lwip_ntohl().
These are reference implementations of the byte swapping functions.
Again with the aim of being simple, correct and fully portable. Byte swapping is the second thing you would want to optimize. You will need to port it to your architecture and in your cc.h:
#define LWIP_PLATFORM_BYTESWAP 1 #define LWIP_PLATFORM_HTONS(x) <your_htons> #define LWIP_PLATFORM_HTONL(x) <your_htonl>
Note ntohs() and ntohl() are merely references to the htonx counterparts. Convert an u16_t from host- to network byte order.
n | u16_t in host byte order |
Referenced by lwip_ntohs().
Convert an u32_t from network- to host byte order.
n | u32_t in network byte order |
References lwip_htonl().
Convert an u16_t from network- to host byte order.
n | u16_t in network byte order |
References lwip_htons().