mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-27 03:35:38 +00:00
Replaced struct ip_addr by typedef ip_addr_t to make changing the actual implementation behind the typedef easier.
This commit is contained in:
parent
24fcf9a86e
commit
5d360a6711
@ -19,6 +19,10 @@ HISTORY
|
||||
|
||||
++ New features:
|
||||
|
||||
2010-02-04: Simon Goldschmidt
|
||||
* nearly every file: Replaced struct ip_addr by typedef ip_addr_t to
|
||||
make changing the actual implementation behind the typedef easier.
|
||||
|
||||
2010-02-01: Simon Goldschmidt
|
||||
* opt.h, memp_std.h, dns.h, netdb.c, memp.c: Let netdb use a memp pool
|
||||
for allocating memory when getaddrinfo() is called.
|
||||
|
@ -130,7 +130,7 @@ netconn_delete(struct netconn *conn)
|
||||
* ERR_OK if the information was retrieved
|
||||
*/
|
||||
err_t
|
||||
netconn_getaddr(struct netconn *conn, struct ip_addr *addr, u16_t *port, u8_t local)
|
||||
netconn_getaddr(struct netconn *conn, ip_addr_t *addr, u16_t *port, u8_t local)
|
||||
{
|
||||
struct api_msg msg;
|
||||
err_t err;
|
||||
@ -161,7 +161,7 @@ netconn_getaddr(struct netconn *conn, struct ip_addr *addr, u16_t *port, u8_t lo
|
||||
* @return ERR_OK if bound, any other err_t on failure
|
||||
*/
|
||||
err_t
|
||||
netconn_bind(struct netconn *conn, struct ip_addr *addr, u16_t port)
|
||||
netconn_bind(struct netconn *conn, ip_addr_t *addr, u16_t port)
|
||||
{
|
||||
struct api_msg msg;
|
||||
err_t err;
|
||||
@ -187,7 +187,7 @@ netconn_bind(struct netconn *conn, struct ip_addr *addr, u16_t port)
|
||||
* @return ERR_OK if connected, return value of tcp_/udp_/raw_connect otherwise
|
||||
*/
|
||||
err_t
|
||||
netconn_connect(struct netconn *conn, struct ip_addr *addr, u16_t port)
|
||||
netconn_connect(struct netconn *conn, ip_addr_t *addr, u16_t port)
|
||||
{
|
||||
struct api_msg msg;
|
||||
err_t err;
|
||||
@ -438,7 +438,7 @@ netconn_recv(struct netconn *conn, struct netbuf **new_buf)
|
||||
* @return ERR_OK if data was sent, any other err_t on error
|
||||
*/
|
||||
err_t
|
||||
netconn_sendto(struct netconn *conn, struct netbuf *buf, struct ip_addr *addr, u16_t port)
|
||||
netconn_sendto(struct netconn *conn, struct netbuf *buf, ip_addr_t *addr, u16_t port)
|
||||
{
|
||||
if (buf != NULL) {
|
||||
buf->addr = addr;
|
||||
@ -547,8 +547,8 @@ netconn_close(struct netconn *conn)
|
||||
*/
|
||||
err_t
|
||||
netconn_join_leave_group(struct netconn *conn,
|
||||
struct ip_addr *multiaddr,
|
||||
struct ip_addr *netif_addr,
|
||||
ip_addr_t *multiaddr,
|
||||
ip_addr_t *netif_addr,
|
||||
enum netconn_igmp join_or_leave)
|
||||
{
|
||||
struct api_msg msg;
|
||||
@ -573,14 +573,14 @@ netconn_join_leave_group(struct netconn *conn,
|
||||
* Execute a DNS query, only one IP address is returned
|
||||
*
|
||||
* @param name a string representation of the DNS host name to query
|
||||
* @param addr a preallocated struct ip_addr where to store the resolved IP address
|
||||
* @param addr a preallocated ip_addr_t where to store the resolved IP address
|
||||
* @return ERR_OK: resolving succeeded
|
||||
* ERR_MEM: memory error, try again later
|
||||
* ERR_ARG: dns client not initialized or invalid hostname
|
||||
* ERR_VAL: dns server response was invalid
|
||||
*/
|
||||
err_t
|
||||
netconn_gethostbyname(const char *name, struct ip_addr *addr)
|
||||
netconn_gethostbyname(const char *name, ip_addr_t *addr)
|
||||
{
|
||||
struct dns_api_msg msg;
|
||||
err_t err;
|
||||
|
@ -70,7 +70,7 @@ static void do_close_internal(struct netconn *conn);
|
||||
*/
|
||||
static u8_t
|
||||
recv_raw(void *arg, struct raw_pcb *pcb, struct pbuf *p,
|
||||
struct ip_addr *addr)
|
||||
ip_addr_t *addr)
|
||||
{
|
||||
struct pbuf *q;
|
||||
struct netbuf *buf;
|
||||
@ -136,7 +136,7 @@ recv_raw(void *arg, struct raw_pcb *pcb, struct pbuf *p,
|
||||
*/
|
||||
static void
|
||||
recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
||||
struct ip_addr *addr, u16_t port)
|
||||
ip_addr_t *addr, u16_t port)
|
||||
{
|
||||
struct netbuf *buf;
|
||||
struct netconn *conn;
|
||||
@ -176,7 +176,7 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
||||
const struct ip_hdr* iphdr = ip_current_header();
|
||||
/* get the UDP header - always in the first pbuf, ensured by udp_input */
|
||||
const struct udp_hdr* udphdr = (void*)(((char*)iphdr) + IPH_LEN(iphdr));
|
||||
buf->toaddr = (struct ip_addr*)&iphdr->dest;
|
||||
buf->toaddr = (ip_addr_t*)&iphdr->dest;
|
||||
buf->toport = udphdr->dest;
|
||||
}
|
||||
#endif /* LWIP_NETBUF_RECVINFO */
|
||||
@ -1387,7 +1387,7 @@ do_join_leave_group(struct api_msg_msg *msg)
|
||||
* signaling the semaphore.
|
||||
*/
|
||||
static void
|
||||
do_dns_found(const char *name, struct ip_addr *ipaddr, void *arg)
|
||||
do_dns_found(const char *name, ip_addr_t *ipaddr, void *arg)
|
||||
{
|
||||
struct dns_api_msg *msg = (struct dns_api_msg*)arg;
|
||||
|
||||
|
@ -49,8 +49,8 @@
|
||||
|
||||
/** helper struct for gethostbyname_r to access the char* buffer */
|
||||
struct gethostbyname_r_helper {
|
||||
struct ip_addr *addrs;
|
||||
struct ip_addr addr;
|
||||
ip_addr_t *addrs;
|
||||
ip_addr_t addr;
|
||||
char *aliases;
|
||||
};
|
||||
|
||||
@ -85,13 +85,13 @@ struct hostent*
|
||||
lwip_gethostbyname(const char *name)
|
||||
{
|
||||
err_t err;
|
||||
struct ip_addr addr;
|
||||
ip_addr_t addr;
|
||||
|
||||
/* buffer variables for lwip_gethostbyname() */
|
||||
HOSTENT_STORAGE struct hostent s_hostent;
|
||||
HOSTENT_STORAGE char *s_aliases;
|
||||
HOSTENT_STORAGE struct ip_addr s_hostent_addr;
|
||||
HOSTENT_STORAGE struct ip_addr *s_phostent_addr;
|
||||
HOSTENT_STORAGE ip_addr_t s_hostent_addr;
|
||||
HOSTENT_STORAGE ip_addr_t *s_phostent_addr;
|
||||
|
||||
/* query host IP address */
|
||||
err = netconn_gethostbyname(name, &addr);
|
||||
@ -107,7 +107,7 @@ lwip_gethostbyname(const char *name)
|
||||
s_hostent.h_name = (char*)name;
|
||||
s_hostent.h_aliases = &s_aliases;
|
||||
s_hostent.h_addrtype = AF_INET;
|
||||
s_hostent.h_length = sizeof(struct ip_addr);
|
||||
s_hostent.h_length = sizeof(ip_addr_t);
|
||||
s_hostent.h_addr_list = (char**)&s_phostent_addr;
|
||||
|
||||
#if DNS_DEBUG
|
||||
@ -128,7 +128,7 @@ lwip_gethostbyname(const char *name)
|
||||
u8_t idx;
|
||||
for ( idx=0; s_hostent.h_addr_list[idx]; idx++) {
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_addr_list[%i] == %p\n", idx, s_hostent.h_addr_list[idx]));
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_addr_list[%i]-> == %s\n", idx, ip_ntoa((struct ip_addr*)s_hostent.h_addr_list[idx])));
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_addr_list[%i]-> == %s\n", idx, ip_ntoa((ip_addr_t*)s_hostent.h_addr_list[idx])));
|
||||
}
|
||||
}
|
||||
#endif /* DNS_DEBUG */
|
||||
@ -213,7 +213,7 @@ lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf,
|
||||
ret->h_name = (char*)hostname;
|
||||
ret->h_aliases = &(h->aliases);
|
||||
ret->h_addrtype = AF_INET;
|
||||
ret->h_length = sizeof(struct ip_addr);
|
||||
ret->h_length = sizeof(ip_addr_t);
|
||||
ret->h_addr_list = (char**)&(h->addrs);
|
||||
|
||||
/* set result != NULL */
|
||||
@ -266,7 +266,7 @@ lwip_getaddrinfo(const char *nodename, const char *servname,
|
||||
const struct addrinfo *hints, struct addrinfo **res)
|
||||
{
|
||||
err_t err;
|
||||
struct ip_addr addr;
|
||||
ip_addr_t addr;
|
||||
struct addrinfo *ai;
|
||||
struct sockaddr_in *sa = NULL;
|
||||
int port_nr = 0;
|
||||
|
@ -96,9 +96,9 @@ do_netifapi_netif_common(struct netifapi_msg_msg *msg)
|
||||
*/
|
||||
err_t
|
||||
netifapi_netif_add(struct netif *netif,
|
||||
struct ip_addr *ipaddr,
|
||||
struct ip_addr *netmask,
|
||||
struct ip_addr *gw,
|
||||
ip_addr_t *ipaddr,
|
||||
ip_addr_t *netmask,
|
||||
ip_addr_t *gw,
|
||||
void *state,
|
||||
netif_init_fn init,
|
||||
netif_input_fn input)
|
||||
@ -124,9 +124,9 @@ netifapi_netif_add(struct netif *netif,
|
||||
*/
|
||||
err_t
|
||||
netifapi_netif_set_addr(struct netif *netif,
|
||||
struct ip_addr *ipaddr,
|
||||
struct ip_addr *netmask,
|
||||
struct ip_addr *gw)
|
||||
ip_addr_t *ipaddr,
|
||||
ip_addr_t *netmask,
|
||||
ip_addr_t *gw)
|
||||
{
|
||||
struct netifapi_msg msg;
|
||||
msg.function = do_netifapi_netif_set_addr;
|
||||
|
@ -272,7 +272,7 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
||||
{
|
||||
struct lwip_socket *sock, *nsock;
|
||||
struct netconn *newconn;
|
||||
struct ip_addr naddr;
|
||||
ip_addr_t naddr;
|
||||
u16_t port;
|
||||
int newsock;
|
||||
struct sockaddr_in sin;
|
||||
@ -358,7 +358,7 @@ int
|
||||
lwip_bind(int s, const struct sockaddr *name, socklen_t namelen)
|
||||
{
|
||||
struct lwip_socket *sock;
|
||||
struct ip_addr local_addr;
|
||||
ip_addr_t local_addr;
|
||||
u16_t local_port;
|
||||
err_t err;
|
||||
|
||||
@ -427,7 +427,7 @@ lwip_connect(int s, const struct sockaddr *name, socklen_t namelen)
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d, AF_UNSPEC)\n", s));
|
||||
err = netconn_disconnect(sock->conn);
|
||||
} else {
|
||||
struct ip_addr remote_addr;
|
||||
ip_addr_t remote_addr;
|
||||
u16_t remote_port;
|
||||
|
||||
inet_addr_to_ipaddr(&remote_addr, &((const struct sockaddr_in *)name)->sin_addr);
|
||||
@ -494,7 +494,7 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
|
||||
struct netbuf *buf;
|
||||
u16_t buflen, copylen;
|
||||
int off = 0;
|
||||
struct ip_addr *addr;
|
||||
ip_addr_t *addr;
|
||||
u16_t port;
|
||||
u8_t done = 0;
|
||||
err_t err;
|
||||
@ -578,11 +578,12 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
|
||||
|
||||
/* Check to see from where the data was.*/
|
||||
if (done) {
|
||||
ip_addr_t fromaddr;
|
||||
if (from && fromlen) {
|
||||
struct sockaddr_in sin;
|
||||
|
||||
if (netconn_type(sock->conn) == NETCONN_TCP) {
|
||||
addr = (struct ip_addr*)&(sin.sin_addr.s_addr);
|
||||
addr = &fromaddr;
|
||||
netconn_getaddr(sock->conn, addr, &port, 0);
|
||||
} else {
|
||||
addr = netbuf_fromaddr(buf);
|
||||
@ -605,11 +606,9 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
|
||||
ip_addr_debug_print(SOCKETS_DEBUG, addr);
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F" len=%d\n", port, off));
|
||||
} else {
|
||||
#if SOCKETS_DEBUG
|
||||
struct sockaddr_in sin;
|
||||
|
||||
#if SOCKETS_DEBUG
|
||||
if (netconn_type(sock->conn) == NETCONN_TCP) {
|
||||
addr = (struct ip_addr*)&(sin.sin_addr.s_addr);
|
||||
addr = &fromaddr;
|
||||
netconn_getaddr(sock->conn, addr, &port, 0);
|
||||
} else {
|
||||
addr = netbuf_fromaddr(buf);
|
||||
@ -619,7 +618,7 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): addr=", s));
|
||||
ip_addr_debug_print(SOCKETS_DEBUG, addr);
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F" len=%d\n", port, off));
|
||||
#endif /* SOCKETS_DEBUG */
|
||||
#endif /* SOCKETS_DEBUG */
|
||||
}
|
||||
}
|
||||
|
||||
@ -691,7 +690,7 @@ lwip_sendto(int s, const void *data, size_t size, int flags,
|
||||
const struct sockaddr *to, socklen_t tolen)
|
||||
{
|
||||
struct lwip_socket *sock;
|
||||
struct ip_addr remote_addr;
|
||||
ip_addr_t remote_addr;
|
||||
err_t err;
|
||||
u16_t short_size;
|
||||
#if !LWIP_TCPIP_CORE_LOCKING
|
||||
@ -1176,7 +1175,7 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
|
||||
{
|
||||
struct lwip_socket *sock;
|
||||
struct sockaddr_in sin;
|
||||
struct ip_addr naddr;
|
||||
ip_addr_t naddr;
|
||||
|
||||
sock = get_socket(s);
|
||||
if (!sock)
|
||||
@ -1870,10 +1869,14 @@ lwip_setsockopt_internal(void *arg)
|
||||
{
|
||||
/* If this is a TCP or a RAW socket, ignore these options. */
|
||||
struct ip_mreq *imr = (struct ip_mreq *)optval;
|
||||
ip_addr_t if_addr;
|
||||
ip_addr_t multi_addr;
|
||||
inet_addr_to_ipaddr(&if_addr, &imr->imr_interface);
|
||||
inet_addr_to_ipaddr(&multi_addr, &imr->imr_multiaddr);
|
||||
if(optname == IP_ADD_MEMBERSHIP){
|
||||
data->err = igmp_joingroup((struct ip_addr*)&(imr->imr_interface.s_addr), (struct ip_addr*)&(imr->imr_multiaddr.s_addr));
|
||||
data->err = igmp_joingroup(&if_addr, &multi_addr);
|
||||
} else {
|
||||
data->err = igmp_leavegroup((struct ip_addr*)&(imr->imr_interface.s_addr), (struct ip_addr*)&(imr->imr_multiaddr.s_addr));
|
||||
data->err = igmp_leavegroup(&if_addr, &multi_addr);
|
||||
}
|
||||
if(data->err != ERR_OK) {
|
||||
data->err = EADDRNOTAVAIL;
|
||||
|
@ -146,7 +146,7 @@ static err_t dhcp_reboot(struct netif *netif);
|
||||
static void dhcp_set_state(struct dhcp *dhcp, u8_t new_state);
|
||||
|
||||
/* receive, unfold, parse and free incoming messages */
|
||||
static void dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port);
|
||||
static void dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port);
|
||||
|
||||
/* set the DHCP timers */
|
||||
static void dhcp_timeout(struct netif *netif);
|
||||
@ -559,7 +559,7 @@ dhcp_handle_ack(struct netif *netif)
|
||||
/* DNS servers */
|
||||
n = 0;
|
||||
while(dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n) && (n < DNS_MAX_SERVERS)) {
|
||||
struct ip_addr dns_addr;
|
||||
ip_addr_t dns_addr;
|
||||
ip4_addr_set_u32(&dns_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n)));
|
||||
dns_setserver(n, &dns_addr);
|
||||
n++;
|
||||
@ -756,7 +756,7 @@ dhcp_network_changed(struct netif *netif)
|
||||
* @param netif the network interface on which the reply was received
|
||||
* @param addr The IP address we received a reply from
|
||||
*/
|
||||
void dhcp_arp_reply(struct netif *netif, struct ip_addr *addr)
|
||||
void dhcp_arp_reply(struct netif *netif, ip_addr_t *addr)
|
||||
{
|
||||
LWIP_ERROR("netif != NULL", (netif != NULL), return;);
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_arp_reply()\n"));
|
||||
@ -889,7 +889,7 @@ dhcp_bind(struct netif *netif)
|
||||
{
|
||||
u32_t timeout;
|
||||
struct dhcp *dhcp;
|
||||
struct ip_addr sn_mask, gw_addr;
|
||||
ip_addr_t sn_mask, gw_addr;
|
||||
LWIP_ERROR("dhcp_bind: netif != NULL", (netif != NULL), return;);
|
||||
dhcp = netif->dhcp;
|
||||
LWIP_ERROR("dhcp_bind: dhcp != NULL", (dhcp != NULL), return;);
|
||||
@ -1493,7 +1493,7 @@ decode_next:
|
||||
* If an incoming DHCP message is in response to us, then trigger the state machine
|
||||
*/
|
||||
static void
|
||||
dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port)
|
||||
dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port)
|
||||
{
|
||||
struct netif *netif = (struct netif *)arg;
|
||||
struct dhcp *dhcp = netif->dhcp;
|
||||
|
@ -187,7 +187,7 @@ struct dns_table_entry {
|
||||
u8_t err;
|
||||
u32_t ttl;
|
||||
char name[DNS_MAX_NAME_LENGTH];
|
||||
struct ip_addr ipaddr;
|
||||
ip_addr_t ipaddr;
|
||||
/* pointer to callback on DNS query done */
|
||||
dns_found_callback found;
|
||||
void *arg;
|
||||
@ -199,7 +199,7 @@ struct local_hostlist_entry {
|
||||
/** static hostname */
|
||||
const char *name;
|
||||
/** static host address in network byteorder */
|
||||
struct ip_addr addr;
|
||||
ip_addr_t addr;
|
||||
struct local_hostlist_entry *next;
|
||||
};
|
||||
|
||||
@ -229,7 +229,7 @@ static void dns_init_local();
|
||||
|
||||
|
||||
/* forward declarations */
|
||||
static void dns_recv(void *s, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port);
|
||||
static void dns_recv(void *s, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port);
|
||||
static void dns_check_entries(void);
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
@ -240,7 +240,7 @@ static void dns_check_entries(void);
|
||||
static struct udp_pcb *dns_pcb;
|
||||
static u8_t dns_seqno;
|
||||
static struct dns_table_entry dns_table[DNS_TABLE_SIZE];
|
||||
static struct ip_addr dns_servers[DNS_MAX_SERVERS];
|
||||
static ip_addr_t dns_servers[DNS_MAX_SERVERS];
|
||||
|
||||
#if (DNS_USES_STATIC_BUF == 1)
|
||||
static u8_t dns_payload[DNS_MSG_SIZE];
|
||||
@ -253,7 +253,7 @@ static u8_t dns_payload[DNS_MSG_SIZE];
|
||||
void
|
||||
dns_init()
|
||||
{
|
||||
struct ip_addr dnsserver;
|
||||
ip_addr_t dnsserver;
|
||||
|
||||
/* initialize default DNS server address */
|
||||
DNS_SERVER_ADDRESS(&dnsserver);
|
||||
@ -290,7 +290,7 @@ dns_init()
|
||||
* @param dnsserver IP address of the DNS server to set
|
||||
*/
|
||||
void
|
||||
dns_setserver(u8_t numdns, struct ip_addr *dnsserver)
|
||||
dns_setserver(u8_t numdns, ip_addr_t *dnsserver)
|
||||
{
|
||||
if ((numdns < DNS_MAX_SERVERS) && (dns_pcb != NULL) &&
|
||||
(dnsserver != NULL) && !ip_addr_isany(dnsserver)) {
|
||||
@ -305,7 +305,7 @@ dns_setserver(u8_t numdns, struct ip_addr *dnsserver)
|
||||
* @return IP address of the indexed DNS server or "ip_addr_any" if the DNS
|
||||
* server has not been configured.
|
||||
*/
|
||||
struct ip_addr
|
||||
ip_addr_t
|
||||
dns_getserver(u8_t numdns)
|
||||
{
|
||||
if (numdns < DNS_MAX_SERVERS) {
|
||||
@ -395,7 +395,7 @@ dns_lookup_local(const char *hostname)
|
||||
* @return the number of removed entries
|
||||
*/
|
||||
int
|
||||
dns_local_removehost(const char *hostname, const struct ip_addr *addr)
|
||||
dns_local_removehost(const char *hostname, const ip_addr_t *addr)
|
||||
{
|
||||
int removed = 0;
|
||||
struct local_hostlist_entry *entry = local_hostlist_dynamic;
|
||||
@ -430,7 +430,7 @@ dns_local_removehost(const char *hostname, const struct ip_addr *addr)
|
||||
* @return ERR_OK if succeeded or ERR_MEM on memory error
|
||||
*/
|
||||
err_t
|
||||
dns_local_addhost(const char *hostname, const struct ip_addr *addr)
|
||||
dns_local_addhost(const char *hostname, const ip_addr_t *addr)
|
||||
{
|
||||
struct local_hostlist_entry *entry;
|
||||
size_t namelen;
|
||||
@ -460,7 +460,7 @@ dns_local_addhost(const char *hostname, const struct ip_addr *addr)
|
||||
* for a hostname.
|
||||
*
|
||||
* @param name the hostname to look up
|
||||
* @return the hostname's IP address, as u32_t (instead of struct ip_addr to
|
||||
* @return the hostname's IP address, as u32_t (instead of ip_addr_t to
|
||||
* better check for failure: != IPADDR_NONE) or IPADDR_NONE if the hostname
|
||||
* was not found in the cached dns_table.
|
||||
*/
|
||||
@ -739,7 +739,7 @@ dns_check_entries(void)
|
||||
* @params see udp.h
|
||||
*/
|
||||
static void
|
||||
dns_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port)
|
||||
dns_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port)
|
||||
{
|
||||
u16_t i;
|
||||
char *pHostname;
|
||||
@ -824,14 +824,14 @@ dns_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u
|
||||
|
||||
/* Check for IP address type and Internet class. Others are discarded. */
|
||||
MEMCPY(&ans, pHostname, SIZEOF_DNS_ANSWER);
|
||||
if((ntohs(ans.type) == DNS_RRTYPE_A) && (ntohs(ans.class) == DNS_RRCLASS_IN) && (ntohs(ans.len) == sizeof(struct ip_addr)) ) {
|
||||
if((ntohs(ans.type) == DNS_RRTYPE_A) && (ntohs(ans.class) == DNS_RRCLASS_IN) && (ntohs(ans.len) == sizeof(ip_addr_t)) ) {
|
||||
/* read the answer resource record's TTL, and maximize it if needed */
|
||||
pEntry->ttl = ntohl(ans.ttl);
|
||||
if (pEntry->ttl > DNS_MAX_TTL) {
|
||||
pEntry->ttl = DNS_MAX_TTL;
|
||||
}
|
||||
/* read the IP address after answer resource record's header */
|
||||
MEMCPY( &(pEntry->ipaddr), (pHostname+SIZEOF_DNS_ANSWER), sizeof(struct ip_addr));
|
||||
MEMCPY( &(pEntry->ipaddr), (pHostname+SIZEOF_DNS_ANSWER), sizeof(ip_addr_t));
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: \"%s\": response = ", pEntry->name));
|
||||
ip_addr_debug_print(DNS_DEBUG, (&(pEntry->ipaddr)));
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("\n"));
|
||||
@ -950,7 +950,7 @@ dns_enqueue(const char *name, dns_found_callback found, void *callback_arg)
|
||||
* for resolution if no errors are present.
|
||||
*
|
||||
* @param hostname the hostname that is to be queried
|
||||
* @param addr pointer to a struct ip_addr where to store the address if it is already
|
||||
* @param addr pointer to a ip_addr_t where to store the address if it is already
|
||||
* cached in the dns_table (only valid if ERR_OK is returned!)
|
||||
* @param found a callback function to be called on success, failure or timeout (only if
|
||||
* ERR_INPROGRESS is returned!)
|
||||
@ -958,7 +958,7 @@ dns_enqueue(const char *name, dns_found_callback found, void *callback_arg)
|
||||
* @return a err_t return code.
|
||||
*/
|
||||
err_t
|
||||
dns_gethostbyname(const char *hostname, struct ip_addr *addr, dns_found_callback found,
|
||||
dns_gethostbyname(const char *hostname, ip_addr_t *addr, dns_found_callback found,
|
||||
void *callback_arg)
|
||||
{
|
||||
u32_t ipaddr;
|
||||
|
@ -108,7 +108,7 @@
|
||||
static void autoip_handle_arp_conflict(struct netif *netif);
|
||||
|
||||
/* creates a pseudo random LL IP-Address for a network interface */
|
||||
static void autoip_create_addr(struct netif *netif, struct ip_addr *ipaddr);
|
||||
static void autoip_create_addr(struct netif *netif, ip_addr_t *ipaddr);
|
||||
|
||||
/* sends an ARP probe */
|
||||
static err_t autoip_arp_probe(struct netif *netif);
|
||||
@ -171,7 +171,7 @@ autoip_handle_arp_conflict(struct netif *netif)
|
||||
* @param ipaddr ip address to initialize
|
||||
*/
|
||||
static void
|
||||
autoip_create_addr(struct netif *netif, struct ip_addr *ipaddr)
|
||||
autoip_create_addr(struct netif *netif, ip_addr_t *ipaddr)
|
||||
{
|
||||
/* Here we create an IP-Address out of range 169.254.1.0 to 169.254.254.255
|
||||
* compliant to RFC 3927 Section 2.1
|
||||
@ -233,7 +233,7 @@ static err_t
|
||||
autoip_bind(struct netif *netif)
|
||||
{
|
||||
struct autoip *autoip = netif->autoip;
|
||||
struct ip_addr sn_mask, gw_addr;
|
||||
ip_addr_t sn_mask, gw_addr;
|
||||
|
||||
LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE,
|
||||
("autoip_bind(netif=%p) %c%c%"U16_F" %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
|
||||
@ -297,7 +297,7 @@ autoip_start(struct netif *netif)
|
||||
autoip->state = AUTOIP_STATE_OFF;
|
||||
autoip->ttw = 0;
|
||||
autoip->sent_num = 0;
|
||||
memset(&autoip->llipaddr, 0, sizeof(struct ip_addr));
|
||||
memset(&autoip->llipaddr, 0, sizeof(ip_addr_t));
|
||||
autoip->lastconflict = 0;
|
||||
}
|
||||
|
||||
@ -451,7 +451,7 @@ autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr)
|
||||
* when probing ip.dst == llipaddr && hw.src != netif->hwaddr
|
||||
* we have a conflict and must solve it
|
||||
*/
|
||||
struct ip_addr sipaddr, dipaddr;
|
||||
ip_addr_t sipaddr, dipaddr;
|
||||
struct eth_addr netifaddr;
|
||||
netifaddr.addr[0] = netif->hwaddr[0];
|
||||
netifaddr.addr[1] = netif->hwaddr[1];
|
||||
|
@ -82,7 +82,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
||||
#endif /* LWIP_DEBUG */
|
||||
struct icmp_echo_hdr *iecho;
|
||||
struct ip_hdr *iphdr;
|
||||
struct ip_addr tmpaddr;
|
||||
ip_addr_t tmpaddr;
|
||||
s16_t hlen;
|
||||
|
||||
ICMP_STATS_INC(icmp.recv);
|
||||
|
@ -100,8 +100,8 @@ Steve Reynolds
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static struct igmp_group* igmp_group_list;
|
||||
static struct ip_addr allsystems;
|
||||
static struct ip_addr allrouters;
|
||||
static ip_addr_t allsystems;
|
||||
static ip_addr_t allrouters;
|
||||
|
||||
/**
|
||||
* Initialize the IGMP module
|
||||
@ -241,7 +241,7 @@ igmp_report_groups( struct netif *netif)
|
||||
* NULL if the group wasn't found.
|
||||
*/
|
||||
struct igmp_group *
|
||||
igmp_lookfor_group(struct netif *ifp, struct ip_addr *addr)
|
||||
igmp_lookfor_group(struct netif *ifp, ip_addr_t *addr)
|
||||
{
|
||||
struct igmp_group *group = igmp_group_list;
|
||||
|
||||
@ -267,7 +267,7 @@ igmp_lookfor_group(struct netif *ifp, struct ip_addr *addr)
|
||||
* NULL on memory error.
|
||||
*/
|
||||
struct igmp_group *
|
||||
igmp_lookup_group(struct netif *ifp, struct ip_addr *addr)
|
||||
igmp_lookup_group(struct netif *ifp, ip_addr_t *addr)
|
||||
{
|
||||
struct igmp_group *group = igmp_group_list;
|
||||
|
||||
@ -340,7 +340,7 @@ igmp_remove_group(struct igmp_group *group)
|
||||
* @param dest destination ip address of the igmp packet
|
||||
*/
|
||||
void
|
||||
igmp_input(struct pbuf *p, struct netif *inp, struct ip_addr *dest)
|
||||
igmp_input(struct pbuf *p, struct netif *inp, ip_addr_t *dest)
|
||||
{
|
||||
struct ip_hdr * iphdr;
|
||||
struct igmp_msg* igmp;
|
||||
@ -456,7 +456,7 @@ igmp_input(struct pbuf *p, struct netif *inp, struct ip_addr *dest)
|
||||
* @return ERR_OK if group was joined on the netif(s), an err_t otherwise
|
||||
*/
|
||||
err_t
|
||||
igmp_joingroup(struct ip_addr *ifaddr, struct ip_addr *groupaddr)
|
||||
igmp_joingroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr)
|
||||
{
|
||||
err_t err = ERR_VAL; /* no matching interface */
|
||||
struct igmp_group *group;
|
||||
@ -526,7 +526,7 @@ igmp_joingroup(struct ip_addr *ifaddr, struct ip_addr *groupaddr)
|
||||
* @return ERR_OK if group was left on the netif(s), an err_t otherwise
|
||||
*/
|
||||
err_t
|
||||
igmp_leavegroup(struct ip_addr *ifaddr, struct ip_addr *groupaddr)
|
||||
igmp_leavegroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr)
|
||||
{
|
||||
err_t err = ERR_VAL; /* no matching interface */
|
||||
struct igmp_group *group;
|
||||
@ -690,7 +690,7 @@ igmp_delaying_member( struct igmp_group *group, u8_t maxresp)
|
||||
* returns errors returned by netif->output
|
||||
*/
|
||||
err_t
|
||||
igmp_ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
igmp_ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
u8_t ttl, u8_t proto, struct netif *netif)
|
||||
{
|
||||
/* This is the "router alert" option */
|
||||
@ -711,8 +711,8 @@ igmp_send(struct igmp_group *group, u8_t type)
|
||||
{
|
||||
struct pbuf* p = NULL;
|
||||
struct igmp_msg* igmp = NULL;
|
||||
struct ip_addr src = {0};
|
||||
struct ip_addr* dest = NULL;
|
||||
ip_addr_t src = {0};
|
||||
ip_addr_t* dest = NULL;
|
||||
|
||||
/* IP header + "router alert" option + IGMP header */
|
||||
p = pbuf_alloc(PBUF_TRANSPORT, IGMP_MINLEN, PBUF_RAM);
|
||||
|
@ -281,7 +281,7 @@ lwip_standard_chksum(void *dataptr, int len)
|
||||
*/
|
||||
u16_t
|
||||
inet_chksum_pseudo(struct pbuf *p,
|
||||
struct ip_addr *src, struct ip_addr *dest,
|
||||
ip_addr_t *src, ip_addr_t *dest,
|
||||
u8_t proto, u16_t proto_len)
|
||||
{
|
||||
u32_t acc;
|
||||
@ -343,7 +343,7 @@ inet_chksum_pseudo(struct pbuf *p,
|
||||
#if LWIP_UDPLITE
|
||||
u16_t
|
||||
inet_chksum_pseudo_partial(struct pbuf *p,
|
||||
struct ip_addr *src, struct ip_addr *dest,
|
||||
ip_addr_t *src, ip_addr_t *dest,
|
||||
u8_t proto, u16_t proto_len, u16_t chksum_len)
|
||||
{
|
||||
u32_t acc;
|
||||
|
@ -78,7 +78,7 @@ const struct ip_hdr *current_header;
|
||||
* @return the netif on which to send to reach dest
|
||||
*/
|
||||
struct netif *
|
||||
ip_route(struct ip_addr *dest)
|
||||
ip_route(ip_addr_t *dest)
|
||||
{
|
||||
struct netif *netif;
|
||||
|
||||
@ -118,7 +118,7 @@ static struct netif *
|
||||
ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
||||
{
|
||||
struct netif *netif;
|
||||
struct ip_addr dest;
|
||||
ip_addr_t dest;
|
||||
|
||||
PERF_START;
|
||||
dest = iphdr->dest;
|
||||
@ -495,7 +495,7 @@ ip_input(struct pbuf *p, struct netif *inp)
|
||||
* unique identifiers independent of destination"
|
||||
*/
|
||||
err_t
|
||||
ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos,
|
||||
u8_t proto, struct netif *netif)
|
||||
{
|
||||
@ -509,7 +509,7 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *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, struct ip_addr *src, struct ip_addr *dest,
|
||||
err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options,
|
||||
u16_t optlen)
|
||||
{
|
||||
@ -622,7 +622,7 @@ err_t ip_output_if_opt(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest
|
||||
* see ip_output_if() for more return values
|
||||
*/
|
||||
err_t
|
||||
ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
ip_output(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos, u8_t proto)
|
||||
{
|
||||
struct netif *netif;
|
||||
@ -657,7 +657,7 @@ ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
* see ip_output_if() for more return values
|
||||
*/
|
||||
err_t
|
||||
ip_output_hinted(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
ip_output_hinted(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint)
|
||||
{
|
||||
struct netif *netif;
|
||||
|
@ -40,9 +40,9 @@
|
||||
#include "lwip/ip_addr.h"
|
||||
#include "lwip/netif.h"
|
||||
|
||||
/* used by IP_ADDR_ANY and IP_ADDR_BROADCAST in struct ip_addr.h */
|
||||
const struct ip_addr ip_addr_any = { IPADDR_ANY };
|
||||
const struct ip_addr ip_addr_broadcast = { IPADDR_BROADCAST };
|
||||
/* used by IP_ADDR_ANY and IP_ADDR_BROADCAST in ip_addr.h */
|
||||
const ip_addr_t ip_addr_any = { IPADDR_ANY };
|
||||
const ip_addr_t ip_addr_broadcast = { IPADDR_BROADCAST };
|
||||
|
||||
/**
|
||||
* Determine if an address is a broadcast address on a network interface
|
||||
@ -51,7 +51,7 @@ const struct ip_addr ip_addr_broadcast = { IPADDR_BROADCAST };
|
||||
* @param netif the network interface against which the address is checked
|
||||
* @return returns non-zero if the address is a broadcast address
|
||||
*/
|
||||
u8_t ip_addr_isbroadcast(struct ip_addr *addr, struct netif *netif)
|
||||
u8_t ip_addr_isbroadcast(ip_addr_t *addr, struct netif *netif)
|
||||
{
|
||||
u32_t addr2test;
|
||||
|
||||
@ -99,7 +99,7 @@ u8_t ip_addr_isbroadcast(struct ip_addr *addr, struct netif *netif)
|
||||
u32_t
|
||||
ipaddr_addr(const char *cp)
|
||||
{
|
||||
struct ip_addr val;
|
||||
ip_addr_t val;
|
||||
|
||||
if (ipaddr_aton(cp, &val)) {
|
||||
return ip4_addr_get_u32(&val);
|
||||
@ -119,7 +119,7 @@ ipaddr_addr(const char *cp)
|
||||
* @return 1 if cp could be converted to addr, 0 on failure
|
||||
*/
|
||||
int
|
||||
ipaddr_aton(const char *cp, struct ip_addr *addr)
|
||||
ipaddr_aton(const char *cp, ip_addr_t *addr)
|
||||
{
|
||||
u32_t val;
|
||||
u8_t base;
|
||||
@ -220,7 +220,7 @@ ipaddr_aton(const char *cp, struct ip_addr *addr)
|
||||
* represenation of addr
|
||||
*/
|
||||
char *
|
||||
ipaddr_ntoa(struct ip_addr *addr)
|
||||
ipaddr_ntoa(ip_addr_t *addr)
|
||||
{
|
||||
static char str[16];
|
||||
u32_t s_addr;
|
||||
|
@ -629,7 +629,7 @@ static u8_t buf[LWIP_MEM_ALIGN_SIZE(IP_FRAG_MAX_MTU + MEM_ALIGNMENT - 1)];
|
||||
* @return ERR_OK if sent successfully, err_t otherwise
|
||||
*/
|
||||
err_t
|
||||
ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest)
|
||||
ip_frag(struct pbuf *p, struct netif *netif, ip_addr_t *dest)
|
||||
{
|
||||
struct pbuf *rambuf;
|
||||
#if IP_FRAG_USES_STATIC_BUF
|
||||
|
@ -89,8 +89,8 @@ struct netif *netif_default;
|
||||
* @return netif, or NULL if failed.
|
||||
*/
|
||||
struct netif *
|
||||
netif_add(struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask,
|
||||
struct ip_addr *gw, void *state, netif_init_fn init, netif_input_fn input)
|
||||
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)
|
||||
{
|
||||
static u8_t netifnum = 0;
|
||||
|
||||
@ -174,8 +174,8 @@ netif_add(struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask,
|
||||
* @param gw the new default gateway
|
||||
*/
|
||||
void
|
||||
netif_set_addr(struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask,
|
||||
struct ip_addr *gw)
|
||||
netif_set_addr(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
|
||||
ip_addr_t *gw)
|
||||
{
|
||||
netif_set_ipaddr(netif, ipaddr);
|
||||
netif_set_netmask(netif, netmask);
|
||||
@ -271,7 +271,7 @@ netif_find(char *name)
|
||||
* default gateway
|
||||
*/
|
||||
void
|
||||
netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
|
||||
netif_set_ipaddr(struct netif *netif, ip_addr_t *ipaddr)
|
||||
{
|
||||
/* TODO: Handling of obsolete pcbs */
|
||||
/* See: http://mail.gnu.org/archive/html/lwip-users/2003-03/msg00118.html */
|
||||
@ -331,7 +331,7 @@ netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
|
||||
* @note call netif_set_addr() if you also want to change ip address and netmask
|
||||
*/
|
||||
void
|
||||
netif_set_gw(struct netif *netif, struct ip_addr *gw)
|
||||
netif_set_gw(struct netif *netif, 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",
|
||||
@ -352,7 +352,7 @@ netif_set_gw(struct netif *netif, struct ip_addr *gw)
|
||||
* default gateway
|
||||
*/
|
||||
void
|
||||
netif_set_netmask(struct netif *netif, struct ip_addr *netmask)
|
||||
netif_set_netmask(struct netif *netif, ip_addr_t *netmask)
|
||||
{
|
||||
snmp_delete_iprteidx_tree(0, netif);
|
||||
/* set new netmask to netif */
|
||||
@ -530,7 +530,7 @@ void netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_
|
||||
*/
|
||||
err_t
|
||||
netif_loop_output(struct netif *netif, struct pbuf *p,
|
||||
struct ip_addr *ipaddr)
|
||||
ip_addr_t *ipaddr)
|
||||
{
|
||||
struct pbuf *r;
|
||||
err_t err;
|
||||
|
@ -139,7 +139,7 @@ raw_input(struct pbuf *p, struct netif *inp)
|
||||
* @see raw_disconnect()
|
||||
*/
|
||||
err_t
|
||||
raw_bind(struct raw_pcb *pcb, struct ip_addr *ipaddr)
|
||||
raw_bind(struct raw_pcb *pcb, ip_addr_t *ipaddr)
|
||||
{
|
||||
ip_addr_set(&pcb->local_ip, ipaddr);
|
||||
return ERR_OK;
|
||||
@ -159,7 +159,7 @@ raw_bind(struct raw_pcb *pcb, struct ip_addr *ipaddr)
|
||||
* @see raw_disconnect() and raw_sendto()
|
||||
*/
|
||||
err_t
|
||||
raw_connect(struct raw_pcb *pcb, struct ip_addr *ipaddr)
|
||||
raw_connect(struct raw_pcb *pcb, ip_addr_t *ipaddr)
|
||||
{
|
||||
ip_addr_set(&pcb->remote_ip, ipaddr);
|
||||
return ERR_OK;
|
||||
@ -200,11 +200,11 @@ raw_recv(struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg)
|
||||
*
|
||||
*/
|
||||
err_t
|
||||
raw_sendto(struct raw_pcb *pcb, struct pbuf *p, struct ip_addr *ipaddr)
|
||||
raw_sendto(struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr)
|
||||
{
|
||||
err_t err;
|
||||
struct netif *netif;
|
||||
struct ip_addr *src_ip;
|
||||
ip_addr_t *src_ip;
|
||||
struct pbuf *q; /* q will be sent down the stack */
|
||||
|
||||
LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_TRACE, ("raw_sendto\n"));
|
||||
|
@ -1084,7 +1084,7 @@ void snmp_dec_iflist(void)
|
||||
* Inserts ARP table indexes (.xIfIndex.xNetAddress)
|
||||
* into arp table index trees (both atTable and ipNetToMediaTable).
|
||||
*/
|
||||
void snmp_insert_arpidx_tree(struct netif *ni, struct ip_addr *ip)
|
||||
void snmp_insert_arpidx_tree(struct netif *ni, ip_addr_t *ip)
|
||||
{
|
||||
struct mib_list_rootnode *at_rn;
|
||||
struct mib_list_node *at_node;
|
||||
@ -1156,7 +1156,7 @@ void snmp_insert_arpidx_tree(struct netif *ni, struct ip_addr *ip)
|
||||
* Removes ARP table indexes (.xIfIndex.xNetAddress)
|
||||
* from arp table index trees.
|
||||
*/
|
||||
void snmp_delete_arpidx_tree(struct netif *ni, struct ip_addr *ip)
|
||||
void snmp_delete_arpidx_tree(struct netif *ni, ip_addr_t *ip)
|
||||
{
|
||||
struct mib_list_rootnode *at_rn, *next, *del_rn[5];
|
||||
struct mib_list_node *at_n, *del_n[5];
|
||||
@ -1437,7 +1437,7 @@ void snmp_delete_ipaddridx_tree(struct netif *ni)
|
||||
void snmp_insert_iprteidx_tree(u8_t dflt, struct netif *ni)
|
||||
{
|
||||
u8_t insert = 0;
|
||||
struct ip_addr dst;
|
||||
ip_addr_t dst;
|
||||
|
||||
if (dflt != 0)
|
||||
{
|
||||
@ -1514,7 +1514,7 @@ void snmp_insert_iprteidx_tree(u8_t dflt, struct netif *ni)
|
||||
void snmp_delete_iprteidx_tree(u8_t dflt, struct netif *ni)
|
||||
{
|
||||
u8_t del = 0;
|
||||
struct ip_addr dst;
|
||||
ip_addr_t dst;
|
||||
|
||||
if (dflt != 0)
|
||||
{
|
||||
@ -2723,9 +2723,9 @@ atentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
#if LWIP_ARP
|
||||
u8_t id;
|
||||
struct eth_addr* ethaddr_ret;
|
||||
struct ip_addr* ipaddr_ret;
|
||||
ip_addr_t* ipaddr_ret;
|
||||
#endif /* LWIP_ARP */
|
||||
struct ip_addr ip;
|
||||
ip_addr_t ip;
|
||||
struct netif *netif;
|
||||
|
||||
LWIP_UNUSED_ARG(len);
|
||||
@ -2756,7 +2756,7 @@ atentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
break;
|
||||
case 3: /* atNetAddress */
|
||||
{
|
||||
struct ip_addr *dst = (struct ip_addr*)value;
|
||||
ip_addr_t *dst = (ip_addr_t*)value;
|
||||
|
||||
*dst = *ipaddr_ret;
|
||||
}
|
||||
@ -3071,7 +3071,7 @@ ip_addrentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
{
|
||||
u8_t id;
|
||||
u16_t ifidx;
|
||||
struct ip_addr ip;
|
||||
ip_addr_t ip;
|
||||
struct netif *netif = netif_list;
|
||||
|
||||
LWIP_UNUSED_ARG(len);
|
||||
@ -3091,7 +3091,7 @@ ip_addrentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
{
|
||||
case 1: /* ipAdEntAddr */
|
||||
{
|
||||
struct ip_addr *dst = (struct ip_addr*)value;
|
||||
ip_addr_t *dst = (ip_addr_t*)value;
|
||||
*dst = netif->ip_addr;
|
||||
}
|
||||
break;
|
||||
@ -3103,7 +3103,7 @@ ip_addrentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
break;
|
||||
case 3: /* ipAdEntNetMask */
|
||||
{
|
||||
struct ip_addr *dst = (struct ip_addr*)value;
|
||||
ip_addr_t *dst = (ip_addr_t*)value;
|
||||
*dst = netif->netmask;
|
||||
}
|
||||
break;
|
||||
@ -3211,7 +3211,7 @@ static void
|
||||
ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
{
|
||||
struct netif *netif;
|
||||
struct ip_addr dest;
|
||||
ip_addr_t dest;
|
||||
s32_t *ident;
|
||||
u8_t id;
|
||||
|
||||
@ -3241,7 +3241,7 @@ ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
{
|
||||
case 1: /* ipRouteDest */
|
||||
{
|
||||
struct ip_addr *dst = (struct ip_addr*)value;
|
||||
ip_addr_t *dst = (ip_addr_t*)value;
|
||||
|
||||
if (ip_addr_isany(&dest))
|
||||
{
|
||||
@ -3290,7 +3290,7 @@ ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
break;
|
||||
case 7: /* ipRouteNextHop */
|
||||
{
|
||||
struct ip_addr *dst = (struct ip_addr*)value;
|
||||
ip_addr_t *dst = (ip_addr_t*)value;
|
||||
|
||||
if (ip_addr_isany(&dest))
|
||||
{
|
||||
@ -3337,7 +3337,7 @@ ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
break;
|
||||
case 11: /* ipRouteMask */
|
||||
{
|
||||
struct ip_addr *dst = (struct ip_addr*)value;
|
||||
ip_addr_t *dst = (ip_addr_t*)value;
|
||||
|
||||
if (ip_addr_isany(&dest))
|
||||
{
|
||||
@ -3414,9 +3414,9 @@ ip_ntomentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
#if LWIP_ARP
|
||||
u8_t id;
|
||||
struct eth_addr* ethaddr_ret;
|
||||
struct ip_addr* ipaddr_ret;
|
||||
ip_addr_t* ipaddr_ret;
|
||||
#endif /* LWIP_ARP */
|
||||
struct ip_addr ip;
|
||||
ip_addr_t ip;
|
||||
struct netif *netif;
|
||||
|
||||
LWIP_UNUSED_ARG(len);
|
||||
@ -3447,7 +3447,7 @@ ip_ntomentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
break;
|
||||
case 3: /* ipNetToMediaNetAddress */
|
||||
{
|
||||
struct ip_addr *dst = (struct ip_addr*)value;
|
||||
ip_addr_t *dst = (ip_addr_t*)value;
|
||||
|
||||
*dst = *ipaddr_ret;
|
||||
}
|
||||
@ -3772,7 +3772,7 @@ tcpconnentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
|
||||
static void
|
||||
tcpconnentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
{
|
||||
struct ip_addr lip, rip;
|
||||
ip_addr_t lip, rip;
|
||||
u16_t lport, rport;
|
||||
s32_t *ident;
|
||||
|
||||
@ -3881,7 +3881,7 @@ udpentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
{
|
||||
u8_t id;
|
||||
struct udp_pcb *pcb;
|
||||
struct ip_addr ip;
|
||||
ip_addr_t ip;
|
||||
u16_t port;
|
||||
|
||||
LWIP_UNUSED_ARG(len);
|
||||
@ -3905,7 +3905,7 @@ udpentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
{
|
||||
case 1: /* udpLocalAddress */
|
||||
{
|
||||
struct ip_addr *dst = (struct ip_addr*)value;
|
||||
ip_addr_t *dst = (ip_addr_t*)value;
|
||||
*dst = pcb->local_ip;
|
||||
}
|
||||
break;
|
||||
|
@ -133,7 +133,7 @@ snmp_netiftoifindex(struct netif *netif, s32_t *ifidx)
|
||||
* @param ip points to output struct
|
||||
*/
|
||||
void
|
||||
snmp_oidtoip(s32_t *ident, struct ip_addr *ip)
|
||||
snmp_oidtoip(s32_t *ident, ip_addr_t *ip)
|
||||
{
|
||||
IP4_ADDR(ip, ident[0], ident[1], ident[2], ident[3]);
|
||||
}
|
||||
@ -144,7 +144,7 @@ snmp_oidtoip(s32_t *ident, struct ip_addr *ip)
|
||||
* @param ident points to s32_t ident[4] output
|
||||
*/
|
||||
void
|
||||
snmp_iptooid(struct ip_addr *ip, s32_t *ident)
|
||||
snmp_iptooid(ip_addr_t *ip, s32_t *ident)
|
||||
{
|
||||
ident[0] = ip4_addr1(ip);
|
||||
ident[1] = ip4_addr2(ip);
|
||||
|
@ -58,7 +58,7 @@ struct snmp_msg_pstat msg_input_list[SNMP_CONCURRENT_REQUESTS];
|
||||
/* UDP Protocol Control Block */
|
||||
struct udp_pcb *snmp1_pcb;
|
||||
|
||||
static void snmp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port);
|
||||
static void snmp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port);
|
||||
static err_t snmp_pdu_header_check(struct pbuf *p, u16_t ofs, u16_t pdu_len, u16_t *ofs_ret, struct snmp_msg_pstat *m_stat);
|
||||
static err_t snmp_pdu_dec_varbindlist(struct pbuf *p, u16_t ofs, u16_t *ofs_ret, struct snmp_msg_pstat *m_stat);
|
||||
|
||||
@ -806,7 +806,7 @@ snmp_msg_event(u8_t request_id)
|
||||
|
||||
/* lwIP UDP receive callback function */
|
||||
static void
|
||||
snmp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port)
|
||||
snmp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port)
|
||||
{
|
||||
struct snmp_msg_pstat *msg_ps;
|
||||
u8_t req_idx;
|
||||
|
@ -55,7 +55,7 @@
|
||||
struct snmp_trap_dst
|
||||
{
|
||||
/* destination IP address in network order */
|
||||
struct ip_addr dip;
|
||||
ip_addr_t dip;
|
||||
/* set to 0 when disabled, >0 when enabled */
|
||||
u8_t enable;
|
||||
};
|
||||
@ -92,7 +92,7 @@ snmp_trap_dst_enable(u8_t dst_idx, u8_t enable)
|
||||
* @param dst IPv4 address in host order.
|
||||
*/
|
||||
void
|
||||
snmp_trap_dst_ip_set(u8_t dst_idx, struct ip_addr *dst)
|
||||
snmp_trap_dst_ip_set(u8_t dst_idx, ip_addr_t *dst)
|
||||
{
|
||||
if (dst_idx < SNMP_TRAP_DESTINATIONS)
|
||||
{
|
||||
@ -221,7 +221,7 @@ snmp_send_trap(s8_t generic_trap, struct snmp_obj_id *eoid, s32_t specific_trap)
|
||||
{
|
||||
struct snmp_trap_dst *td;
|
||||
struct netif *dst_if;
|
||||
struct ip_addr dst_ip;
|
||||
ip_addr_t dst_ip;
|
||||
struct pbuf *p;
|
||||
u16_t i,tot_len;
|
||||
|
||||
|
@ -216,7 +216,7 @@ tcp_abandon(struct tcp_pcb *pcb, int reset)
|
||||
{
|
||||
u32_t seqno, ackno;
|
||||
u16_t remote_port, local_port;
|
||||
struct ip_addr remote_ip, local_ip;
|
||||
ip_addr_t remote_ip, local_ip;
|
||||
#if LWIP_CALLBACK_API
|
||||
tcp_err_fn errf;
|
||||
#endif /* LWIP_CALLBACK_API */
|
||||
@ -275,7 +275,7 @@ tcp_abandon(struct tcp_pcb *pcb, int reset)
|
||||
* ERR_OK if bound
|
||||
*/
|
||||
err_t
|
||||
tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
||||
tcp_bind(struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port)
|
||||
{
|
||||
struct tcp_pcb *cpcb;
|
||||
|
||||
@ -517,7 +517,7 @@ tcp_new_port(void)
|
||||
* other err_t values if connect request couldn't be sent
|
||||
*/
|
||||
err_t
|
||||
tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,
|
||||
tcp_connect(struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port,
|
||||
tcp_connected_fn connected)
|
||||
{
|
||||
err_t ret;
|
||||
@ -1311,7 +1311,7 @@ tcp_next_iss(void)
|
||||
* calculating the minimum of TCP_MSS and that netif's mtu (if set).
|
||||
*/
|
||||
u16_t
|
||||
tcp_eff_send_mss(u16_t sendmss, struct ip_addr *addr)
|
||||
tcp_eff_send_mss(u16_t sendmss, ip_addr_t *addr)
|
||||
{
|
||||
u16_t mss_s;
|
||||
struct netif *outif;
|
||||
|
@ -131,11 +131,10 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
|
||||
#if CHECKSUM_CHECK_TCP
|
||||
/* Verify TCP checksum. */
|
||||
if (inet_chksum_pseudo(p, (struct ip_addr *)&(iphdr->src),
|
||||
(struct ip_addr *)&(iphdr->dest),
|
||||
if (inet_chksum_pseudo(p, &iphdr->src, &iphdr->dest,
|
||||
IP_PROTO_TCP, p->tot_len) != 0) {
|
||||
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packet discarded due to failing checksum 0x%04"X16_F"\n",
|
||||
inet_chksum_pseudo(p, (struct ip_addr *)&(iphdr->src), (struct ip_addr *)&(iphdr->dest),
|
||||
inet_chksum_pseudo(p, &iphdr->src, &iphdr->dest,
|
||||
IP_PROTO_TCP, p->tot_len)));
|
||||
#if TCP_DEBUG
|
||||
tcp_debug_print(tcphdr);
|
||||
|
@ -767,7 +767,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb)
|
||||
*/
|
||||
void
|
||||
tcp_rst(u32_t seqno, u32_t ackno,
|
||||
struct ip_addr *local_ip, struct ip_addr *remote_ip,
|
||||
ip_addr_t *local_ip, ip_addr_t *remote_ip,
|
||||
u16_t local_port, u16_t remote_port)
|
||||
{
|
||||
struct pbuf *p;
|
||||
|
@ -237,8 +237,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (inet_chksum_pseudo_partial(p, (struct ip_addr *)&(iphdr->src),
|
||||
(struct ip_addr *)&(iphdr->dest),
|
||||
if (inet_chksum_pseudo_partial(p, &iphdr->src, &iphdr->dest,
|
||||
IP_PROTO_UDPLITE, p->tot_len, chklen) != 0) {
|
||||
LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_LEVEL_SERIOUS,
|
||||
("udp_input: UDP Lite datagram discarded due to failing checksum\n"));
|
||||
@ -254,8 +253,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
||||
{
|
||||
#if CHECKSUM_CHECK_UDP
|
||||
if (udphdr->chksum != 0) {
|
||||
if (inet_chksum_pseudo(p, (struct ip_addr *)&(iphdr->src),
|
||||
(struct ip_addr *)&(iphdr->dest),
|
||||
if (inet_chksum_pseudo(p, &iphdr->src, &iphdr->dest,
|
||||
IP_PROTO_UDP, p->tot_len) != 0) {
|
||||
LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_LEVEL_SERIOUS,
|
||||
("udp_input: UDP datagram discarded due to failing checksum\n"));
|
||||
@ -357,7 +355,7 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
||||
*/
|
||||
err_t
|
||||
udp_sendto(struct udp_pcb *pcb, struct pbuf *p,
|
||||
struct ip_addr *dst_ip, u16_t dst_port)
|
||||
ip_addr_t *dst_ip, u16_t dst_port)
|
||||
{
|
||||
struct netif *netif;
|
||||
|
||||
@ -401,10 +399,10 @@ udp_sendto(struct udp_pcb *pcb, struct pbuf *p,
|
||||
*/
|
||||
err_t
|
||||
udp_sendto_if(struct udp_pcb *pcb, struct pbuf *p,
|
||||
struct ip_addr *dst_ip, u16_t dst_port, struct netif *netif)
|
||||
ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif)
|
||||
{
|
||||
struct udp_hdr *udphdr;
|
||||
struct ip_addr *src_ip;
|
||||
ip_addr_t *src_ip;
|
||||
err_t err;
|
||||
struct pbuf *q; /* q will be sent down the stack */
|
||||
|
||||
@ -579,7 +577,7 @@ udp_sendto_if(struct udp_pcb *pcb, struct pbuf *p,
|
||||
* @see udp_disconnect()
|
||||
*/
|
||||
err_t
|
||||
udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
||||
udp_bind(struct udp_pcb *pcb, ip_addr_t *ipaddr, u16_t port)
|
||||
{
|
||||
struct udp_pcb *ipcb;
|
||||
u8_t rebind;
|
||||
@ -680,7 +678,7 @@ udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
||||
* @see udp_disconnect()
|
||||
*/
|
||||
err_t
|
||||
udp_connect(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
||||
udp_connect(struct udp_pcb *pcb, ip_addr_t *ipaddr, u16_t port)
|
||||
{
|
||||
struct udp_pcb *ipcb;
|
||||
|
||||
|
@ -80,7 +80,7 @@ extern "C" {
|
||||
|
||||
struct autoip
|
||||
{
|
||||
struct ip_addr llipaddr; /* the currently selected, probed, announced or used LL IP-Address */
|
||||
ip_addr_t llipaddr; /* the currently selected, probed, announced or used LL IP-Address */
|
||||
u8_t state; /* current AutoIP state machine state */
|
||||
u8_t sent_num; /* sent number of probes or announces, dependent on state */
|
||||
u16_t ttw; /* ticks to wait, tick is AUTOIP_TMR_INTERVAL long */
|
||||
|
@ -88,7 +88,7 @@ struct igmp_msg {
|
||||
PACK_STRUCT_FIELD(u8_t igmp_msgtype);
|
||||
PACK_STRUCT_FIELD(u8_t igmp_maxresp);
|
||||
PACK_STRUCT_FIELD(u16_t igmp_checksum);
|
||||
PACK_STRUCT_FIELD(struct ip_addr igmp_group_address);
|
||||
PACK_STRUCT_FIELD(ip_addr_t igmp_group_address);
|
||||
} PACK_STRUCT_STRUCT;
|
||||
PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
@ -109,7 +109,7 @@ PACK_STRUCT_END
|
||||
struct igmp_group {
|
||||
struct igmp_group *next;
|
||||
struct netif *netif;
|
||||
struct ip_addr group_address;
|
||||
ip_addr_t group_address;
|
||||
u8_t last_reporter_flag; /* signifies we were the last person to report */
|
||||
u8_t group_state;
|
||||
u16_t timer;
|
||||
@ -122,18 +122,18 @@ void igmp_init(void);
|
||||
err_t igmp_start( struct netif *netif);
|
||||
err_t igmp_stop( struct netif *netif);
|
||||
void igmp_report_groups( struct netif *netif);
|
||||
struct igmp_group *igmp_lookfor_group( struct netif *ifp, struct ip_addr *addr);
|
||||
struct igmp_group *igmp_lookup_group( struct netif *ifp, struct ip_addr *addr);
|
||||
struct igmp_group *igmp_lookfor_group( struct netif *ifp, ip_addr_t *addr);
|
||||
struct igmp_group *igmp_lookup_group( struct netif *ifp, ip_addr_t *addr);
|
||||
err_t igmp_remove_group( struct igmp_group *group);
|
||||
void igmp_input( struct pbuf *p, struct netif *inp, struct ip_addr *dest);
|
||||
err_t igmp_joingroup( struct ip_addr *ifaddr, struct ip_addr *groupaddr);
|
||||
err_t igmp_leavegroup( struct ip_addr *ifaddr, struct ip_addr *groupaddr);
|
||||
void igmp_input( struct pbuf *p, struct netif *inp, ip_addr_t *dest);
|
||||
err_t igmp_joingroup( ip_addr_t *ifaddr, ip_addr_t *groupaddr);
|
||||
err_t igmp_leavegroup( ip_addr_t *ifaddr, ip_addr_t *groupaddr);
|
||||
void igmp_tmr(void);
|
||||
void igmp_timeout( struct igmp_group *group);
|
||||
void igmp_start_timer( struct igmp_group *group, u8_t max_time);
|
||||
void igmp_stop_timer( struct igmp_group *group);
|
||||
void igmp_delaying_member( struct igmp_group *group, u8_t maxresp);
|
||||
err_t igmp_ip_output_if( struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, u8_t ttl, u8_t proto, struct netif *netif);
|
||||
err_t igmp_ip_output_if( struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, u8_t ttl, u8_t proto, struct netif *netif);
|
||||
void igmp_send( struct igmp_group *group, u8_t type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -94,8 +94,8 @@ 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, (struct ip_addr*)addr)
|
||||
#define inet_ntoa(addr) ipaddr_ntoa((struct ip_addr*)&(addr))
|
||||
#define inet_aton(cp, addr) ipaddr_aton(cp, (ip_addr_t*)addr)
|
||||
#define inet_ntoa(addr) ipaddr_ntoa((ip_addr_t*)&(addr))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -44,11 +44,11 @@ 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,
|
||||
struct ip_addr *src, struct ip_addr *dest,
|
||||
ip_addr_t *src, ip_addr_t *dest,
|
||||
u8_t proto, u16_t proto_len);
|
||||
#if LWIP_UDPLITE
|
||||
u16_t inet_chksum_pseudo_partial(struct pbuf *p,
|
||||
struct ip_addr *src, struct ip_addr *dest,
|
||||
ip_addr_t *src, ip_addr_t *dest,
|
||||
u8_t proto, u16_t proto_len, u16_t chksum_len);
|
||||
#endif
|
||||
|
||||
|
@ -74,8 +74,8 @@ extern "C" {
|
||||
having to change all PCB structs. */
|
||||
#define IP_PCB \
|
||||
/* ip addresses in network byte order */ \
|
||||
struct ip_addr local_ip; \
|
||||
struct ip_addr remote_ip; \
|
||||
ip_addr_t local_ip; \
|
||||
ip_addr_t remote_ip; \
|
||||
/* Socket options */ \
|
||||
u16_t so_options; \
|
||||
/* Type Of Service */ \
|
||||
@ -127,8 +127,8 @@ struct ip_hdr {
|
||||
/* checksum */
|
||||
PACK_STRUCT_FIELD(u16_t _chksum);
|
||||
/* source and destination IP addresses */
|
||||
PACK_STRUCT_FIELD(struct ip_addr src);
|
||||
PACK_STRUCT_FIELD(struct ip_addr dest);
|
||||
PACK_STRUCT_FIELD(ip_addr_t src);
|
||||
PACK_STRUCT_FIELD(ip_addr_t dest);
|
||||
} PACK_STRUCT_STRUCT;
|
||||
PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
@ -160,19 +160,19 @@ extern struct netif *current_netif;
|
||||
extern const struct ip_hdr *current_header;
|
||||
|
||||
#define ip_init() /* Compatibility define, not init needed. */
|
||||
struct netif *ip_route(struct ip_addr *dest);
|
||||
struct netif *ip_route(ip_addr_t *dest);
|
||||
err_t ip_input(struct pbuf *p, struct netif *inp);
|
||||
err_t ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
err_t ip_output(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
u8_t ttl, u8_t tos, u8_t proto);
|
||||
err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
err_t ip_output_if(struct pbuf *p, ip_addr_t *src, 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, struct ip_addr *src, struct ip_addr *dest,
|
||||
err_t ip_output_hinted(struct pbuf *p, ip_addr_t *src, 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, struct ip_addr *src, struct ip_addr *dest,
|
||||
err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, 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 */
|
||||
|
@ -43,7 +43,7 @@ extern "C" {
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
PACK_STRUCT_BEGIN
|
||||
struct ip_addr {
|
||||
struct _ip_addr {
|
||||
PACK_STRUCT_FIELD(u32_t addr);
|
||||
} PACK_STRUCT_STRUCT;
|
||||
PACK_STRUCT_END
|
||||
@ -51,6 +51,8 @@ PACK_STRUCT_END
|
||||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
|
||||
typedef struct _ip_addr ip_addr_t;
|
||||
|
||||
/*
|
||||
* struct ipaddr2 is used in the definition of the ARP packet format in
|
||||
* order to support compilers that don't have structure packing.
|
||||
@ -70,14 +72,14 @@ PACK_STRUCT_END
|
||||
/* Forward declaration to not include netif.h */
|
||||
struct netif;
|
||||
|
||||
extern const struct ip_addr ip_addr_any;
|
||||
extern const struct ip_addr ip_addr_broadcast;
|
||||
extern const ip_addr_t ip_addr_any;
|
||||
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 ((struct ip_addr *)&ip_addr_any)
|
||||
#define IP_ADDR_BROADCAST ((struct ip_addr *)&ip_addr_broadcast)
|
||||
#define IP_ADDR_ANY ((ip_addr_t *)&ip_addr_any)
|
||||
#define IP_ADDR_BROADCAST ((ip_addr_t *)&ip_addr_broadcast)
|
||||
|
||||
/** 255.255.255.255 */
|
||||
#define IPADDR_NONE ((u32_t)0xffffffffUL)
|
||||
@ -164,7 +166,7 @@ extern const struct ip_addr ip_addr_broadcast;
|
||||
|
||||
#define ip_addr_isany(addr1) ((addr1) == NULL || (addr1)->addr == 0)
|
||||
|
||||
u8_t ip_addr_isbroadcast(struct ip_addr *, struct netif *);
|
||||
u8_t ip_addr_isbroadcast(ip_addr_t *, struct netif *);
|
||||
|
||||
#define ip_addr_ismulticast(addr1) (((addr1)->addr & ntohl(0xf0000000UL)) == ntohl(0xe0000000UL))
|
||||
|
||||
@ -197,9 +199,9 @@ u8_t ip_addr_isbroadcast(struct ip_addr *, struct netif *);
|
||||
#define ip_ntoa(ipaddr) ipaddr_ntoa(ipaddr)
|
||||
|
||||
u32_t ipaddr_addr(const char *cp);
|
||||
int ipaddr_aton(const char *cp, struct ip_addr *addr);
|
||||
int ipaddr_aton(const char *cp, ip_addr_t *addr);
|
||||
/** returns ptr to static buffer; not reentrant! */
|
||||
char *ipaddr_ntoa(struct ip_addr *addr);
|
||||
char *ipaddr_ntoa(ip_addr_t *addr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ struct pbuf * ip_reass(struct pbuf *p);
|
||||
#endif /* IP_REASSEMBLY */
|
||||
|
||||
#if IP_FRAG
|
||||
err_t ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest);
|
||||
err_t ip_frag(struct pbuf *p, struct netif *netif, ip_addr_t *dest);
|
||||
#endif /* IP_FRAG */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -196,31 +196,31 @@ err_t netconn_delete(struct netconn *conn);
|
||||
/** Get the type of a netconn (as enum netconn_type). */
|
||||
#define netconn_type(conn) (conn->type)
|
||||
|
||||
err_t netconn_getaddr(struct netconn *conn, struct ip_addr *addr,
|
||||
err_t netconn_getaddr(struct netconn *conn, ip_addr_t *addr,
|
||||
u16_t *port, u8_t local);
|
||||
#define netconn_peer(c,i,p) netconn_getaddr(c,i,p,0)
|
||||
#define netconn_addr(c,i,p) netconn_getaddr(c,i,p,1)
|
||||
|
||||
err_t netconn_bind(struct netconn *conn, struct ip_addr *addr, u16_t port);
|
||||
err_t netconn_connect(struct netconn *conn, struct ip_addr *addr, u16_t port);
|
||||
err_t netconn_bind(struct netconn *conn, ip_addr_t *addr, u16_t port);
|
||||
err_t netconn_connect(struct netconn *conn, ip_addr_t *addr, u16_t port);
|
||||
err_t netconn_disconnect (struct netconn *conn);
|
||||
err_t netconn_listen_with_backlog(struct netconn *conn, u8_t backlog);
|
||||
#define netconn_listen(conn) netconn_listen_with_backlog(conn, TCP_DEFAULT_LISTEN_BACKLOG)
|
||||
err_t netconn_accept(struct netconn *conn, struct netconn **new_conn);
|
||||
err_t netconn_recv(struct netconn *conn, struct netbuf **new_buf);
|
||||
err_t netconn_sendto(struct netconn *conn, struct netbuf *buf,
|
||||
struct ip_addr *addr, u16_t port);
|
||||
ip_addr_t *addr, u16_t port);
|
||||
err_t netconn_send(struct netconn *conn, struct netbuf *buf);
|
||||
err_t netconn_write(struct netconn *conn, const void *dataptr, size_t size,
|
||||
u8_t apiflags);
|
||||
err_t netconn_close(struct netconn *conn);
|
||||
|
||||
#if LWIP_IGMP
|
||||
err_t netconn_join_leave_group(struct netconn *conn, struct ip_addr *multiaddr,
|
||||
struct ip_addr *netif_addr, enum netconn_igmp join_or_leave);
|
||||
err_t netconn_join_leave_group(struct netconn *conn, ip_addr_t *multiaddr,
|
||||
ip_addr_t *netif_addr, enum netconn_igmp join_or_leave);
|
||||
#endif /* LWIP_IGMP */
|
||||
#if LWIP_DNS
|
||||
err_t netconn_gethostbyname(const char *name, struct ip_addr *addr);
|
||||
err_t netconn_gethostbyname(const char *name, ip_addr_t *addr);
|
||||
#endif /* LWIP_DNS */
|
||||
|
||||
#define netconn_err(conn) ((conn)->last_err)
|
||||
|
@ -70,12 +70,12 @@ struct api_msg_msg {
|
||||
} n;
|
||||
/** used for do_bind and do_connect */
|
||||
struct {
|
||||
struct ip_addr *ipaddr;
|
||||
ip_addr_t *ipaddr;
|
||||
u16_t port;
|
||||
} bc;
|
||||
/** used for do_getaddr */
|
||||
struct {
|
||||
struct ip_addr *ipaddr;
|
||||
ip_addr_t *ipaddr;
|
||||
u16_t *port;
|
||||
u8_t local;
|
||||
} ad;
|
||||
@ -92,8 +92,8 @@ struct api_msg_msg {
|
||||
#if LWIP_IGMP
|
||||
/** used for do_join_leave_group */
|
||||
struct {
|
||||
struct ip_addr *multiaddr;
|
||||
struct ip_addr *netif_addr;
|
||||
ip_addr_t *multiaddr;
|
||||
ip_addr_t *netif_addr;
|
||||
enum netconn_igmp join_or_leave;
|
||||
} jl;
|
||||
#endif /* LWIP_IGMP */
|
||||
@ -124,7 +124,7 @@ struct dns_api_msg {
|
||||
/** Hostname to query or dotted IP address string */
|
||||
const char *name;
|
||||
/** Rhe resolved address is stored here */
|
||||
struct ip_addr *addr;
|
||||
ip_addr_t *addr;
|
||||
/** This semaphore is posted when the name is resolved, the application thread
|
||||
should wait on it. */
|
||||
sys_sem_t sem;
|
||||
|
@ -49,10 +49,10 @@ struct dhcp
|
||||
u16_t request_timeout; /* #ticks with period DHCP_FINE_TIMER_SECS for request timeout */
|
||||
u16_t t1_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for renewal time */
|
||||
u16_t t2_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for rebind time */
|
||||
struct ip_addr server_ip_addr; /* dhcp server address that offered this lease */
|
||||
struct ip_addr offered_ip_addr;
|
||||
struct ip_addr offered_sn_mask;
|
||||
struct ip_addr offered_gw_addr;
|
||||
ip_addr_t server_ip_addr; /* dhcp server address that offered this lease */
|
||||
ip_addr_t offered_ip_addr;
|
||||
ip_addr_t offered_sn_mask;
|
||||
ip_addr_t offered_gw_addr;
|
||||
|
||||
u32_t offered_t0_lease; /* lease period (in seconds) */
|
||||
u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */
|
||||
@ -60,7 +60,7 @@ struct dhcp
|
||||
/* @todo: LWIP_DHCP_BOOTP_FILE configuration option?
|
||||
integrate with possible TFTP-client for booting? */
|
||||
#if LWIP_DHCP_BOOTP_FILE
|
||||
struct ip_addr offered_si_addr;
|
||||
ip_addr_t offered_si_addr;
|
||||
char boot_file_name[DHCP_FILE_LEN];
|
||||
#endif /* LWIP_DHCP_BOOTPFILE */
|
||||
};
|
||||
@ -80,10 +80,10 @@ struct dhcp_msg
|
||||
PACK_STRUCT_FIELD(u32_t xid);
|
||||
PACK_STRUCT_FIELD(u16_t secs);
|
||||
PACK_STRUCT_FIELD(u16_t flags);
|
||||
PACK_STRUCT_FIELD(struct ip_addr ciaddr);
|
||||
PACK_STRUCT_FIELD(struct ip_addr yiaddr);
|
||||
PACK_STRUCT_FIELD(struct ip_addr siaddr);
|
||||
PACK_STRUCT_FIELD(struct ip_addr giaddr);
|
||||
PACK_STRUCT_FIELD(ip_addr_t ciaddr);
|
||||
PACK_STRUCT_FIELD(ip_addr_t yiaddr);
|
||||
PACK_STRUCT_FIELD(ip_addr_t siaddr);
|
||||
PACK_STRUCT_FIELD(ip_addr_t giaddr);
|
||||
PACK_STRUCT_FIELD(u8_t chaddr[DHCP_CHADDR_LEN]);
|
||||
PACK_STRUCT_FIELD(u8_t sname[DHCP_SNAME_LEN]);
|
||||
PACK_STRUCT_FIELD(u8_t file[DHCP_FILE_LEN]);
|
||||
@ -120,7 +120,7 @@ void dhcp_network_changed(struct netif *netif);
|
||||
|
||||
/** if enabled, check whether the offered IP address is not in use, using ARP */
|
||||
#if DHCP_DOES_ARP_CHECK
|
||||
void dhcp_arp_reply(struct netif *netif, struct ip_addr *addr);
|
||||
void dhcp_arp_reply(struct netif *netif, ip_addr_t *addr);
|
||||
#endif
|
||||
|
||||
/** to be called every minute */
|
||||
|
@ -76,22 +76,22 @@
|
||||
/** Callback which is invoked when a hostname is found.
|
||||
* A function of this type must be implemented by the application using the DNS resolver.
|
||||
* @param name pointer to the name that was looked up.
|
||||
* @param ipaddr pointer to a struct ip_addr containing the IP address of the hostname,
|
||||
* @param ipaddr pointer to an ip_addr_t containing the IP address of the hostname,
|
||||
* or NULL if the name could not be found (or on any other error).
|
||||
* @param callback_arg a user-specified callback argument passed to dns_gethostbyname
|
||||
*/
|
||||
typedef void (*dns_found_callback)(const char *name, struct ip_addr *ipaddr, void *callback_arg);
|
||||
typedef void (*dns_found_callback)(const char *name, ip_addr_t *ipaddr, void *callback_arg);
|
||||
|
||||
void dns_init(void);
|
||||
void dns_tmr(void);
|
||||
void dns_setserver(u8_t numdns, struct ip_addr *dnsserver);
|
||||
struct ip_addr dns_getserver(u8_t numdns);
|
||||
err_t dns_gethostbyname(const char *hostname, struct ip_addr *addr,
|
||||
void dns_setserver(u8_t numdns, ip_addr_t *dnsserver);
|
||||
ip_addr_t dns_getserver(u8_t numdns);
|
||||
err_t dns_gethostbyname(const char *hostname, ip_addr_t *addr,
|
||||
dns_found_callback found, void *callback_arg);
|
||||
|
||||
#if DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC
|
||||
int dns_local_removehost(const char *hostname, const struct ip_addr *addr);
|
||||
err_t dns_local_addhost(const char *hostname, const struct ip_addr *addr);
|
||||
int dns_local_removehost(const char *hostname, const ip_addr_t *addr);
|
||||
err_t dns_local_addhost(const char *hostname, const ip_addr_t *addr);
|
||||
#endif /* DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
|
||||
|
||||
#endif /* LWIP_DNS */
|
||||
|
@ -42,10 +42,10 @@ extern "C" {
|
||||
|
||||
struct netbuf {
|
||||
struct pbuf *p, *ptr;
|
||||
struct ip_addr *addr;
|
||||
ip_addr_t *addr;
|
||||
u16_t port;
|
||||
#if LWIP_NETBUF_RECVINFO
|
||||
struct ip_addr *toaddr;
|
||||
ip_addr_t *toaddr;
|
||||
u16_t toport;
|
||||
#endif /* LWIP_NETBUF_RECVINFO */
|
||||
};
|
||||
|
@ -103,7 +103,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,
|
||||
struct ip_addr *ipaddr);
|
||||
ip_addr_t *ipaddr);
|
||||
/** Function prototype for netif->linkoutput functions. Only used for ethernet
|
||||
* netifs. This function is called by ARP when a packet shall be sent.
|
||||
*
|
||||
@ -115,7 +115,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,
|
||||
struct ip_addr *group, u8_t action);
|
||||
ip_addr_t *group, u8_t action);
|
||||
|
||||
/** Generic data structure used for all lwIP network interfaces.
|
||||
* The following fields should be filled in by the initialization
|
||||
@ -125,9 +125,9 @@ struct netif {
|
||||
struct netif *next;
|
||||
|
||||
/** IP address configuration in network byte order */
|
||||
struct ip_addr ip_addr;
|
||||
struct ip_addr netmask;
|
||||
struct ip_addr gw;
|
||||
ip_addr_t ip_addr;
|
||||
ip_addr_t netmask;
|
||||
ip_addr_t gw;
|
||||
|
||||
/** This function is called by the network device driver
|
||||
* to pass a packet up the TCP/IP stack. */
|
||||
@ -239,12 +239,12 @@ extern struct netif *netif_default;
|
||||
|
||||
#define netif_init() /* Compatibility define, no init needed. */
|
||||
|
||||
struct netif *netif_add(struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask,
|
||||
struct ip_addr *gw, void *state, netif_init_fn init, netif_input_fn input);
|
||||
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);
|
||||
|
||||
void
|
||||
netif_set_addr(struct netif *netif,struct ip_addr *ipaddr, struct ip_addr *netmask,
|
||||
struct ip_addr *gw);
|
||||
netif_set_addr(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
|
||||
ip_addr_t *gw);
|
||||
void netif_remove(struct netif * netif);
|
||||
|
||||
/* Returns a network interface given its name. The name is of the form
|
||||
@ -255,9 +255,9 @@ struct netif *netif_find(char *name);
|
||||
|
||||
void netif_set_default(struct netif *netif);
|
||||
|
||||
void netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr);
|
||||
void netif_set_netmask(struct netif *netif, struct ip_addr *netmask);
|
||||
void netif_set_gw(struct netif *netif, struct ip_addr *gw);
|
||||
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_up(struct netif *netif);
|
||||
void netif_set_down(struct netif *netif);
|
||||
@ -281,7 +281,7 @@ void netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_
|
||||
#endif /* LWIP_NETIF_LINK_CALLBACK */
|
||||
|
||||
#if ENABLE_LOOPBACK
|
||||
err_t netif_loop_output(struct netif *netif, struct pbuf *p, struct ip_addr *dest_ip);
|
||||
err_t netif_loop_output(struct netif *netif, struct pbuf *p, ip_addr_t *dest_ip);
|
||||
void netif_poll(struct netif *netif);
|
||||
#if !LWIP_NETIF_LOOPBACK_MULTITHREADING
|
||||
void netif_poll_all(void);
|
||||
|
@ -52,9 +52,9 @@ struct netifapi_msg_msg {
|
||||
struct netif *netif;
|
||||
union {
|
||||
struct {
|
||||
struct ip_addr *ipaddr;
|
||||
struct ip_addr *netmask;
|
||||
struct ip_addr *gw;
|
||||
ip_addr_t *ipaddr;
|
||||
ip_addr_t *netmask;
|
||||
ip_addr_t *gw;
|
||||
void *state;
|
||||
netif_init_fn init;
|
||||
netif_input_fn input;
|
||||
@ -74,17 +74,17 @@ struct netifapi_msg {
|
||||
|
||||
/* API for application */
|
||||
err_t netifapi_netif_add ( struct netif *netif,
|
||||
struct ip_addr *ipaddr,
|
||||
struct ip_addr *netmask,
|
||||
struct ip_addr *gw,
|
||||
ip_addr_t *ipaddr,
|
||||
ip_addr_t *netmask,
|
||||
ip_addr_t *gw,
|
||||
void *state,
|
||||
netif_init_fn init,
|
||||
netif_input_fn input);
|
||||
|
||||
err_t netifapi_netif_set_addr ( struct netif *netif,
|
||||
struct ip_addr *ipaddr,
|
||||
struct ip_addr *netmask,
|
||||
struct ip_addr *gw );
|
||||
ip_addr_t *ipaddr,
|
||||
ip_addr_t *netmask,
|
||||
ip_addr_t *gw );
|
||||
|
||||
err_t netifapi_netif_common ( struct netif *netif,
|
||||
netifapi_void_fn voidfunc,
|
||||
|
@ -58,7 +58,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,
|
||||
struct ip_addr *addr);
|
||||
ip_addr_t *addr);
|
||||
|
||||
struct raw_pcb {
|
||||
/* Common members of all PCB types */
|
||||
@ -78,11 +78,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, struct ip_addr *ipaddr);
|
||||
err_t raw_connect (struct raw_pcb *pcb, struct ip_addr *ipaddr);
|
||||
err_t raw_bind (struct raw_pcb *pcb, ip_addr_t *ipaddr);
|
||||
err_t raw_connect (struct raw_pcb *pcb, 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, struct ip_addr *ipaddr);
|
||||
err_t raw_sendto (struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr);
|
||||
err_t raw_send (struct raw_pcb *pcb, struct pbuf *p);
|
||||
|
||||
/* The following functions are the lower layer interface to RAW. */
|
||||
|
@ -121,8 +121,8 @@ void snmp_inc_iflist(void);
|
||||
void snmp_dec_iflist(void);
|
||||
|
||||
/* ARP (for atTable and ipNetToMediaTable) */
|
||||
void snmp_insert_arpidx_tree(struct netif *ni, struct ip_addr *ip);
|
||||
void snmp_delete_arpidx_tree(struct netif *ni, struct ip_addr *ip);
|
||||
void snmp_insert_arpidx_tree(struct netif *ni, ip_addr_t *ip);
|
||||
void snmp_delete_arpidx_tree(struct netif *ni, ip_addr_t *ip);
|
||||
|
||||
/* IP */
|
||||
void snmp_inc_ipinreceives(void);
|
||||
|
@ -223,7 +223,7 @@ struct snmp_msg_pstat
|
||||
/* lwIP local port (161) binding */
|
||||
struct udp_pcb *pcb;
|
||||
/* source IP address */
|
||||
struct ip_addr sip;
|
||||
ip_addr_t sip;
|
||||
/* source UDP port */
|
||||
u16_t sp;
|
||||
/* request type */
|
||||
@ -262,7 +262,7 @@ struct snmp_msg_trap
|
||||
/* lwIP local port (161) binding */
|
||||
struct udp_pcb *pcb;
|
||||
/* destination IP address in network order */
|
||||
struct ip_addr dip;
|
||||
ip_addr_t dip;
|
||||
|
||||
/* source enterprise ID (sysObjectID) */
|
||||
struct snmp_obj_id *enterprise;
|
||||
@ -290,7 +290,7 @@ extern struct snmp_msg_trap trap_msg;
|
||||
/** Agent setup, start listening to port 161. */
|
||||
void snmp_init(void);
|
||||
void snmp_trap_dst_enable(u8_t dst_idx, u8_t enable);
|
||||
void snmp_trap_dst_ip_set(u8_t dst_idx, struct ip_addr *dst);
|
||||
void snmp_trap_dst_ip_set(u8_t dst_idx, ip_addr_t *dst);
|
||||
|
||||
/** Varbind-list functions. */
|
||||
struct snmp_varbind* snmp_varbind_alloc(struct snmp_obj_id *oid, u8_t type, u8_t len);
|
||||
|
@ -240,8 +240,8 @@ void noleafs_get_value(struct obj_def *od, u16_t len, void *value);
|
||||
u8_t noleafs_set_test(struct obj_def *od, u16_t len, void *value);
|
||||
void noleafs_set_value(struct obj_def *od, u16_t len, void *value);
|
||||
|
||||
void snmp_oidtoip(s32_t *ident, struct ip_addr *ip);
|
||||
void snmp_iptooid(struct ip_addr *ip, s32_t *ident);
|
||||
void snmp_oidtoip(s32_t *ident, ip_addr_t *ip);
|
||||
void snmp_iptooid(ip_addr_t *ip, s32_t *ident);
|
||||
void snmp_ifindextonetif(s32_t ifindex, struct netif **netif);
|
||||
void snmp_netiftoifindex(struct netif *netif, s32_t *ifidx);
|
||||
|
||||
|
@ -156,9 +156,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, struct ip_addr *ipaddr,
|
||||
err_t tcp_bind (struct tcp_pcb *pcb, ip_addr_t *ipaddr,
|
||||
u16_t port);
|
||||
err_t tcp_connect (struct tcp_pcb *pcb, struct ip_addr *ipaddr,
|
||||
err_t tcp_connect (struct tcp_pcb *pcb, 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);
|
||||
@ -606,7 +606,7 @@ err_t tcp_enqueue(struct tcp_pcb *pcb, void *dataptr, u16_t len,
|
||||
void tcp_rexmit_seg(struct tcp_pcb *pcb, struct tcp_seg *seg);
|
||||
|
||||
void tcp_rst(u32_t seqno, u32_t ackno,
|
||||
struct ip_addr *local_ip, struct ip_addr *remote_ip,
|
||||
ip_addr_t *local_ip, ip_addr_t *remote_ip,
|
||||
u16_t local_port, u16_t remote_port);
|
||||
|
||||
u32_t tcp_next_iss(void);
|
||||
@ -615,7 +615,7 @@ void tcp_keepalive(struct tcp_pcb *pcb);
|
||||
void tcp_zero_window_probe(struct tcp_pcb *pcb);
|
||||
|
||||
#if TCP_CALCULATE_EFF_SEND_MSS
|
||||
u16_t tcp_eff_send_mss(u16_t sendmss, struct ip_addr *addr);
|
||||
u16_t tcp_eff_send_mss(u16_t sendmss, ip_addr_t *addr);
|
||||
#endif /* TCP_CALCULATE_EFF_SEND_MSS */
|
||||
|
||||
#if LWIP_CALLBACK_API
|
||||
|
@ -84,7 +84,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,
|
||||
struct ip_addr *addr, u16_t port);
|
||||
ip_addr_t *addr, u16_t port);
|
||||
|
||||
|
||||
struct udp_pcb {
|
||||
@ -101,7 +101,7 @@ struct udp_pcb {
|
||||
|
||||
#if LWIP_IGMP
|
||||
/** outgoing network interface for multicast packets */
|
||||
struct ip_addr multicast_ip;
|
||||
ip_addr_t multicast_ip;
|
||||
#endif /* LWIP_IGMP */
|
||||
|
||||
#if LWIP_UDPLITE
|
||||
@ -121,18 +121,18 @@ 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, struct ip_addr *ipaddr,
|
||||
err_t udp_bind (struct udp_pcb *pcb, ip_addr_t *ipaddr,
|
||||
u16_t port);
|
||||
err_t udp_connect (struct udp_pcb *pcb, struct ip_addr *ipaddr,
|
||||
err_t udp_connect (struct udp_pcb *pcb, 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,
|
||||
struct ip_addr *dst_ip, u16_t dst_port,
|
||||
ip_addr_t *dst_ip, u16_t dst_port,
|
||||
struct netif *netif);
|
||||
err_t udp_sendto (struct udp_pcb *pcb, struct pbuf *p,
|
||||
struct ip_addr *dst_ip, u16_t dst_port);
|
||||
ip_addr_t *dst_ip, u16_t dst_port);
|
||||
err_t udp_send (struct udp_pcb *pcb, struct pbuf *p);
|
||||
|
||||
#define udp_flags(pcb) ((pcb)->flags)
|
||||
|
@ -161,14 +161,14 @@ struct etharp_q_entry {
|
||||
|
||||
#define etharp_init() /* Compatibility define, not init needed. */
|
||||
void etharp_tmr(void);
|
||||
s8_t etharp_find_addr(struct netif *netif, struct ip_addr *ipaddr,
|
||||
struct eth_addr **eth_ret, struct ip_addr **ip_ret);
|
||||
s8_t etharp_find_addr(struct netif *netif, ip_addr_t *ipaddr,
|
||||
struct eth_addr **eth_ret, ip_addr_t **ip_ret);
|
||||
void etharp_ip_input(struct netif *netif, struct pbuf *p);
|
||||
void etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr,
|
||||
struct pbuf *p);
|
||||
err_t etharp_output(struct netif *netif, struct pbuf *q, struct ip_addr *ipaddr);
|
||||
err_t etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q);
|
||||
err_t etharp_request(struct netif *netif, struct ip_addr *ipaddr);
|
||||
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);
|
||||
/** 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.
|
||||
@ -178,8 +178,8 @@ err_t etharp_request(struct netif *netif, struct ip_addr *ipaddr);
|
||||
#if LWIP_AUTOIP
|
||||
err_t etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
|
||||
const struct eth_addr *ethdst_addr,
|
||||
const struct eth_addr *hwsrc_addr, const struct ip_addr *ipsrc_addr,
|
||||
const struct eth_addr *hwdst_addr, const struct ip_addr *ipdst_addr,
|
||||
const struct eth_addr *hwsrc_addr, const ip_addr_t *ipsrc_addr,
|
||||
const struct eth_addr *hwdst_addr, const ip_addr_t *ipdst_addr,
|
||||
const u16_t opcode);
|
||||
#endif /* LWIP_AUTOIP */
|
||||
|
||||
|
@ -102,7 +102,7 @@ struct etharp_entry {
|
||||
*/
|
||||
struct etharp_q_entry *q;
|
||||
#endif
|
||||
struct ip_addr ipaddr;
|
||||
ip_addr_t ipaddr;
|
||||
struct eth_addr ethaddr;
|
||||
enum etharp_state state;
|
||||
u8_t ctime;
|
||||
@ -123,12 +123,12 @@ static u8_t etharp_cached_entry;
|
||||
#if LWIP_NETIF_HWADDRHINT
|
||||
#define NETIF_SET_HINT(netif, hint) if (((netif) != NULL) && ((netif)->addr_hint != NULL)) \
|
||||
*((netif)->addr_hint) = (hint);
|
||||
static s8_t find_entry(struct ip_addr *ipaddr, u8_t flags, struct netif *netif);
|
||||
static s8_t find_entry(ip_addr_t *ipaddr, u8_t flags, struct netif *netif);
|
||||
#else /* LWIP_NETIF_HWADDRHINT */
|
||||
static s8_t find_entry(struct ip_addr *ipaddr, u8_t flags);
|
||||
static s8_t find_entry(ip_addr_t *ipaddr, u8_t flags);
|
||||
#endif /* LWIP_NETIF_HWADDRHINT */
|
||||
|
||||
static err_t update_arp_entry(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr *ethaddr, u8_t flags);
|
||||
static err_t update_arp_entry(struct netif *netif, ip_addr_t *ipaddr, struct eth_addr *ethaddr, u8_t flags);
|
||||
|
||||
|
||||
/* Some checks, instead of etharp_init(): */
|
||||
@ -229,9 +229,9 @@ etharp_tmr(void)
|
||||
*/
|
||||
static s8_t
|
||||
#if LWIP_NETIF_HWADDRHINT
|
||||
find_entry(struct ip_addr *ipaddr, u8_t flags, struct netif *netif)
|
||||
find_entry(ip_addr_t *ipaddr, u8_t flags, struct netif *netif)
|
||||
#else /* LWIP_NETIF_HWADDRHINT */
|
||||
find_entry(struct ip_addr *ipaddr, u8_t flags)
|
||||
find_entry(ip_addr_t *ipaddr, u8_t flags)
|
||||
#endif /* LWIP_NETIF_HWADDRHINT */
|
||||
{
|
||||
s8_t old_pending = ARP_TABLE_SIZE, old_stable = ARP_TABLE_SIZE;
|
||||
@ -468,7 +468,7 @@ etharp_send_ip(struct netif *netif, struct pbuf *p, struct eth_addr *src, struct
|
||||
* @see pbuf_free()
|
||||
*/
|
||||
static err_t
|
||||
update_arp_entry(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr *ethaddr, u8_t flags)
|
||||
update_arp_entry(struct netif *netif, ip_addr_t *ipaddr, struct eth_addr *ethaddr, u8_t flags)
|
||||
{
|
||||
s8_t i;
|
||||
u8_t k;
|
||||
@ -545,8 +545,8 @@ update_arp_entry(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr *e
|
||||
* @return table index if found, -1 otherwise
|
||||
*/
|
||||
s8_t
|
||||
etharp_find_addr(struct netif *netif, struct ip_addr *ipaddr,
|
||||
struct eth_addr **eth_ret, struct ip_addr **ip_ret)
|
||||
etharp_find_addr(struct netif *netif, ip_addr_t *ipaddr,
|
||||
struct eth_addr **eth_ret, ip_addr_t **ip_ret)
|
||||
{
|
||||
s8_t i;
|
||||
|
||||
@ -631,7 +631,7 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
|
||||
struct etharp_hdr *hdr;
|
||||
struct eth_hdr *ethhdr;
|
||||
/* these are aligned properly, whereas the ARP header fields might not be */
|
||||
struct ip_addr sipaddr, dipaddr;
|
||||
ip_addr_t sipaddr, dipaddr;
|
||||
u8_t i;
|
||||
u8_t for_us;
|
||||
#if LWIP_AUTOIP
|
||||
@ -662,7 +662,7 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
|
||||
|
||||
/* RFC 826 "Packet Reception": */
|
||||
if ((hdr->hwtype != htons(HWTYPE_ETHERNET)) ||
|
||||
(hdr->_hwlen_protolen != htons((ETHARP_HWADDR_LEN << 8) | sizeof(struct ip_addr))) ||
|
||||
(hdr->_hwlen_protolen != htons((ETHARP_HWADDR_LEN << 8) | sizeof(ip_addr_t))) ||
|
||||
(hdr->proto != htons(ETHTYPE_IP)) ||
|
||||
(ethhdr->type != htons(ETHTYPE_ARP))) {
|
||||
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING,
|
||||
@ -724,8 +724,8 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
|
||||
that would allocate a new pbuf. */
|
||||
hdr->opcode = htons(ARP_REPLY);
|
||||
|
||||
SMEMCPY(&hdr->dipaddr, &hdr->sipaddr, sizeof(struct ip_addr));
|
||||
SMEMCPY(&hdr->sipaddr, &netif->ip_addr, sizeof(struct ip_addr));
|
||||
SMEMCPY(&hdr->dipaddr, &hdr->sipaddr, sizeof(ip_addr_t));
|
||||
SMEMCPY(&hdr->sipaddr, &netif->ip_addr, sizeof(ip_addr_t));
|
||||
|
||||
LWIP_ASSERT("netif->hwaddr_len must be the same as ETHARP_HWADDR_LEN for etharp!",
|
||||
(netif->hwaddr_len == ETHARP_HWADDR_LEN));
|
||||
@ -802,7 +802,7 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
|
||||
* or the return type of either etharp_query() or etharp_send_ip().
|
||||
*/
|
||||
err_t
|
||||
etharp_output(struct netif *netif, struct pbuf *q, struct ip_addr *ipaddr)
|
||||
etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr)
|
||||
{
|
||||
struct eth_addr *dest, mcastaddr;
|
||||
|
||||
@ -893,7 +893,7 @@ etharp_output(struct netif *netif, struct pbuf *q, struct ip_addr *ipaddr)
|
||||
*
|
||||
*/
|
||||
err_t
|
||||
etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
|
||||
etharp_query(struct netif *netif, ip_addr_t *ipaddr, struct pbuf *q)
|
||||
{
|
||||
struct eth_addr * srcaddr = (struct eth_addr *)netif->hwaddr;
|
||||
err_t result = ERR_MEM;
|
||||
@ -1049,8 +1049,8 @@ static
|
||||
err_t
|
||||
etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
|
||||
const struct eth_addr *ethdst_addr,
|
||||
const struct eth_addr *hwsrc_addr, const struct ip_addr *ipsrc_addr,
|
||||
const struct eth_addr *hwdst_addr, const struct ip_addr *ipdst_addr,
|
||||
const struct eth_addr *hwsrc_addr, const ip_addr_t *ipsrc_addr,
|
||||
const struct eth_addr *hwdst_addr, const ip_addr_t *ipdst_addr,
|
||||
const u16_t opcode)
|
||||
{
|
||||
struct pbuf *p;
|
||||
@ -1103,13 +1103,13 @@ etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
|
||||
}
|
||||
/* Copy struct ip_addr2 to aligned ip_addr, to support compilers without
|
||||
* structure packing. */
|
||||
SMEMCPY(&hdr->sipaddr, ipsrc_addr, sizeof(struct ip_addr));
|
||||
SMEMCPY(&hdr->dipaddr, ipdst_addr, sizeof(struct ip_addr));
|
||||
SMEMCPY(&hdr->sipaddr, ipsrc_addr, sizeof(ip_addr_t));
|
||||
SMEMCPY(&hdr->dipaddr, ipdst_addr, sizeof(ip_addr_t));
|
||||
|
||||
hdr->hwtype = htons(HWTYPE_ETHERNET);
|
||||
hdr->proto = htons(ETHTYPE_IP);
|
||||
/* set hwlen and protolen together */
|
||||
hdr->_hwlen_protolen = htons((ETHARP_HWADDR_LEN << 8) | sizeof(struct ip_addr));
|
||||
hdr->_hwlen_protolen = htons((ETHARP_HWADDR_LEN << 8) | sizeof(ip_addr_t));
|
||||
|
||||
ethhdr->type = htons(ETHTYPE_ARP);
|
||||
/* send ARP query */
|
||||
@ -1133,7 +1133,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, struct ip_addr *ipaddr)
|
||||
etharp_request(struct netif *netif, 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,
|
||||
|
@ -794,7 +794,7 @@ pppifOutputOverEthernet(int pd, struct pbuf *p)
|
||||
|
||||
/* Send a packet on the given connection. */
|
||||
static err_t
|
||||
pppifOutput(struct netif *netif, struct pbuf *pb, struct ip_addr *ipaddr)
|
||||
pppifOutput(struct netif *netif, struct pbuf *pb, ip_addr_t *ipaddr)
|
||||
{
|
||||
int pd = (int)netif->state;
|
||||
PPPControl *pc = &pppControl[pd];
|
||||
|
@ -336,7 +336,7 @@ struct ppp_settings {
|
||||
};
|
||||
|
||||
struct ppp_addrs {
|
||||
struct ip_addr our_ipaddr, his_ipaddr, netmask, dns1, dns2;
|
||||
ip_addr_t our_ipaddr, his_ipaddr, netmask, dns1, dns2;
|
||||
};
|
||||
|
||||
/*****************************
|
||||
|
@ -386,7 +386,7 @@ pppoe_dispatch_disc_pkt(struct netif *netif, struct pbuf *pb)
|
||||
char devname[6];
|
||||
char *error;
|
||||
u8_t *ac_cookie;
|
||||
size_t ac_cookie_len;
|
||||
u16_t ac_cookie_len;
|
||||
#ifdef PPPOE_SERVER
|
||||
u8_t *hunique;
|
||||
size_t hunique_len;
|
||||
@ -549,9 +549,9 @@ breakbreak:;
|
||||
sc->sc_state = PPPOE_STATE_PADO_SENT;
|
||||
pppoe_send_pado(sc);
|
||||
break;
|
||||
#endif /* PPPOE_SERVER */
|
||||
#endif /* PPPOE_SERVER */
|
||||
case PPPOE_CODE_PADR:
|
||||
#ifdef PPPOE_SERVER
|
||||
#ifdef PPPOE_SERVER
|
||||
/*
|
||||
* get sc from ac_cookie if IFF_PASSIVE
|
||||
*/
|
||||
@ -587,10 +587,10 @@ breakbreak:;
|
||||
sc->sc_state = PPPOE_STATE_SESSION;
|
||||
pppoe_linkstatus_up(sc); /* notify upper layers */
|
||||
break;
|
||||
#else
|
||||
#else
|
||||
/* ignore, we are no access concentrator */
|
||||
goto done;
|
||||
#endif /* PPPOE_SERVER */
|
||||
#endif /* PPPOE_SERVER */
|
||||
case PPPOE_CODE_PADO:
|
||||
if (sc == NULL) {
|
||||
/* be quiet if there is not a single pppoe instance */
|
||||
|
@ -88,7 +88,7 @@ struct slipif_priv {
|
||||
* @return always returns ERR_OK since the serial layer does not provide return values
|
||||
*/
|
||||
err_t
|
||||
slipif_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr)
|
||||
slipif_output(struct netif *netif, struct pbuf *p, ip_addr_t *ipaddr)
|
||||
{
|
||||
struct slipif_priv *priv;
|
||||
struct pbuf *q;
|
||||
|
Loading…
x
Reference in New Issue
Block a user