diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2015-01-16 12:30:18 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2015-01-16 12:30:18 -0600 |
commit | 80ea43c7c968cd7f9617ab8a69892b4214e6664c (patch) | |
tree | 0fd0ccd53493c12a7cd79a322e48680763715228 /apps | |
parent | 9d7bd7674895cf2d6f21501396f6945a14231e7b (diff) | |
download | px4-nuttx-80ea43c7c968cd7f9617ab8a69892b4214e6664c.tar.gz px4-nuttx-80ea43c7c968cd7f9617ab8a69892b4214e6664c.tar.bz2 px4-nuttx-80ea43c7c968cd7f9617ab8a69892b4214e6664c.zip |
Networking: Replace all references to net_ipaddr_t with either in_addr_t on net_ipv6addr_t. The goal is to support both IPv4 and IPv6 simultaneously. This requires that the two types be distinct and not conditionally typedef'ed to net_ipaddr_t.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/include/netutils/smtp.h | 4 | ||||
-rw-r--r-- | apps/netutils/smtp/smtp.c | 9 | ||||
-rw-r--r-- | apps/nshlib/nsh_netcmds.c | 22 |
3 files changed, 21 insertions, 14 deletions
diff --git a/apps/include/netutils/smtp.h b/apps/include/netutils/smtp.h index 2ca7f1e8c..684864c44 100644 --- a/apps/include/netutils/smtp.h +++ b/apps/include/netutils/smtp.h @@ -2,7 +2,7 @@ * apps/include/netutils/smtp.h * SMTP header file * - * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Heavily leveraged from uIP 1.0 which also has a BSD-like license: @@ -69,7 +69,7 @@ extern "C" void *smtp_open(void); void smtp_configure(FAR void *handle, FAR const char *localhostname, - FAR const net_ipaddr_t *paddr); + FAR const in_addr_t *paddr); int smtp_send(FAR void *handle, FAR const char *to, FAR const char *cc, FAR const char *from, FAR const char *subject, FAR const char *msg, int msglen); diff --git a/apps/netutils/smtp/smtp.c b/apps/netutils/smtp/smtp.c index 095a1c495..f33183ff6 100644 --- a/apps/netutils/smtp/smtp.c +++ b/apps/netutils/smtp/smtp.c @@ -2,7 +2,7 @@ * apps/netutitls/smtp/smtp.c * smtp SMTP E-mail sender * - * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Heavily leveraged from uIP 1.0 which also has a BSD-like license: @@ -63,7 +63,7 @@ #include <apps/netutils/smtp.h> /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ #define SMTP_INPUT_BUFFER_SIZE 512 @@ -89,7 +89,7 @@ struct smtp_state uint8_t state; bool connected; sem_t sem; - net_ipaddr_t smtpserver; + in_addr_t smtpserver; const char *localhostname; const char *to; const char *cc; @@ -286,7 +286,7 @@ static inline int smtp_send_message(int sockfd, struct smtp_state *psmtp) */ void smtp_configure(FAR void *handle, FAR const char *lhostname, - FAR const net_ipaddr_t *paddr) + FAR const in_addr_t *paddr) { FAR struct smtp_state *psmtp = (FAR struct smtp_state *)handle; psmtp->localhostname = lhostname; @@ -364,6 +364,7 @@ void *smtp_open(void) memset(psmtp, 0, sizeof(struct smtp_state)); (void)sem_init(&psmtp->sem, 0, 0); } + return (void*)psmtp; } diff --git a/apps/nshlib/nsh_netcmds.c b/apps/nshlib/nsh_netcmds.c index 798879b55..7b902f9b5 100644 --- a/apps/nshlib/nsh_netcmds.c +++ b/apps/nshlib/nsh_netcmds.c @@ -455,6 +455,7 @@ int tftpc_parseargs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv, { goto errout; } + args->allocated = true; } @@ -797,8 +798,9 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) handle = dhcpc_open(&mac, IFHWADDRLEN); - /* Get an IP address. Note that there is no logic for renewing the IP address in this - * example. The address should be renewed in ds.lease_time/2 seconds. + /* Get an IP address. Note that there is no logic for renewing the IP + * address in this example. The address should be renewed in + * ds.lease_time/2 seconds. */ if (handle) @@ -843,7 +845,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { FAR const char *fmt = g_fmtarginvalid; const char *staddr; - net_ipaddr_t ipaddr; + in_addr_t ipaddr; uint32_t start; uint32_t next; uint32_t dsec = 10; @@ -899,7 +901,9 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) } } - /* If a bad argument was encountered, then return without processing the command */ + /* If a bad argument was encountered, then return without processing the + * command + */ if (badarg) { @@ -931,8 +935,8 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) id = ping_newid(); - /* The maximum wait for a response will be the larger of the inter-ping time and - * the configured maximum round-trip time. + /* The maximum wait for a response will be the larger of the inter-ping + * time and the configured maximum round-trip time. */ maxwait = MAX(dsec, CONFIG_NSH_MAX_ROUNDTRIP); @@ -960,7 +964,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { /* Get the elapsed time from the time that the request was * sent until the response was received. If we got a response - * to an earlier request, then fudge the elpased time. + * to an earlier request, then fudge the elapsed time. */ elapsed = TICK2MSEC(clock_systimer() - next); @@ -1091,7 +1095,9 @@ int cmd_wget(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) } } - /* If a bad argument was encountered, then return without processing the command */ + /* If a bad argument was encountered, then return without processing the + * command + */ if (badarg) { |