mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-30 12:32:37 +00:00
(api break) qualify ip_addr_t as const where feasible
this changes the callback signatures of the ip_output and the {udp,raw}_recv functions. changes were made by going through all header files, searching for occurrences of ip_addr_t, qualifying them as const and if required modifying the corresponding c files, looking for other uses of ip_addr_t that would be required. the following header files were not treated as i'm not using them and wouldn't see them compiled: api.h api_msg.h dhcp.h dns.h igmp.h netifapi.h pppapi.h snmp.h snmp_msg.h snmp_structs.h ppp.h pppol2tp.h test/* no modifications were done on ip6_addr_t.
This commit is contained in:
parent
df3f05e824
commit
9f065c0ea5
@ -309,7 +309,7 @@ inet_cksum_pseudo_base(struct pbuf *p, u8_t proto, u16_t proto_len, u32_t acc)
|
||||
*/
|
||||
u16_t
|
||||
inet_chksum_pseudo(struct pbuf *p, u8_t proto, u16_t proto_len,
|
||||
ip_addr_t *src, ip_addr_t *dest)
|
||||
const ip_addr_t *src, const ip_addr_t *dest)
|
||||
{
|
||||
u32_t acc;
|
||||
u32_t addr;
|
||||
@ -421,7 +421,7 @@ inet_cksum_pseudo_partial_base(struct pbuf *p, u8_t proto, u16_t proto_len,
|
||||
*/
|
||||
u16_t
|
||||
inet_chksum_pseudo_partial(struct pbuf *p, u8_t proto, u16_t proto_len,
|
||||
u16_t chksum_len, ip_addr_t *src, ip_addr_t *dest)
|
||||
u16_t chksum_len, const ip_addr_t *src, const ip_addr_t *dest)
|
||||
{
|
||||
u32_t acc;
|
||||
u32_t addr;
|
||||
|
@ -108,7 +108,7 @@ static u16_t ip_id;
|
||||
* @return the netif on which to send to reach dest
|
||||
*/
|
||||
struct netif *
|
||||
ip_route(ip_addr_t *dest)
|
||||
ip_route(const ip_addr_t *dest)
|
||||
{
|
||||
struct netif *netif;
|
||||
|
||||
@ -649,7 +649,7 @@ ip_input(struct pbuf *p, struct netif *inp)
|
||||
* unique identifiers independent of destination"
|
||||
*/
|
||||
err_t
|
||||
ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
ip_output_if(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos,
|
||||
u8_t proto, struct netif *netif)
|
||||
{
|
||||
@ -663,12 +663,12 @@ ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
* @ param ip_options pointer to the IP options, copied into the IP header
|
||||
* @ param optlen length of ip_options
|
||||
*/
|
||||
err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
err_t ip_output_if_opt(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options,
|
||||
u16_t optlen)
|
||||
{
|
||||
#endif /* IP_OPTIONS_SEND */
|
||||
ip_addr_t *src_used = src;
|
||||
const ip_addr_t *src_used = src;
|
||||
if (dest != IP_HDRINCL) {
|
||||
if (ip_addr_isany(src)) {
|
||||
src_used = &netif->ip_addr;
|
||||
@ -688,7 +688,7 @@ err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
* when it is 'any'.
|
||||
*/
|
||||
err_t
|
||||
ip_output_if_src(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
ip_output_if_src(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos,
|
||||
u8_t proto, struct netif *netif)
|
||||
{
|
||||
@ -700,7 +700,7 @@ ip_output_if_src(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
* Same as ip_output_if_opt() but 'src' address is not replaced by netif address
|
||||
* when it is 'any'.
|
||||
*/
|
||||
err_t ip_output_if_opt_src(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
err_t ip_output_if_opt_src(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options,
|
||||
u16_t optlen)
|
||||
{
|
||||
@ -861,7 +861,7 @@ err_t ip_output_if_opt_src(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
* see ip_output_if() for more return values
|
||||
*/
|
||||
err_t
|
||||
ip_output(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
ip_output(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos, u8_t proto)
|
||||
{
|
||||
struct netif *netif;
|
||||
@ -898,7 +898,7 @@ ip_output(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
* see ip_output_if() for more return values
|
||||
*/
|
||||
err_t
|
||||
ip_output_hinted(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
ip_output_hinted(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint)
|
||||
{
|
||||
struct netif *netif;
|
||||
|
@ -677,7 +677,7 @@ ipfrag_free_pbuf_custom(struct pbuf *p)
|
||||
* @return ERR_OK if sent successfully, err_t otherwise
|
||||
*/
|
||||
err_t
|
||||
ip_frag(struct pbuf *p, struct netif *netif, ip_addr_t *dest)
|
||||
ip_frag(struct pbuf *p, struct netif *netif, const ip_addr_t *dest)
|
||||
{
|
||||
struct pbuf *rambuf;
|
||||
#if IP_FRAG_USES_STATIC_BUF
|
||||
|
@ -95,7 +95,7 @@ static err_t netif_null_output_ip6(struct netif *netif, struct pbuf *p, ip6_addr
|
||||
#endif
|
||||
|
||||
#if LWIP_HAVE_LOOPIF
|
||||
static err_t netif_loop_output_ipv4(struct netif *netif, struct pbuf *p, ip_addr_t* addr);
|
||||
static err_t netif_loop_output_ipv4(struct netif *netif, struct pbuf *p, const ip_addr_t* addr);
|
||||
#if LWIP_IPV6
|
||||
static err_t netif_loop_output_ipv6(struct netif *netif, struct pbuf *p, ip6_addr_t* addr);
|
||||
#endif
|
||||
@ -171,8 +171,8 @@ netif_init(void)
|
||||
* @return netif, or NULL if failed.
|
||||
*/
|
||||
struct netif *
|
||||
netif_add(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
|
||||
ip_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input)
|
||||
netif_add(struct netif *netif, const ip_addr_t *ipaddr, const ip_addr_t *netmask,
|
||||
const ip_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input)
|
||||
{
|
||||
#if LWIP_IPV6
|
||||
u32_t i;
|
||||
@ -277,8 +277,8 @@ netif_add(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
|
||||
* @param gw the new default gateway
|
||||
*/
|
||||
void
|
||||
netif_set_addr(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
|
||||
ip_addr_t *gw)
|
||||
netif_set_addr(struct netif *netif, const ip_addr_t *ipaddr, const ip_addr_t *netmask,
|
||||
const ip_addr_t *gw)
|
||||
{
|
||||
netif_set_ipaddr(netif, ipaddr);
|
||||
netif_set_netmask(netif, netmask);
|
||||
@ -383,7 +383,7 @@ netif_find(char *name)
|
||||
* default gateway
|
||||
*/
|
||||
void
|
||||
netif_set_ipaddr(struct netif *netif, ip_addr_t *ipaddr)
|
||||
netif_set_ipaddr(struct netif *netif, const ip_addr_t *ipaddr)
|
||||
{
|
||||
/* TODO: Handling of obsolete pcbs */
|
||||
/* See: http://mail.gnu.org/archive/html/lwip-users/2003-03/msg00118.html */
|
||||
@ -448,7 +448,7 @@ netif_set_ipaddr(struct netif *netif, ip_addr_t *ipaddr)
|
||||
* @note call netif_set_addr() if you also want to change ip address and netmask
|
||||
*/
|
||||
void
|
||||
netif_set_gw(struct netif *netif, ip_addr_t *gw)
|
||||
netif_set_gw(struct netif *netif, const ip_addr_t *gw)
|
||||
{
|
||||
ip_addr_set(&(netif->gw), gw);
|
||||
LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("netif: GW address of interface %c%c set to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
|
||||
@ -469,7 +469,7 @@ netif_set_gw(struct netif *netif, ip_addr_t *gw)
|
||||
* default gateway
|
||||
*/
|
||||
void
|
||||
netif_set_netmask(struct netif *netif, ip_addr_t *netmask)
|
||||
netif_set_netmask(struct netif *netif, const ip_addr_t *netmask)
|
||||
{
|
||||
snmp_delete_iprteidx_tree(0, netif);
|
||||
/* set new netmask to netif */
|
||||
@ -763,7 +763,7 @@ netif_loop_output(struct netif *netif, struct pbuf *p)
|
||||
}
|
||||
|
||||
static err_t
|
||||
netif_loop_output_ipv4(struct netif *netif, struct pbuf *p, ip_addr_t* addr)
|
||||
netif_loop_output_ipv4(struct netif *netif, struct pbuf *p, const ip_addr_t* addr)
|
||||
{
|
||||
LWIP_UNUSED_ARG(addr);
|
||||
return netif_loop_output(netif, p);
|
||||
|
@ -170,7 +170,7 @@ raw_input(struct pbuf *p, struct netif *inp)
|
||||
* @see raw_disconnect()
|
||||
*/
|
||||
err_t
|
||||
raw_bind(struct raw_pcb *pcb, ip_addr_t *ipaddr)
|
||||
raw_bind(struct raw_pcb *pcb, const ip_addr_t *ipaddr)
|
||||
{
|
||||
ipX_addr_set_ipaddr(PCB_ISIPV6(pcb), &pcb->local_ip, ipaddr);
|
||||
return ERR_OK;
|
||||
@ -190,7 +190,7 @@ raw_bind(struct raw_pcb *pcb, ip_addr_t *ipaddr)
|
||||
* @see raw_disconnect() and raw_sendto()
|
||||
*/
|
||||
err_t
|
||||
raw_connect(struct raw_pcb *pcb, ip_addr_t *ipaddr)
|
||||
raw_connect(struct raw_pcb *pcb, const ip_addr_t *ipaddr)
|
||||
{
|
||||
ipX_addr_set_ipaddr(PCB_ISIPV6(pcb), &pcb->remote_ip, ipaddr);
|
||||
return ERR_OK;
|
||||
@ -231,14 +231,14 @@ raw_recv(struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg)
|
||||
*
|
||||
*/
|
||||
err_t
|
||||
raw_sendto(struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr)
|
||||
raw_sendto(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *ipaddr)
|
||||
{
|
||||
err_t err;
|
||||
struct netif *netif;
|
||||
ipX_addr_t *src_ip;
|
||||
struct pbuf *q; /* q will be sent down the stack */
|
||||
s16_t header_size;
|
||||
ipX_addr_t *dst_ip = ip_2_ipX(ipaddr);
|
||||
const ipX_addr_t *dst_ip = ip_2_ipX(ipaddr);
|
||||
|
||||
LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_TRACE, ("raw_sendto\n"));
|
||||
|
||||
|
@ -436,7 +436,7 @@ tcp_abort(struct tcp_pcb *pcb)
|
||||
* ERR_OK if bound
|
||||
*/
|
||||
err_t
|
||||
tcp_bind(struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port)
|
||||
tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
|
||||
{
|
||||
int i;
|
||||
int max_pcb_list = NUM_TCP_PCB_LISTS;
|
||||
@ -726,7 +726,7 @@ again:
|
||||
* other err_t values if connect request couldn't be sent
|
||||
*/
|
||||
err_t
|
||||
tcp_connect(struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port,
|
||||
tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port,
|
||||
tcp_connected_fn connected)
|
||||
{
|
||||
err_t ret;
|
||||
|
@ -540,7 +540,7 @@ udp_send_chksum(struct udp_pcb *pcb, struct pbuf *p,
|
||||
*/
|
||||
err_t
|
||||
udp_sendto(struct udp_pcb *pcb, struct pbuf *p,
|
||||
ip_addr_t *dst_ip, u16_t dst_port)
|
||||
const ip_addr_t *dst_ip, u16_t dst_port)
|
||||
{
|
||||
#if LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP
|
||||
return udp_sendto_chksum(pcb, p, dst_ip, dst_port, 0, 0);
|
||||
@ -548,12 +548,12 @@ udp_sendto(struct udp_pcb *pcb, struct pbuf *p,
|
||||
|
||||
/** Same as udp_sendto(), but with checksum */
|
||||
err_t
|
||||
udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip,
|
||||
udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
|
||||
u16_t dst_port, u8_t have_chksum, u16_t chksum)
|
||||
{
|
||||
#endif /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */
|
||||
struct netif *netif;
|
||||
ipX_addr_t *dst_ip_route = ip_2_ipX(dst_ip);
|
||||
const ipX_addr_t *dst_ip_route = ip_2_ipX(dst_ip);
|
||||
|
||||
LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE, ("udp_send\n"));
|
||||
|
||||
@ -612,7 +612,7 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip,
|
||||
*/
|
||||
err_t
|
||||
udp_sendto_if(struct udp_pcb *pcb, struct pbuf *p,
|
||||
ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif)
|
||||
const ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif)
|
||||
{
|
||||
#if LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP
|
||||
return udp_sendto_if_chksum(pcb, p, dst_ip, dst_port, netif, 0, 0);
|
||||
@ -620,12 +620,12 @@ udp_sendto_if(struct udp_pcb *pcb, struct pbuf *p,
|
||||
|
||||
/** Same as udp_sendto_if(), but with checksum */
|
||||
err_t
|
||||
udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip,
|
||||
udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
|
||||
u16_t dst_port, struct netif *netif, u8_t have_chksum,
|
||||
u16_t chksum)
|
||||
{
|
||||
#endif /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */
|
||||
ip_addr_t *src_ip;
|
||||
const ip_addr_t *src_ip;
|
||||
|
||||
/* PCB local address is IP_ANY_ADDR? */
|
||||
#if LWIP_IPV6
|
||||
@ -670,7 +670,7 @@ udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip,
|
||||
/** Same as udp_sendto_if(), but with source address */
|
||||
err_t
|
||||
udp_sendto_if_src(struct udp_pcb *pcb, struct pbuf *p,
|
||||
ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif, ip_addr_t *src_ip)
|
||||
const ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif, const ip_addr_t *src_ip)
|
||||
{
|
||||
#if LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP
|
||||
return udp_sendto_if_src_chksum(pcb, p, dst_ip, dst_port, netif, 0, 0, src_ip);
|
||||
@ -678,9 +678,9 @@ udp_sendto_if_src(struct udp_pcb *pcb, struct pbuf *p,
|
||||
|
||||
/** Same as udp_sendto_if_src(), but with checksum */
|
||||
err_t
|
||||
udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip,
|
||||
udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
|
||||
u16_t dst_port, struct netif *netif, u8_t have_chksum,
|
||||
u16_t chksum, ip_addr_t *src_ip)
|
||||
u16_t chksum, const ip_addr_t *src_ip)
|
||||
{
|
||||
#endif /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */
|
||||
struct udp_hdr *udphdr;
|
||||
@ -883,7 +883,7 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip,
|
||||
* @see udp_disconnect()
|
||||
*/
|
||||
err_t
|
||||
udp_bind(struct udp_pcb *pcb, ip_addr_t *ipaddr, u16_t port)
|
||||
udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
|
||||
{
|
||||
struct udp_pcb *ipcb;
|
||||
u8_t rebind;
|
||||
@ -969,7 +969,7 @@ udp_bind(struct udp_pcb *pcb, ip_addr_t *ipaddr, u16_t port)
|
||||
* @see udp_disconnect()
|
||||
*/
|
||||
err_t
|
||||
udp_connect(struct udp_pcb *pcb, ip_addr_t *ipaddr, u16_t port)
|
||||
udp_connect(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
|
||||
{
|
||||
struct udp_pcb *ipcb;
|
||||
|
||||
|
@ -111,8 +111,9 @@ struct in_addr {
|
||||
/* directly map this to the lwip internal functions */
|
||||
#define inet_addr(cp) ipaddr_addr(cp)
|
||||
#define inet_aton(cp, addr) ipaddr_aton(cp, (ip_addr_t*)addr)
|
||||
#define inet_ntoa(addr) ipaddr_ntoa((ip_addr_t*)&(addr))
|
||||
#define inet_ntoa_r(addr, buf, buflen) ipaddr_ntoa_r((ip_addr_t*)&(addr), buf, buflen)
|
||||
/* if those casts were originally introduced solely to strip off any const qualifier, they could be removed. */
|
||||
#define inet_ntoa(addr) ipaddr_ntoa((const ip_addr_t*)&(addr))
|
||||
#define inet_ntoa_r(addr, buf, buflen) ipaddr_ntoa_r((const ip_addr_t*)&(addr), buf, buflen)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -73,9 +73,9 @@ extern "C" {
|
||||
u16_t inet_chksum(void *dataptr, u16_t len);
|
||||
u16_t inet_chksum_pbuf(struct pbuf *p);
|
||||
u16_t inet_chksum_pseudo(struct pbuf *p, u8_t proto, u16_t proto_len,
|
||||
ip_addr_t *src, ip_addr_t *dest);
|
||||
const ip_addr_t *src, const ip_addr_t *dest);
|
||||
u16_t inet_chksum_pseudo_partial(struct pbuf *p, u8_t proto,
|
||||
u16_t proto_len, u16_t chksum_len, ip_addr_t *src, ip_addr_t *dest);
|
||||
u16_t proto_len, u16_t chksum_len, const ip_addr_t *src, const ip_addr_t *dest);
|
||||
#if LWIP_CHKSUM_COPY_ALGORITHM
|
||||
u16_t lwip_chksum_copy(void *dst, const void *src, u16_t len);
|
||||
#endif /* LWIP_CHKSUM_COPY_ALGORITHM */
|
||||
|
@ -112,23 +112,23 @@ PACK_STRUCT_END
|
||||
|
||||
|
||||
#define ip_init() /* Compatibility define, no init needed. */
|
||||
struct netif *ip_route(ip_addr_t *dest);
|
||||
struct netif *ip_route(const ip_addr_t *dest);
|
||||
err_t ip_input(struct pbuf *p, struct netif *inp);
|
||||
err_t ip_output(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
err_t ip_output(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos, u8_t proto);
|
||||
err_t ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
err_t ip_output_if(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos, u8_t proto, struct netif *netif);
|
||||
err_t ip_output_if_src(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
err_t ip_output_if_src(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos, u8_t proto, struct netif *netif);
|
||||
#if LWIP_NETIF_HWADDRHINT
|
||||
err_t ip_output_hinted(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
err_t ip_output_hinted(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint);
|
||||
#endif /* LWIP_NETIF_HWADDRHINT */
|
||||
#if IP_OPTIONS_SEND
|
||||
err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
err_t ip_output_if_opt(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options,
|
||||
u16_t optlen);
|
||||
err_t ip_output_if_opt_src(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
err_t ip_output_if_opt_src(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options,
|
||||
u16_t optlen);
|
||||
#endif /* IP_OPTIONS_SEND */
|
||||
|
@ -89,8 +89,8 @@ extern const ip_addr_t ip_addr_broadcast;
|
||||
/** IP_ADDR_ can be used as a fixed IP address
|
||||
* for the wildcard and the broadcast address
|
||||
*/
|
||||
#define IP_ADDR_ANY ((ip_addr_t *)&ip_addr_any)
|
||||
#define IP_ADDR_BROADCAST ((ip_addr_t *)&ip_addr_broadcast)
|
||||
#define IP_ADDR_ANY (&ip_addr_any)
|
||||
#define IP_ADDR_BROADCAST (&ip_addr_broadcast)
|
||||
|
||||
/** 255.255.255.255 */
|
||||
#define IPADDR_NONE ((u32_t)0xffffffffUL)
|
||||
|
@ -81,7 +81,7 @@ struct pbuf_custom_ref {
|
||||
#endif /* LWIP_PBUF_CUSTOM_REF_DEFINED */
|
||||
#endif /* !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF */
|
||||
|
||||
err_t ip_frag(struct pbuf *p, struct netif *netif, ip_addr_t *dest);
|
||||
err_t ip_frag(struct pbuf *p, struct netif *netif, const ip_addr_t *dest);
|
||||
#endif /* IP_FRAG */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -123,7 +123,7 @@ typedef err_t (*netif_input_fn)(struct pbuf *p, struct netif *inp);
|
||||
* @param ipaddr The IP address to which the packet shall be sent
|
||||
*/
|
||||
typedef err_t (*netif_output_fn)(struct netif *netif, struct pbuf *p,
|
||||
ip_addr_t *ipaddr);
|
||||
const ip_addr_t *ipaddr);
|
||||
#if LWIP_IPV6
|
||||
/** Function prototype for netif->output_ip6 functions. Called by lwIP when a packet
|
||||
* shall be sent. For ethernet netif, set this to 'ethip6_output' and set
|
||||
@ -147,7 +147,7 @@ typedef err_t (*netif_linkoutput_fn)(struct netif *netif, struct pbuf *p);
|
||||
typedef void (*netif_status_callback_fn)(struct netif *netif);
|
||||
/** Function prototype for netif igmp_mac_filter functions */
|
||||
typedef err_t (*netif_igmp_mac_filter_fn)(struct netif *netif,
|
||||
ip_addr_t *group, u8_t action);
|
||||
const ip_addr_t *group, u8_t action);
|
||||
#if LWIP_IPV6 && LWIP_IPV6_MLD
|
||||
/** Function prototype for netif mld_mac_filter functions */
|
||||
typedef err_t (*netif_mld_mac_filter_fn)(struct netif *netif,
|
||||
@ -310,12 +310,12 @@ extern struct netif *netif_default;
|
||||
|
||||
void netif_init(void);
|
||||
|
||||
struct netif *netif_add(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
|
||||
ip_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input);
|
||||
struct netif *netif_add(struct netif *netif, const ip_addr_t *ipaddr, const ip_addr_t *netmask,
|
||||
const ip_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input);
|
||||
|
||||
void
|
||||
netif_set_addr(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
|
||||
ip_addr_t *gw);
|
||||
netif_set_addr(struct netif *netif, const ip_addr_t *ipaddr, const ip_addr_t *netmask,
|
||||
const ip_addr_t *gw);
|
||||
void netif_remove(struct netif * netif);
|
||||
|
||||
/* Returns a network interface given its name. The name is of the form
|
||||
@ -326,9 +326,9 @@ struct netif *netif_find(char *name);
|
||||
|
||||
void netif_set_default(struct netif *netif);
|
||||
|
||||
void netif_set_ipaddr(struct netif *netif, ip_addr_t *ipaddr);
|
||||
void netif_set_netmask(struct netif *netif, ip_addr_t *netmask);
|
||||
void netif_set_gw(struct netif *netif, ip_addr_t *gw);
|
||||
void netif_set_ipaddr(struct netif *netif, const ip_addr_t *ipaddr);
|
||||
void netif_set_netmask(struct netif *netif, const ip_addr_t *netmask);
|
||||
void netif_set_gw(struct netif *netif, const ip_addr_t *gw);
|
||||
|
||||
void netif_set_up(struct netif *netif);
|
||||
void netif_set_down(struct netif *netif);
|
||||
|
@ -59,7 +59,7 @@ struct raw_pcb;
|
||||
* if it's not used any more.
|
||||
*/
|
||||
typedef u8_t (*raw_recv_fn)(void *arg, struct raw_pcb *pcb, struct pbuf *p,
|
||||
ip_addr_t *addr);
|
||||
const ip_addr_t *addr);
|
||||
|
||||
#if LWIP_IPV6
|
||||
/** Function prototype for raw pcb IPv6 receive callback functions.
|
||||
@ -108,11 +108,11 @@ struct raw_pcb {
|
||||
RAW code. */
|
||||
struct raw_pcb * raw_new (u8_t proto);
|
||||
void raw_remove (struct raw_pcb *pcb);
|
||||
err_t raw_bind (struct raw_pcb *pcb, ip_addr_t *ipaddr);
|
||||
err_t raw_connect (struct raw_pcb *pcb, ip_addr_t *ipaddr);
|
||||
err_t raw_bind (struct raw_pcb *pcb, const ip_addr_t *ipaddr);
|
||||
err_t raw_connect (struct raw_pcb *pcb, const ip_addr_t *ipaddr);
|
||||
|
||||
void raw_recv (struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg);
|
||||
err_t raw_sendto (struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr);
|
||||
err_t raw_sendto (struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *ipaddr);
|
||||
err_t raw_send (struct raw_pcb *pcb, struct pbuf *p);
|
||||
|
||||
#if LWIP_IPV6
|
||||
|
@ -364,9 +364,9 @@ void tcp_err (struct tcp_pcb *pcb, tcp_err_fn err);
|
||||
#endif /* TCP_LISTEN_BACKLOG */
|
||||
|
||||
void tcp_recved (struct tcp_pcb *pcb, u16_t len);
|
||||
err_t tcp_bind (struct tcp_pcb *pcb, ip_addr_t *ipaddr,
|
||||
err_t tcp_bind (struct tcp_pcb *pcb, const ip_addr_t *ipaddr,
|
||||
u16_t port);
|
||||
err_t tcp_connect (struct tcp_pcb *pcb, ip_addr_t *ipaddr,
|
||||
err_t tcp_connect (struct tcp_pcb *pcb, const ip_addr_t *ipaddr,
|
||||
u16_t port, tcp_connected_fn connected);
|
||||
|
||||
struct tcp_pcb * tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog);
|
||||
|
@ -86,7 +86,7 @@ struct udp_pcb;
|
||||
* @param port the remote port from which the packet was received
|
||||
*/
|
||||
typedef void (*udp_recv_fn)(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
||||
ip_addr_t *addr, u16_t port);
|
||||
const ip_addr_t *addr, u16_t port);
|
||||
|
||||
#if LWIP_IPV6
|
||||
/** Function prototype for udp pcb IPv6 receive callback functions
|
||||
@ -123,7 +123,7 @@ struct udp_pcb {
|
||||
|
||||
#if LWIP_IGMP
|
||||
/** outgoing network interface for multicast packets */
|
||||
ip_addr_t multicast_ip;
|
||||
const ip_addr_t multicast_ip;
|
||||
#endif /* LWIP_IGMP */
|
||||
|
||||
#if LWIP_UDPLITE
|
||||
@ -146,36 +146,36 @@ extern struct udp_pcb *udp_pcbs;
|
||||
UDP code. */
|
||||
struct udp_pcb * udp_new (void);
|
||||
void udp_remove (struct udp_pcb *pcb);
|
||||
err_t udp_bind (struct udp_pcb *pcb, ip_addr_t *ipaddr,
|
||||
err_t udp_bind (struct udp_pcb *pcb, const ip_addr_t *ipaddr,
|
||||
u16_t port);
|
||||
err_t udp_connect (struct udp_pcb *pcb, ip_addr_t *ipaddr,
|
||||
err_t udp_connect (struct udp_pcb *pcb, const ip_addr_t *ipaddr,
|
||||
u16_t port);
|
||||
void udp_disconnect (struct udp_pcb *pcb);
|
||||
void udp_recv (struct udp_pcb *pcb, udp_recv_fn recv,
|
||||
void *recv_arg);
|
||||
err_t udp_sendto_if (struct udp_pcb *pcb, struct pbuf *p,
|
||||
ip_addr_t *dst_ip, u16_t dst_port,
|
||||
const ip_addr_t *dst_ip, u16_t dst_port,
|
||||
struct netif *netif);
|
||||
err_t udp_sendto_if_src(struct udp_pcb *pcb, struct pbuf *p,
|
||||
ip_addr_t *dst_ip, u16_t dst_port,
|
||||
struct netif *netif, ip_addr_t *src_ip);
|
||||
const ip_addr_t *dst_ip, u16_t dst_port,
|
||||
struct netif *netif, const ip_addr_t *src_ip);
|
||||
err_t udp_sendto (struct udp_pcb *pcb, struct pbuf *p,
|
||||
ip_addr_t *dst_ip, u16_t dst_port);
|
||||
const ip_addr_t *dst_ip, u16_t dst_port);
|
||||
err_t udp_send (struct udp_pcb *pcb, struct pbuf *p);
|
||||
|
||||
#if LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP
|
||||
err_t udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p,
|
||||
ip_addr_t *dst_ip, u16_t dst_port,
|
||||
const ip_addr_t *dst_ip, u16_t dst_port,
|
||||
struct netif *netif, u8_t have_chksum,
|
||||
u16_t chksum);
|
||||
err_t udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p,
|
||||
ip_addr_t *dst_ip, u16_t dst_port,
|
||||
const ip_addr_t *dst_ip, u16_t dst_port,
|
||||
u8_t have_chksum, u16_t chksum);
|
||||
err_t udp_send_chksum(struct udp_pcb *pcb, struct pbuf *p,
|
||||
u8_t have_chksum, u16_t chksum);
|
||||
err_t udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p,
|
||||
ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif,
|
||||
u8_t have_chksum, u16_t chksum, ip_addr_t *src_ip);
|
||||
const ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif,
|
||||
u8_t have_chksum, u16_t chksum, const ip_addr_t *src_ip);
|
||||
#endif /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */
|
||||
|
||||
#define udp_flags(pcb) ((pcb)->flags)
|
||||
|
@ -196,11 +196,11 @@ struct etharp_q_entry {
|
||||
|
||||
#define etharp_init() /* Compatibility define, no init needed. */
|
||||
void etharp_tmr(void);
|
||||
s8_t etharp_find_addr(struct netif *netif, ip_addr_t *ipaddr,
|
||||
struct eth_addr **eth_ret, ip_addr_t **ip_ret);
|
||||
err_t etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr);
|
||||
err_t etharp_query(struct netif *netif, ip_addr_t *ipaddr, struct pbuf *q);
|
||||
err_t etharp_request(struct netif *netif, ip_addr_t *ipaddr);
|
||||
s8_t etharp_find_addr(struct netif *netif, const ip_addr_t *ipaddr,
|
||||
struct eth_addr **eth_ret, const ip_addr_t **ip_ret);
|
||||
err_t etharp_output(struct netif *netif, struct pbuf *q, const ip_addr_t *ipaddr);
|
||||
err_t etharp_query(struct netif *netif, const ip_addr_t *ipaddr, struct pbuf *q);
|
||||
err_t etharp_request(struct netif *netif, const ip_addr_t *ipaddr);
|
||||
/** For Ethernet network interfaces, we might want to send "gratuitous ARP";
|
||||
* this is an ARP packet sent by a node in order to spontaneously cause other
|
||||
* nodes to update an entry in their ARP cache.
|
||||
@ -209,8 +209,8 @@ err_t etharp_request(struct netif *netif, ip_addr_t *ipaddr);
|
||||
void etharp_cleanup_netif(struct netif *netif);
|
||||
|
||||
#if ETHARP_SUPPORT_STATIC_ENTRIES
|
||||
err_t etharp_add_static_entry(ip_addr_t *ipaddr, struct eth_addr *ethaddr);
|
||||
err_t etharp_remove_static_entry(ip_addr_t *ipaddr);
|
||||
err_t etharp_add_static_entry(const ip_addr_t *ipaddr, struct eth_addr *ethaddr);
|
||||
err_t etharp_remove_static_entry(const ip_addr_t *ipaddr);
|
||||
#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */
|
||||
|
||||
#if LWIP_AUTOIP
|
||||
|
@ -264,7 +264,7 @@ etharp_tmr(void)
|
||||
* entry is found or could be recycled.
|
||||
*/
|
||||
static s8_t
|
||||
etharp_find_entry(ip_addr_t *ipaddr, u8_t flags)
|
||||
etharp_find_entry(const ip_addr_t *ipaddr, u8_t flags)
|
||||
{
|
||||
s8_t old_pending = ARP_TABLE_SIZE, old_stable = ARP_TABLE_SIZE;
|
||||
s8_t empty = ARP_TABLE_SIZE;
|
||||
@ -462,7 +462,7 @@ etharp_send_ip(struct netif *netif, struct pbuf *p, struct eth_addr *src, struct
|
||||
* @see pbuf_free()
|
||||
*/
|
||||
static err_t
|
||||
etharp_update_arp_entry(struct netif *netif, ip_addr_t *ipaddr, struct eth_addr *ethaddr, u8_t flags)
|
||||
etharp_update_arp_entry(struct netif *netif, const ip_addr_t *ipaddr, struct eth_addr *ethaddr, u8_t flags)
|
||||
{
|
||||
s8_t i;
|
||||
LWIP_ASSERT("netif->hwaddr_len == ETHARP_HWADDR_LEN", netif->hwaddr_len == ETHARP_HWADDR_LEN);
|
||||
@ -540,7 +540,7 @@ etharp_update_arp_entry(struct netif *netif, ip_addr_t *ipaddr, struct eth_addr
|
||||
* @return @see return values of etharp_add_static_entry
|
||||
*/
|
||||
err_t
|
||||
etharp_add_static_entry(ip_addr_t *ipaddr, struct eth_addr *ethaddr)
|
||||
etharp_add_static_entry(const ip_addr_t *ipaddr, struct eth_addr *ethaddr)
|
||||
{
|
||||
struct netif *netif;
|
||||
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_add_static_entry: %"U16_F".%"U16_F".%"U16_F".%"U16_F" - %02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F"\n",
|
||||
@ -565,7 +565,7 @@ etharp_add_static_entry(ip_addr_t *ipaddr, struct eth_addr *ethaddr)
|
||||
* ERR_ARG: entry wasn't a static entry but a dynamic one
|
||||
*/
|
||||
err_t
|
||||
etharp_remove_static_entry(ip_addr_t *ipaddr)
|
||||
etharp_remove_static_entry(const ip_addr_t *ipaddr)
|
||||
{
|
||||
s8_t i;
|
||||
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_remove_static_entry: %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
|
||||
@ -617,8 +617,8 @@ void etharp_cleanup_netif(struct netif *netif)
|
||||
* @return table index if found, -1 otherwise
|
||||
*/
|
||||
s8_t
|
||||
etharp_find_addr(struct netif *netif, ip_addr_t *ipaddr,
|
||||
struct eth_addr **eth_ret, ip_addr_t **ip_ret)
|
||||
etharp_find_addr(struct netif *netif, const ip_addr_t *ipaddr,
|
||||
struct eth_addr **eth_ret, const ip_addr_t **ip_ret)
|
||||
{
|
||||
s8_t i;
|
||||
|
||||
@ -893,11 +893,11 @@ etharp_output_to_arp_index(struct netif *netif, struct pbuf *q, u8_t arp_idx)
|
||||
* or the return type of either etharp_query() or etharp_send_ip().
|
||||
*/
|
||||
err_t
|
||||
etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr)
|
||||
etharp_output(struct netif *netif, struct pbuf *q, const ip_addr_t *ipaddr)
|
||||
{
|
||||
struct eth_addr *dest;
|
||||
struct eth_addr mcastaddr;
|
||||
ip_addr_t *dst_addr = ipaddr;
|
||||
const ip_addr_t *dst_addr = ipaddr;
|
||||
|
||||
LWIP_ASSERT("netif != NULL", netif != NULL);
|
||||
LWIP_ASSERT("q != NULL", q != NULL);
|
||||
@ -1045,7 +1045,7 @@ etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr)
|
||||
*
|
||||
*/
|
||||
err_t
|
||||
etharp_query(struct netif *netif, ip_addr_t *ipaddr, struct pbuf *q)
|
||||
etharp_query(struct netif *netif, const ip_addr_t *ipaddr, struct pbuf *q)
|
||||
{
|
||||
struct eth_addr * srcaddr = (struct eth_addr *)netif->hwaddr;
|
||||
err_t result = ERR_MEM;
|
||||
@ -1326,7 +1326,7 @@ etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
|
||||
* any other err_t on failure
|
||||
*/
|
||||
err_t
|
||||
etharp_request(struct netif *netif, ip_addr_t *ipaddr)
|
||||
etharp_request(struct netif *netif, const ip_addr_t *ipaddr)
|
||||
{
|
||||
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_request: sending ARP request.\n"));
|
||||
return etharp_raw(netif, (struct eth_addr *)netif->hwaddr, ðbroadcast,
|
||||
|
Loading…
x
Reference in New Issue
Block a user