From a1f980bc9deda7de6949686284acc1609a18c84a Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 17 Jul 2012 03:58:11 +0000 Subject: [PATCH] Header file clean-up git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4948 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog.txt | 1 + include/apps.h | 17 ++++++------ include/ftpc.h | 3 ++- include/netutils/dhcpc.h | 10 +++---- include/netutils/dhcpd.h | 10 +++---- include/netutils/httpd.h | 26 ++++++++++++++----- include/netutils/ipmsfilter.h | 10 +++---- include/netutils/resolv.h | 22 +++++++++++----- include/netutils/smtp.h | 30 ++++++++++++++------- include/netutils/telnetd.h | 2 +- include/netutils/tftp.h | 10 +++---- include/netutils/thttpd.h | 10 +++---- include/netutils/uiplib.h | 49 ++++++++++++++++++++++------------- include/netutils/webclient.h | 10 +++---- include/nsh.h | 10 +++---- include/readline.h | 8 +++--- include/tiff.h | 2 +- 17 files changed, 140 insertions(+), 90 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index f00020bcd..54161979d 100755 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -250,3 +250,4 @@ 6.21 2012-xx-xx Gregory Nutt + * include/: Stylistic clean-up of all header files. diff --git a/include/apps.h b/include/apps.h index d494500d1..520128203 100644 --- a/include/apps.h +++ b/include/apps.h @@ -1,5 +1,5 @@ /**************************************************************************** - * include/apps/apps.h + * apps/include/apps.h * * Copyright(C) 2011 Uros Platise. All rights reserved. * Author: Uros Platise @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __INCLUDE_APPS_APPS_H -#define __INCLUDE_APPS_APPS_H +#ifndef __APPS_INCLUDE_APPS_H +#define __APPS_INCLUDE_APPS_H /**************************************************************************** * Included Files @@ -54,10 +54,10 @@ struct namedapp_s { - const char *name; /* Invocation name and as seen under /sbin/ */ - int priority; /* Use: SCHED_PRIORITY_DEFAULT */ - int stacksize; /* Desired stack size */ - main_t main; /* Entry point: main(int argc, char *argv[]) */ + const char *name; /* Invocation name and as seen under /sbin/ */ + int priority; /* Use: SCHED_PRIORITY_DEFAULT */ + int stacksize; /* Desired stack size */ + main_t main; /* Entry point: main(int argc, char *argv[]) */ }; /**************************************************************************** @@ -145,4 +145,5 @@ EXTERN int exec_namedapp(FAR const char *appname, FAR const char **argv); #if defined(__cplusplus) } #endif -#endif /* __INCLUDE_APPS_APPS_H */ + +#endif /* __APPS_INCLUDE_APPS_H */ diff --git a/include/ftpc.h b/include/ftpc.h index ed5e3fab9..f9a73676a 100644 --- a/include/ftpc.h +++ b/include/ftpc.h @@ -2,7 +2,7 @@ * apps/include/ftpc.h * * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -221,4 +221,5 @@ EXTERN FAR char *ftpc_response(SESSION handle); #ifdef __cplusplus } #endif + #endif /* __APPS_INCLUDE_FTPC_H */ diff --git a/include/netutils/dhcpc.h b/include/netutils/dhcpc.h index 994a6713e..a6c53dc30 100644 --- a/include/netutils/dhcpc.h +++ b/include/netutils/dhcpc.h @@ -1,8 +1,8 @@ /**************************************************************************** - * apps/netutils/dhcpc.n + * apps/include/netutils/dhcpc.h * * Copyright (C) 2007, 2009-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * This logic was leveraged from uIP which also has a BSD-style license: * @@ -35,8 +35,8 @@ * SUCH DAMAGE. */ -#ifndef __APPS_NETUTILS_DHCPC_H -#define __APPS_NETUTILS_DHCPC_H +#ifndef __APPS_INCLUDE_NETUTILS_DHCPC_H +#define __APPS_INCLUDE_NETUTILS_DHCPC_H /**************************************************************************** * Included Files @@ -82,4 +82,4 @@ EXTERN void dhcpc_close(void *handle); } #endif -#endif /* __APPS_NETUTILS_DHCPC_H */ +#endif /* __APPS_INCLUDE_NETUTILS_DHCPC_H */ diff --git a/include/netutils/dhcpd.h b/include/netutils/dhcpd.h index b03415b20..f997fac30 100644 --- a/include/netutils/dhcpd.h +++ b/include/netutils/dhcpd.h @@ -1,8 +1,8 @@ /**************************************************************************** - * apps/netutils/dhcpd.h + * apps/include/netutils/dhcpd.h * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * This logic was leveraged from uIP which also has a BSD-style license: * @@ -35,8 +35,8 @@ * SUCH DAMAGE. */ -#ifndef __APPS_NETUTILS_DHCPD_H -#define __APPS_NETUTILS_DHCPD_H +#ifndef __APPS_INCLUDE_NETUTILS_DHCPD_H +#define __APPS_INCLUDE_NETUTILS_DHCPD_H /**************************************************************************** * Included Files @@ -68,4 +68,4 @@ EXTERN int dhcpd_run(void); } #endif -#endif /* __APPS_NETUTILS_DHCPD_H */ +#endif /* __APPS_INCLUDE_NETUTILS_DHCPD_H */ diff --git a/include/netutils/httpd.h b/include/netutils/httpd.h index 12f2a1511..7cd002b66 100644 --- a/include/netutils/httpd.h +++ b/include/netutils/httpd.h @@ -1,8 +1,8 @@ /**************************************************************************** - * apps/netutils/httpd.h + * apps/include/netutils/httpd.h * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Based on uIP which also has a BSD style license: * @@ -37,8 +37,8 @@ * ****************************************************************************/ -#ifndef __APPS_NETUTILS_HTTPD_H -#define __APPS_NETUTILS_HTTPD_H +#ifndef __APPS_INCLUDE_NETUTILS_HTTPD_H +#define __APPS_INCLUDE_NETUTILS_HTTPD_H /**************************************************************************** * Included Files @@ -48,7 +48,19 @@ * Public Function Prototypes ****************************************************************************/ -extern void httpd_init(void); -extern int httpd_listen(void); +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif -#endif /* __APPS_NETUTILS_HTTPD_H */ +EXTERN void httpd_init(void); +EXTERN int httpd_listen(void); + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __APPS_INCLUDE_NETUTILS_HTTPD_H */ diff --git a/include/netutils/ipmsfilter.h b/include/netutils/ipmsfilter.h index 56088eca7..2dcffa4a1 100755 --- a/include/netutils/ipmsfilter.h +++ b/include/netutils/ipmsfilter.h @@ -1,9 +1,9 @@ /**************************************************************************** - * apps/netutils/ipmsfilter.h + * apps/include/netutils/ipmsfilter.h * User interface to add/remove IP multicast address * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,8 +34,8 @@ * ****************************************************************************/ -#ifndef __APPS_NETUTILS_IPMSFILTER_H -#define __APPS_NETUTILS_IPMSFILTER_H +#ifndef __APPS_INCLUDE_NETUTILS_IPMSFILTER_H +#define __APPS_INCLUDE_NETUTILS_IPMSFILTER_H /**************************************************************************** * Included Files @@ -98,4 +98,4 @@ EXTERN int ipmsfilter(FAR const char *ifname, #endif #endif /* CONFIG_NET_IGMP */ -#endif /* __APPS_NETUTILS_IPMSFILTER_H */ +#endif /* __APPS_INCLUDE_NETUTILS_IPMSFILTER_H */ diff --git a/include/netutils/resolv.h b/include/netutils/resolv.h index e1499afd7..81798558c 100644 --- a/include/netutils/resolv.h +++ b/include/netutils/resolv.h @@ -1,6 +1,7 @@ -/* includes/apps/netutils/resolv.h +/**************************************************************************** + * apps/include/netutils/resolv.h * DNS resolver code header file. - * Authtor Adam Dunkels + * Author Adam Dunkels * * Copyright (c) 2002-2003, Adam Dunkels. * All rights reserved. @@ -28,13 +29,22 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + * + ****************************************************************************/ -#ifndef __APPS_NETUTILS_RESOLVE_H -#define __APPS_NETUTILS_RESOLVE_H +#ifndef __APPS_INCLUDE_NETUTILS_RESOLVE_H +#define __APPS_INCLUDE_NETUTILS_RESOLVE_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ #include +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" @@ -62,4 +72,4 @@ EXTERN int resolv_query(const char *name, struct sockaddr_in *addr); } #endif -#endif /* __APPS_NETUTILS_RESOLVE_H */ +#endif /* __APPS_INCLUDE_NETUTILS_RESOLVE_H */ diff --git a/include/netutils/smtp.h b/include/netutils/smtp.h index ef3864bf3..1bb0cc16f 100644 --- a/include/netutils/smtp.h +++ b/include/netutils/smtp.h @@ -1,9 +1,9 @@ /**************************************************************************** - * include/apps/netutils/smtp.h + * apps/include/netutils/smtp.h * SMTP header file * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Heavily leveraged from uIP 1.0 which also has a BSD-like license: * @@ -37,8 +37,8 @@ * ****************************************************************************/ -#ifndef __APPS_NETUTILS_SMTP_H -#define __APPS_NETUTILS_SMTP_H +#ifndef __APPS_INCLUDE_NETUTILS_SMTP_H +#define __APPS_INCLUDE_NETUTILS_SMTP_H /**************************************************************************** * Included Files @@ -55,12 +55,24 @@ * Public Function Prototypes ****************************************************************************/ -extern void *smtp_open(void); -extern void smtp_configure(void *handle, const char *localhostname, +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +EXTERN void *smtp_open(void); +EXTERN void smtp_configure(void *handle, const char *localhostname, const uip_ipaddr_t *paddr); -extern int smtp_send(void *handle, const char *to, const char *cc, +EXTERN int smtp_send(void *handle, const char *to, const char *cc, const char *from, const char *subject, const char *msg, int msglen); -extern void smtp_close(void *handle); +EXTERN void smtp_close(void *handle); -#endif /* __APPS_NETUTILS_SMTP_H */ +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __APPS_INCLUDE_NETUTILS_SMTP_H */ diff --git a/include/netutils/telnetd.h b/include/netutils/telnetd.h index 4cddd92dd..98721c023 100644 --- a/include/netutils/telnetd.h +++ b/include/netutils/telnetd.h @@ -1,5 +1,5 @@ /**************************************************************************** - * include/apps/netutils/telnetd.h + * apps/include/netutils/telnetd.h * * Copyright (C) 2007, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/include/netutils/tftp.h b/include/netutils/tftp.h index c00e37c72..276073aad 100644 --- a/include/netutils/tftp.h +++ b/include/netutils/tftp.h @@ -1,8 +1,8 @@ /**************************************************************************** - * include/apps/netutils/tftp.h + * apps/include/netutils/tftp.h * * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __APPS_NETUTILS_TFTP_H -#define __APPS_NETUTILS_TFTP_H +#ifndef __APPS_INCLUDE_NETUTILS_TFTP_H +#define __APPS_INCLUDE_NETUTILS_TFTP_H /**************************************************************************** * Included Files @@ -70,4 +70,4 @@ EXTERN int tftpput(const char *local, const char *remote, in_addr_t addr, bool b } #endif -#endif /* __APPS_NETUTILS_TFTP_H */ \ No newline at end of file +#endif /* __APPS_INCLUDE_NETUTILS_TFTP_H */ diff --git a/include/netutils/thttpd.h b/include/netutils/thttpd.h index 959177219..92ed7ba97 100644 --- a/include/netutils/thttpd.h +++ b/include/netutils/thttpd.h @@ -1,8 +1,8 @@ /**************************************************************************** - * apps/netutils/thttpd.h + * apps/include/netutils/thttpd.h * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __APPS_NETUTILS_THTTPD_H -#define __APPS_NETUTILS_THTTPD_H +#ifndef __APPS_INCLUDE_NETUTILS_THTTPD_H +#define __APPS_INCLUDE_NETUTILS_THTTPD_H /**************************************************************************** * Included Files @@ -98,4 +98,4 @@ EXTERN int thttpd_main(int argc, char **argv); } #endif -#endif /* __APPS_NETUTILS_THTTPD_H */ +#endif /* __APPS_INCLUDE_NETUTILS_THTTPD_H */ diff --git a/include/netutils/uiplib.h b/include/netutils/uiplib.h index 48a71a14c..219a5e9cc 100644 --- a/include/netutils/uiplib.h +++ b/include/netutils/uiplib.h @@ -1,10 +1,10 @@ /**************************************************************************** - * apps/netutils/uiplib.h + * apps/include/netutils/uiplib.h * Various non-standard APIs to support netutils. All non-standard and * intended only for internal use. * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Some of these APIs derive from uIP but all of them use the uip_ prefix * to identify them as members of this library. uIP also has a BSD style @@ -42,8 +42,8 @@ * ****************************************************************************/ -#ifndef __APPS_NETUTILS_UIPLIB_H -#define __APPS_NETUTILS_UIPLIB_H +#ifndef __APPS_INCLUDE_NETUTILS_UIPLIB_H +#define __APPS_INCLUDE_NETUTILS_UIPLIB_H /**************************************************************************** * Included Files @@ -77,6 +77,14 @@ * Public Function Prototypes ****************************************************************************/ +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + /* Convert a textual representation of an IP address to a numerical representation. * * This function takes a textual representation of an IP address in @@ -93,37 +101,42 @@ * Return: Non-zero If the IP address was parsed. */ -extern bool uiplib_ipaddrconv(const char *addrstr, uint8_t *addr); +EXTERN bool uiplib_ipaddrconv(const char *addrstr, uint8_t *addr); /* Get and set IP/MAC addresses (Ethernet L2 only) */ #ifdef CONFIG_NET_ETHERNET -extern int uip_setmacaddr(const char *ifname, const uint8_t *macaddr); -extern int uip_getmacaddr(const char *ifname, uint8_t *macaddr); +EXTERN int uip_setmacaddr(const char *ifname, const uint8_t *macaddr); +EXTERN int uip_getmacaddr(const char *ifname, uint8_t *macaddr); #endif /* IP address support */ #ifdef CONFIG_NET_IPv6 -extern int uip_gethostaddr(const char *ifname, struct in6_addr *addr); -extern int uip_sethostaddr(const char *ifname, const struct in6_addr *addr); -extern int uip_setdraddr(const char *ifname, const struct in6_addr *addr); -extern int uip_setnetmask(const char *ifname, const struct in6_addr *addr); +EXTERN int uip_gethostaddr(const char *ifname, struct in6_addr *addr); +EXTERN int uip_sethostaddr(const char *ifname, const struct in6_addr *addr); +EXTERN int uip_setdraddr(const char *ifname, const struct in6_addr *addr); +EXTERN int uip_setnetmask(const char *ifname, const struct in6_addr *addr); #else -extern int uip_gethostaddr(const char *ifname, struct in_addr *addr); -extern int uip_sethostaddr(const char *ifname, const struct in_addr *addr); -extern int uip_setdraddr(const char *ifname, const struct in_addr *addr); -extern int uip_setnetmask(const char *ifname, const struct in_addr *addr); +EXTERN int uip_gethostaddr(const char *ifname, struct in_addr *addr); +EXTERN int uip_sethostaddr(const char *ifname, const struct in_addr *addr); +EXTERN int uip_setdraddr(const char *ifname, const struct in_addr *addr); +EXTERN int uip_setnetmask(const char *ifname, const struct in_addr *addr); #endif /* HTTP support */ -extern int uip_parsehttpurl(const char *url, uint16_t *port, +EXTERN int uip_parsehttpurl(const char *url, uint16_t *port, char *hostname, int hostlen, char *filename, int namelen); /* Generic server logic */ -extern void uip_server(uint16_t portno, pthread_startroutine_t handler, int stacksize); +EXTERN void uip_server(uint16_t portno, pthread_startroutine_t handler, int stacksize); -#endif /* __APPS_NETUTILS_UIPLIB_H */ +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __APPS_INCLUDE_NETUTILS_UIPLIB_H */ diff --git a/include/netutils/webclient.h b/include/netutils/webclient.h index c80626e3b..5c07f20ab 100644 --- a/include/netutils/webclient.h +++ b/include/netutils/webclient.h @@ -1,9 +1,9 @@ /**************************************************************************** - * include/apps/netutils/webclient.h + * apps/include/netutils/webclient.h * Header file for the HTTP client * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Based remotely on the uIP webclient which also has a BSD style license: * @@ -39,8 +39,8 @@ * ****************************************************************************/ -#ifndef __APPS_NETUTILS_WEBCLIENT_H -#define __APPS_NETUTILS_WEBCLIENT_H +#ifndef __APPS_INCLUDE_NETUTILS_WEBCLIENT_H +#define __APPS_INCLUDE_NETUTILS_WEBCLIENT_H /**************************************************************************** * Included Files @@ -146,4 +146,4 @@ EXTERN int wget(FAR const char *url, FAR char *buffer, int buflen, } #endif -#endif /* __APPS_NETUTILS_WEBCLIENT_H */ +#endif /* __APPS_INCLUDE_NETUTILS_WEBCLIENT_H */ diff --git a/include/nsh.h b/include/nsh.h index 15f35963c..4b5a3cd31 100644 --- a/include/nsh.h +++ b/include/nsh.h @@ -1,8 +1,8 @@ /**************************************************************************** - * include/apps/nsh.h + * apps/include/nsh.h * * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __INCLUDE_APPS_NSHLIB_H -#define __INCLUDE_APPS_NSHLIB_H +#ifndef __APPS_INCLUDE_NSH_H +#define __APPS_INCLUDE_NSH_H /**************************************************************************** * Included Files @@ -118,4 +118,4 @@ EXTERN int nsh_telnetstart(void); } #endif -#endif /* __INCLUDE_APPS_NSHLIB_H */ +#endif /* __APPS_INCLUDE_NSH_H */ diff --git a/include/readline.h b/include/readline.h index a53eaf5f6..647778210 100644 --- a/include/readline.h +++ b/include/readline.h @@ -1,5 +1,5 @@ /**************************************************************************** - * include/apps/readline.h + * apps/include/readline.h * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __INCLUDE_APPS_READLINE_H -#define __INCLUDE_APPS_READLINE_H +#ifndef __APPS_INCLUDE_READLINE_H +#define __APPS_INCLUDE_READLINE_H /**************************************************************************** * Included Files @@ -97,4 +97,4 @@ EXTERN ssize_t readline(FAR char *buf, int buflen, FILE *instream, FILE *outstre } #endif -#endif /* __INCLUDE_APPS_READLINE_H */ +#endif /* __APPS_INCLUDE_READLINE_H */ diff --git a/include/tiff.h b/include/tiff.h index 353005599..378af9fe0 100644 --- a/include/tiff.h +++ b/include/tiff.h @@ -2,7 +2,7 @@ * apps/include/tiff.h * * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Reference: * "TIFF, Revision 6.0, Final," June 3, 1992, Adobe Developers Association.