VirtualBox

Changeset 48109 in vbox for trunk/src/VBox/Devices/Network


Ignore:
Timestamp:
Aug 28, 2013 1:51:24 AM (11 years ago)
Author:
vboxsync
Message:

Move renaming of lwip symbols from lwipopts.h into a separate file
lwip-namespace.h. Same object code is generated.

Location:
trunk/src/VBox/Devices/Network/lwip-new/vbox/include
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/lwip-new/vbox/include/lwip-namespace.h

    r48107 r48109  
    1 #ifndef VBOX_LWIP_OPTS_H_
    2 #define VBOX_LWIP_OPTS_H_
    3 
    4 #include <iprt/mem.h>
    5 #include <iprt/alloca.h>    /* This may include malloc.h (msc), which is something that has
    6                              * to be done before redefining any of the functions therein. */
    7 #include <iprt/rand.h> /* see LWIP_RAND() definition */
    8 
    9 /* lwip/sockets.h assumes that if FD_SET is defined (in case of Innotek GCC
    10  * its definition is dragged through iprt/types.h) then struct timeval is
    11  * defined as well, but it's not the case. So include it manually. */
    12 #ifdef RT_OS_OS2
    13 # include <sys/time.h>
    14 #endif
    15 
    16 /** Make lwIP use the libc malloc, or more precisely (see below) the IPRT
    17  * memory allocation functions. */
    18 #define MEM_LIBC_MALLOC 1
    19 
    20 /** Set proper memory alignment. */
    21 #if HC_ARCH_BITS == 64
    22 # define MEM_ALIGNMENT 8
    23 #else
    24 #define MEM_ALIGNMENT 4
    25 #endif
    26 
    27 /* IP */
    28 #define IP_REASSEMBLY 1
    29 #define IP_REASS_MAX_PBUFS      128
    30 
    31 
    32 
    33 /** Increase maximum TCP window size. */
    34 #define TCP_WND 32768
    35 
    36 /** Increase TCP maximum segment size. */
    37 #define TCP_MSS 1460
    38 
    39 /** Enable queueing of out-of-order segments. */
    40 #define TCP_QUEUE_OOSEQ 1
    41 
    42 /** TCP sender buffer space (bytes). */
    43 #define TCP_SND_BUF (32 * TCP_MSS)
    44 
    45 /* TCP sender buffer space (pbufs). This must be at least = 2 *
    46    TCP_SND_BUF/TCP_MSS for things to work. */
    47 #define TCP_SND_QUEUELEN        64
    48 
    49 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
    50    sends a lot of data out of ROM (or other static memory), this
    51    should be set high.
    52 
    53    NB: This is for PBUF_ROM and PBUF_REF pbufs only!
    54 
    55    Number of PBUF_POOL pbufs is controlled by PBUF_POOL_SIZE that,
    56    somewhat confusingly, breaks MEMP_NUM_* pattern.
    57 
    58    PBUF_RAM pbufs are allocated with mem_malloc (with MEM_LIBC_MALLOC
    59    set to 1 this is just system malloc), not memp_malloc.  */
    60 #define MEMP_NUM_PBUF (1024 * 4)
    61 
    62 
    63 /* MEMP_NUM_MLD6_GROUP: Maximum number of IPv6 multicast groups that
    64    can be joined.
    65 
    66    We need to be able to join solicited node multicast for each
    67    address (potentially different) and two groups for DHCP6.  All
    68    routers multicast is hardcoded in ip6.c and does not require
    69    explicit joining.  Provide also for a few extra groups just in
    70    case.  */
    71 #define MEMP_NUM_MLD6_GROUP     (LWIP_IPV6_NUM_ADDRESSES + /* dhcp6 */ 2 + /* extra */ 8)
    72 
    73 
    74 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
    75    segments. */
    76 #define MEMP_NUM_TCP_SEG (MEMP_NUM_TCP_PCB * TCP_SND_QUEUELEN / 2)
    77 
    78 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
    79    connections. */
    80 #define MEMP_NUM_TCP_PCB        128
    81 
    82 /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
    83    for sequential API communication and incoming packets. Used in
    84    src/api/tcpip.c. */
    85 #define MEMP_NUM_TCPIP_MSG_API   128
    86 #define MEMP_NUM_TCPIP_MSG_INPKT 1024
    87 
    88 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
    89    per active UDP "connection". */
    90 #define MEMP_NUM_UDP_PCB        32
    91 
    92 /* Pbuf options */
    93 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
    94    This is only for PBUF_POOL pbufs, primarily used by netif drivers.
    95 
    96    This should have been named with the MEMP_NUM_ prefix (cf.
    97    MEMP_NUM_PBUF for PBUF_ROM and PBUF_REF) as it controls the size of
    98    yet another memp_malloc() pool.  */
    99 #define PBUF_POOL_SIZE          (1024 * 4)
    100 
    101 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool.
    102    Use default that is based on TCP_MSS and PBUF_LINK_HLEN.  */
    103 #undef PBUF_POOL_BUFSIZE 
    104 
    105 /** Turn on support for lightweight critical region protection. Leaving this
    106  * off uses synchronization code in pbuf.c which is totally polluted with
    107  * races. All the other lwip source files would fall back to semaphore-based
    108  * synchronization, but pbuf.c is just broken, leading to incorrect allocation
    109  * and as a result to assertions due to buffers being double freed. */
    110 #define SYS_LIGHTWEIGHT_PROT 1
    111 
    112 /** Attempt to get rid of htons etc. macro issues. */
    113 #define LWIP_PREFIX_BYTEORDER_FUNCS
    114 
    115 #define LWIP_NOASSERT 0
    116 
    117 #define LWIP_TCPIP_CORE_LOCKING_INPUT 0
    118 #define LWIP_TCPIP_CORE_LOCKING 0
    119 #define LWIP_TCP 1
    120 #define LWIP_SOCKET 1
    121 #define LWIP_ARP 1
    122 #define ARP_PROXY 1
    123 #define LWIP_ETHERNET 1
    124 #define LWIP_COMPAT_SOCKETS 0
    125 #define LWIP_COMPAT_MUTEX 1
    126 
    127 #define LWIP_IPV6 1
    128 #define LWIP_IPV6_FORWARD 1
    129 #define LWIP_ND6_PROXY 1
    130 
    131 #define LWIP_ND6_ALLOW_RA_UPDATES       (!LWIP_IPV6_FORWARD)
    132 #define LWIP_IPV6_SEND_ROUTER_SOLICIT   (!LWIP_IPV6_FORWARD)
    133 /* IPv6 autoconfig we don't need in proxy, but it required for very seldom cases
    134  * iSCSI over intnet with IPv6
     1/*
     2 * Hack to avoid function name collisions with slirp or any other code.
     3 * Include at the end of your lwipopts.h
    1354 */
    136 #define LWIP_IPV6_AUTOCONFIG            1
    137 #if LWIP_IPV6_FORWARD /* otherwise use the default from lwip/opt.h */
    138 #define LWIP_IPV6_DUP_DETECT_ATTEMPTS   0
    139 #endif
    140 
    141 
    142 /**
    143  * aka Slirp mode.
    144  */
    145 #define LWIP_CONNECTION_PROXY 1
    146 #define IP_FORWARD            1
    147 
    148 /* MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active
    149    timeouts. */
    150 #define MEMP_NUM_SYS_TIMEOUT    16
    151 
    152 
    153 /* this is required for IPv6 and IGMP needs */
    154 #define LWIP_RAND() RTRandU32()
    155 
    156 /* Debugging stuff. */
    157 #ifdef DEBUG
    158 /* filter in debugging severity */
    159 # define DBG_TYPES_ON (LWIP_DBG_ON | LWIP_DBG_TRACE | LWIP_DBG_STATE | LWIP_DBG_FRESH | LWIP_DBG_HALT)
    160 # define DBG_MIN_LEVEL 0
    161 
    162 # define LWIP_DEBUG LWIP_DBG_ON
    163 /* Ethernet & ARP debugging */
    164 # define ETHARP_DEBUG    LWIP_DBG_ON
    165 /* IPv4 debugging */
    166 # define IP_DEBUG    LWIP_DBG_ON
    167 # define IP_REASS_DEBUG  LWIP_DBG_ON
    168 /* IPv6 debugging */
    169 # define IP6_DEBUG LWIP_DBG_ON
    170 /* ICMP debugging */
    171 # define ICMP_DEBUG  LWIP_DBG_ON
    172 /* TCP debugging */
    173 # define TCP_DEBUG   LWIP_DBG_ON
    174 # define TCP_INPUT_DEBUG LWIP_DBG_ON
    175 # define TCP_FR_DEBUG    LWIP_DBG_ON
    176 # define TCP_RTO_DEBUG   LWIP_DBG_ON
    177 # define TCP_CWND_DEBUG  LWIP_DBG_ON
    178 # define TCP_WND_DEBUG   LWIP_DBG_ON
    179 # define TCP_OUTPUT_DEBUG    LWIP_DBG_ON
    180 # define TCP_RST_DEBUG   LWIP_DBG_ON
    181 # define TCP_QLEN_DEBUG  LWIP_DBG_ON
    182 /* RAW API debugging */
    183 /* API debugging */
    184 # define NETIF_DEBUG LWIP_DBG_ON
    185 # define PBUF_DEBUG  LWIP_DBG_ON
    186 # define API_LIB_DEBUG   LWIP_DBG_ON
    187 # define API_MSG_DEBUG   LWIP_DBG_ON
    188 # define SOCKETS_DEBUG   LWIP_DBG_ON
    189 
    190 # define INET_DEBUG  LWIP_DBG_ON
    191 # define RAW_DEBUG   LWIP_DBG_ON
    192 # define MEM_DEBUG   LWIP_DBG_ON
    193 # define MEMP_DEBUG  LWIP_DBG_ON
    194 # define SYS_DEBUG   LWIP_DBG_ON
    195 
    196 # define UDP_DEBUG   LWIP_DBG_ON
    197 # define TCPIP_DEBUG LWIP_DBG_ON
    198 # define DHCP_DEBUG  LWIP_DBG_ON
    199 
    200 # define LWIP_PROXY_DEBUG LWIP_DBG_ON
    201 /* Debug checks */
    202 # define TCP_OVERSIZE_DBGCHECK 1
    203 #endif /* DEBUG */
    204 
    205 /* printf formatter definitions */
    206 #define U16_F "hu"
    207 #define S16_F "hd"
    208 #define X16_F "hx"
    209 #define U32_F "lu"
    210 #define S32_F "ld"
    211 #define X32_F "lx"
    212 
    213 /* Redirect libc memory alloc functions to IPRT. */
    214 #define malloc(x) RTMemAlloc(x)
    215 #define realloc(x,y) RTMemRealloc((x), (y))
    216 #define free(x) RTMemFree(x)
    217 
    218 /* Hack to avoid function name collisions with slirp or any other code. */
     5#ifndef _VBOX_LWIP_NAMESPACE_H_
     6#define _VBOX_LWIP_NAMESPACE_H_
     7
    2198#define api_msg_input lwip_api_msg_input
    2209#define api_msg_post lwip_api_msg_post
     
    446235# define ntohl   lwip_ntohl
    447236#endif
    448 #endif
     237#endif  /* _VBOX_LWIP_NAMESPACE_H_ */
  • trunk/src/VBox/Devices/Network/lwip-new/vbox/include/lwipopts.h

    r47887 r48109  
    216216#define free(x) RTMemFree(x)
    217217
    218 /* Hack to avoid function name collisions with slirp or any other code. */
    219 #define api_msg_input lwip_api_msg_input
    220 #define api_msg_post lwip_api_msg_post
    221 #define etharp_arp_input lwip_etharp_arp_input
    222 #define etharp_find_addr lwip_etharp_find_addr
    223 #define etharp_ip_input lwip_etharp_ip_input
    224 #define etharp_output lwip_etharp_output
    225 #define etharp_query lwip_etharp_query
    226 #define etharp_request lwip_etharp_request
    227 #define etharp_tmr lwip_etharp_tmr
    228 #define icmp_dest_unreach lwip_icmp_dest_unreach
    229 #define icmp_input lwip_icmp_input
    230 #define inet_chksum lwip_inet_chksum
    231 #define inet_chksum_pbuf lwip_inet_chksum_pbuf
    232 #define inet_chksum_pseudo lwip_inet_chksum_pseudo
    233 #define lwip_inet_aton(cp, addr)   ipaddr_aton(cp, (ip_addr_t*)(addr))
    234 #define ip_addr_any lwip_ip_addr_any
    235 #define ip_addr_broadcast lwip_ip_addr_broadcast
    236 #ifdef ip_addr_isbroadcast
    237 # undef ip_addr_isbroadcast
    238 # if defined(ip4_addr_isbroadcast)
    239 #  define lwip_ip_addr_isbroadcast(ipaddr. netif) lwip_ip4_addr_isbroadcast((ipaddr)->addr, (netif))
    240 #  define ip4_addr_isbroadcast lwip_ip4_addr_isbroadcast
    241 # endif
    242 #endif
    243 #define ip_frag lwip_ip_frag
    244 #define ip_frag_init lwip_ip_frag_init
    245 #if 0
    246 #define ip_init lwip_ip_init
    247 #endif
    248 #define ip_input lwip_ip_input
    249 #define ip_output lwip_ip_output
    250 #define ip_output_if lwip_ip_output_if
    251 #define ip_reass lwip_ip_reass
    252 #define ip_reass_tmr lwip_ip_reass_tmr
    253 #define ip_route lwip_ip_route
    254 #define netbuf_alloc lwip_netbuf_alloc
    255 #define netbuf_chain lwip_netbuf_chain
    256 #define netbuf_data lwip_netbuf_data
    257 #define netbuf_delete lwip_netbuf_delete
    258 #define netbuf_first lwip_netbuf_first
    259 #define netbuf_free lwip_netbuf_free
    260 #define netbuf_new lwip_netbuf_new
    261 #define netbuf_next lwip_netbuf_next
    262 #define netbuf_ref lwip_netbuf_ref
    263 #define netconn_accept lwip_netconn_accept
    264 #if 0
    265 #define netconn_addr lwip_netconn_addr
    266 #endif
    267 #define netconn_bind lwip_netconn_bind
    268 #define netconn_close lwip_netconn_close
    269 #define netconn_connect lwip_netconn_connect
    270 #define netconn_delete lwip_netconn_delete
    271 #define netconn_disconnect lwip_netconn_disconnect
    272 #if 0
    273 #define netconn_err lwip_netconn_err
    274 #define netconn_listen lwip_netconn_listen
    275 #define netconn_new lwip_netconn_new
    276 #define netconn_new_with_callback lwip_netconn_new_with_callback
    277 #endif
    278 #define netconn_new_with_proto_and_callback lwip_netconn_new_with_proto_and_callback
    279 #if 0
    280 #define netconn_peer lwip_netconn_peer
    281 #endif
    282 #define netconn_recv lwip_netconn_recv
    283 #define netconn_send lwip_netconn_send
    284 #if 0
    285 #define netconn_type lwip_netconn_type
    286 #define netconn_write lwip_netconn_write
    287 #endif
    288 #define netif_add lwip_netif_add
    289 #define netif_default lwip_netif_default
    290 #define netif_find lwip_netif_find
    291 #define netif_init lwip_netif_init
    292 #define netif_list lwip_netif_list
    293 #define netif_remove lwip_netif_remove
    294 #define netif_set_addr lwip_netif_set_addr
    295 #define netif_set_default lwip_netif_set_default
    296 #define netif_set_down lwip_netif_set_down
    297 #define netif_set_gw lwip_netif_set_gw
    298 #define netif_set_ipaddr lwip_netif_set_ipaddr
    299 #define netif_set_netmask lwip_netif_set_netmask
    300 #define netif_set_up lwip_netif_set_up
    301 #if MEM_LIBC_MALLOC == 0
    302 #define mem_free lwip_mem_free
    303 #define mem_init lwip_mem_init
    304 #define mem_malloc lwip_mem_malloc
    305 #define mem_realloc lwip_mem_realloc
    306 #endif
    307 #define memp_free lwip_memp_free
    308 #define memp_init lwip_memp_init
    309 #define memp_malloc lwip_memp_malloc
    310 #define pbuf_alloc lwip_pbuf_alloc
    311 #define pbuf_cat lwip_pbuf_cat
    312 #define pbuf_chain lwip_pbuf_chain
    313 #define pbuf_clen lwip_pbuf_clen
    314 #define pbuf_dechain lwip_pbuf_dechain
    315 #define pbuf_dequeue lwip_pbuf_dequeue
    316 #define pbuf_free lwip_pbuf_free
    317 #define pbuf_header lwip_pbuf_header
    318 #if 0
    319 #define pbuf_init lwip_pbuf_init
    320 #endif
    321 #define pbuf_queue lwip_pbuf_queue
    322 #define pbuf_realloc lwip_pbuf_realloc
    323 #define pbuf_ref lwip_pbuf_ref
    324 #define pbuf_take lwip_pbuf_take
    325 #define raw_bind lwip_raw_bind
    326 #define raw_connect lwip_raw_connect
    327 #if 0
    328 #define raw_init lwip_raw_init
    329 #endif
    330 #define raw_input lwip_raw_input
    331 #define raw_new lwip_raw_new
    332 #define raw_recv lwip_raw_recv
    333 #define raw_remove lwip_raw_remove
    334 #define raw_send lwip_raw_send
    335 #define raw_sendto lwip_raw_sendto
    336 #define stats_init lwip_stats_init
    337 #define sys_arch_mbox_fetch lwip_sys_arch_mbox_fetch
    338 #define sys_arch_mbox_tryfetch(mbox, msg) lwip_sys_arch_mbox_fetch((mbox), (msg), 1)
    339 #define sys_arch_protect lwip_sys_arch_protect
    340 #define sys_arch_sem_wait lwip_sys_arch_sem_wait
    341 #define sys_arch_timeouts lwip_sys_arch_timeouts
    342 #define sys_arch_unprotect lwip_sys_arch_unprotect
    343 #define sys_init lwip_sys_init
    344 #if 0
    345 #define sys_mbox_fetch lwip_sys_mbox_fetch
    346 #endif
    347 #define sys_mbox_free lwip_sys_mbox_free
    348 #define sys_mbox_new lwip_sys_mbox_new
    349 #define sys_mbox_post lwip_sys_mbox_post
    350 #define sys_thread_new lwip_sys_thread_new
    351 #define sys_msleep lwip_sys_msleep
    352 #define sys_mbox_set_invalid lwip_sys_mbox_set_invalid
    353 #define sys_mbox_valid lwip_sys_mbox_valid
    354 #if 1
    355 #define sys_sem_wait_timeout lwip_sys_sem_wait_timeout
    356 #define sys_sem_free lwip_sys_sem_free
    357 #define sys_sem_new lwip_sys_sem_new
    358 #define sys_sem_signal lwip_sys_sem_signal
    359 #define lwip_sys_sem_wait lwip_sys_arch_sem_wait
    360 #define sys_arch_sem_wait lwip_sys_arch_sem_wait
    361 #endif
    362 #define sys_timeout_debug lwip_sys_timeout_debug
    363 #define sys_untimeout lwip_sys_untimeout
    364 #define tcp_abort lwip_tcp_abort
    365 #define tcp_accept lwip_tcp_accept
    366 #define tcp_active_pcbs lwip_tcp_active_pcbs
    367 #define tcp_alloc lwip_tcp_alloc
    368 #define tcp_arg lwip_tcp_arg
    369 #define tcp_backoff lwip_tcp_backoff
    370 #define tcp_bind lwip_tcp_bind
    371 #define tcp_close lwip_tcp_close
    372 #define tcp_connect lwip_tcp_connect
    373 #define tcp_enqueue lwip_tcp_enqueue
    374 #define tcp_err lwip_tcp_err
    375 #define tcp_fasttmr lwip_tcp_fasttmr
    376 #define tcp_init lwip_tcp_init
    377 #define tcp_input lwip_tcp_input
    378 #define tcp_input_pcb lwip_tcp_input_pcb
    379 #define tcp_keepalive lwip_tcp_keepalive
    380 #if defined(tcp_listen)
    381 # undef tcp_listen
    382 # define tcp_listen(pcb) lwip_tcp_listen_with_backlog(pcb, TCP_DEFAULT_LISTEN_BACKLOG)
    383 #endif
    384 #define tcp_listen_with_backlog  lwip_tcp_listen_with_backlog
    385 #define tcp_listen_pcbs lwip_tcp_listen_pcbs
    386 #define tcp_new lwip_tcp_new
    387 #define tcp_next_iss lwip_tcp_next_iss
    388 #define tcp_output lwip_tcp_output
    389 #define tcp_pcb_purge lwip_tcp_pcb_purge
    390 #define tcp_pcb_remove lwip_tcp_pcb_remove
    391 #define tcp_poll lwip_tcp_poll
    392 #define tcp_recv lwip_tcp_recv
    393 #define tcp_recved lwip_tcp_recved
    394 #define tcp_rexmit lwip_tcp_rexmit
    395 #define tcp_rexmit_rto lwip_tcp_rexmit_rto
    396 /* tcp_rst is renaming to tcp_rst_impl,
    397  * so for cleaner ABI, _impl was added. */
    398 #define tcp_rst_impl lwip_tcp_rst_impl
    399 #define tcp_seg_copy lwip_tcp_seg_copy
    400 #define tcp_seg_free lwip_tcp_seg_free
    401 #define tcp_segs_free lwip_tcp_segs_free
    402 #define tcp_send_ctrl lwip_tcp_send_ctrl
    403 #define tcp_sent lwip_tcp_sent
    404 #define tcp_setprio lwip_tcp_setprio
    405 #define tcp_slowtmr lwip_tcp_slowtmr
    406 #define tcp_ticks lwip_tcp_ticks
    407 #define tcp_timer_needed lwip_tcp_timer_needed
    408 #define tcp_tmp_pcb lwip_tcp_tmp_pcb
    409 #define tcp_tmr lwip_tcp_tmr
    410 #define tcp_tw_pcbs lwip_tcp_tw_pcbs
    411 #define tcp_write lwip_tcp_write
    412 #define tcpip_apimsg lwip_tcpip_apimsg
    413 #if 0
    414 #define tcpip_callback lwip_tcpip_callback
    415 #endif
    416 #define tcpip_init lwip_tcpip_init
    417 #define tcpip_input lwip_tcpip_input
    418 #define udp_bind lwip_udp_bind
    419 #define udp_connect lwip_udp_connect
    420 #define udp_disconnect lwip_udp_disconnect
    421 #define udp_init lwip_udp_init
    422 #define udp_input lwip_udp_input
    423 #define udp_new lwip_udp_new
    424 #define udp_pcbs lwip_udp_pcbs
    425 #define udp_recv lwip_udp_recv
    426 #define udp_remove lwip_udp_remove
    427 #define udp_send lwip_udp_send
    428 #define udp_sendto lwip_udp_sendto
    429 
    430 #define lwip_pbuf_init()
    431 #define lwip_etharp_init()
    432 
    433 #ifndef htons
    434 # define htons   lwip_htons
    435 #endif
    436 
    437 #ifndef ntohs
    438 # define ntohs   lwip_ntohs
    439 #endif
    440 
    441 #ifndef htonl
    442 # define htonl   lwip_htonl
    443 #endif
    444 
    445 #ifndef ntohl
    446 # define ntohl   lwip_ntohl
    447 #endif
    448 #endif
     218
     219#include "lwip-namespace.h"
     220
     221#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette