[rtems commit] libnetworking: Add <rtems/rtems_netdb.h>

Sebastian Huber sebh at rtems.org
Tue Jun 28 13:19:05 UTC 2016


Module:    rtems
Branch:    master
Commit:    7e6f2350eaa33d1a30f25a252b094c91569772f6
Changeset: http://git.rtems.org/rtems/commit/?id=7e6f2350eaa33d1a30f25a252b094c91569772f6

Author:    Christian Mauderer <Christian.Mauderer at embedded-brains.de>
Date:      Fri Apr 22 10:06:16 2016 +0200

libnetworking: Add <rtems/rtems_netdb.h>

Move prototypes of non-portable _get*by*name/addr and _set/end*ent
functions.  This makes it easier to update <netdb.h>.

---

 cpukit/libnetworking/Makefile.am          |  1 +
 cpukit/libnetworking/libc/gethostbydns.c  |  1 +
 cpukit/libnetworking/libc/gethostbyht.c   |  1 +
 cpukit/libnetworking/libc/gethostbynis.c  |  1 +
 cpukit/libnetworking/libc/gethostnamadr.c |  1 +
 cpukit/libnetworking/libc/getnetbydns.c   |  1 +
 cpukit/libnetworking/libc/getnetbyht.c    |  1 +
 cpukit/libnetworking/libc/getnetbynis.c   |  1 +
 cpukit/libnetworking/libc/getnetnamadr.c  |  1 +
 cpukit/libnetworking/libc/map_v4v6.c      |  1 +
 cpukit/libnetworking/netdb.h              | 22 -------------
 cpukit/libnetworking/preinstall.am        |  4 +++
 cpukit/libnetworking/rtems/rtems_netdb.h  | 52 +++++++++++++++++++++++++++++++
 13 files changed, 66 insertions(+), 22 deletions(-)

diff --git a/cpukit/libnetworking/Makefile.am b/cpukit/libnetworking/Makefile.am
index 4f3dd0c..c8c5f50 100644
--- a/cpukit/libnetworking/Makefile.am
+++ b/cpukit/libnetworking/Makefile.am
@@ -149,6 +149,7 @@ include_rtems_HEADERS += rtems/tftp.h
 include_rtems_HEADERS += rtems/ftpfs.h
 include_rtems_HEADERS += rtems/mkrootfs.h
 include_rtems_HEADERS += rtems/rtems_mii_ioctl.h
+include_rtems_HEADERS += rtems/rtems_netdb.h
 
 libnetworking_a_SOURCES += rtems/sghostname.c \
     rtems/rtems_glue.c rtems/rtems_malloc_mbuf.c rtems/rtems_syscall.c \
diff --git a/cpukit/libnetworking/libc/gethostbydns.c b/cpukit/libnetworking/libc/gethostbydns.c
index 68af27d..ba7291f 100644
--- a/cpukit/libnetworking/libc/gethostbydns.c
+++ b/cpukit/libnetworking/libc/gethostbydns.c
@@ -73,6 +73,7 @@
 #include <strings.h>
 #endif
 #include <netdb.h>
+#include <rtems/rtems_netdb.h>
 #include <resolv.h>
 #include <ctype.h>
 #include <errno.h>
diff --git a/cpukit/libnetworking/libc/gethostbyht.c b/cpukit/libnetworking/libc/gethostbyht.c
index 17723d7..2278e70 100644
--- a/cpukit/libnetworking/libc/gethostbyht.c
+++ b/cpukit/libnetworking/libc/gethostbyht.c
@@ -60,6 +60,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
+#include <rtems/rtems_netdb.h>
 #include <stdio.h>
 #include <stdlib.h> /* realloc, malloc, free */
 #include <ctype.h>
diff --git a/cpukit/libnetworking/libc/gethostbynis.c b/cpukit/libnetworking/libc/gethostbynis.c
index 1ae2e49..3a4195c 100644
--- a/cpukit/libnetworking/libc/gethostbynis.c
+++ b/cpukit/libnetworking/libc/gethostbynis.c
@@ -32,6 +32,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
+#include <rtems/rtems_netdb.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
diff --git a/cpukit/libnetworking/libc/gethostnamadr.c b/cpukit/libnetworking/libc/gethostnamadr.c
index d627cfb..ccf2f96 100644
--- a/cpukit/libnetworking/libc/gethostnamadr.c
+++ b/cpukit/libnetworking/libc/gethostnamadr.c
@@ -32,6 +32,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
+#include <rtems/rtems_netdb.h>
 #include <stdio.h>
 #include <ctype.h>
 #include <errno.h>
diff --git a/cpukit/libnetworking/libc/getnetbydns.c b/cpukit/libnetworking/libc/getnetbydns.c
index 33ff993..a92fba6 100644
--- a/cpukit/libnetworking/libc/getnetbydns.c
+++ b/cpukit/libnetworking/libc/getnetbydns.c
@@ -70,6 +70,7 @@
 
 #include <stdio.h>
 #include <netdb.h>
+#include <rtems/rtems_netdb.h>
 #include <resolv.h>
 #include <ctype.h>
 #include <errno.h>
diff --git a/cpukit/libnetworking/libc/getnetbyht.c b/cpukit/libnetworking/libc/getnetbyht.c
index dbe2d68..4a388c7 100644
--- a/cpukit/libnetworking/libc/getnetbyht.c
+++ b/cpukit/libnetworking/libc/getnetbyht.c
@@ -51,6 +51,7 @@
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
 #include <netdb.h>
+#include <rtems/rtems_netdb.h>
 #include <stdio.h>
 #include <string.h>
 #ifdef HAVE_STRINGS_H
diff --git a/cpukit/libnetworking/libc/getnetbynis.c b/cpukit/libnetworking/libc/getnetbynis.c
index 3849a67..14f09bc 100644
--- a/cpukit/libnetworking/libc/getnetbynis.c
+++ b/cpukit/libnetworking/libc/getnetbynis.c
@@ -32,6 +32,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
+#include <rtems/rtems_netdb.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
diff --git a/cpukit/libnetworking/libc/getnetnamadr.c b/cpukit/libnetworking/libc/getnetnamadr.c
index eb98477..7cb1b1b 100644
--- a/cpukit/libnetworking/libc/getnetnamadr.c
+++ b/cpukit/libnetworking/libc/getnetnamadr.c
@@ -32,6 +32,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
+#include <rtems/rtems_netdb.h>
 #include <stdio.h>
 #include <ctype.h>
 #include <errno.h>
diff --git a/cpukit/libnetworking/libc/map_v4v6.c b/cpukit/libnetworking/libc/map_v4v6.c
index 0b13285..66287d4 100644
--- a/cpukit/libnetworking/libc/map_v4v6.c
+++ b/cpukit/libnetworking/libc/map_v4v6.c
@@ -67,6 +67,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <netdb.h>
+#include <rtems/rtems_netdb.h>
 #include <resolv.h>
 #include <ctype.h>
 #include <errno.h>
diff --git a/cpukit/libnetworking/netdb.h b/cpukit/libnetworking/netdb.h
index 92e283b..303f200 100644
--- a/cpukit/libnetworking/netdb.h
+++ b/cpukit/libnetworking/netdb.h
@@ -168,28 +168,6 @@ int gethostbyname_r(const char*      name,
  */
 
 /* DO NOT USE THESE, THEY ARE SUBJECT TO CHANGE AND ARE NOT PORTABLE!!! */
-void	_sethosthtent(int);
-void	_endhosthtent(void);
-void	_sethostdnsent(int);
-void	_endhostdnsent(void);
-void	_setnethtent(int);
-void	_endnethtent(void);
-void	_setnetdnsent(int);
-void	_endnetdnsent(void);
-struct hostent * _gethostbyhtname(const char *, int);
-struct hostent * _gethostbydnsname(const char *, int);
-struct hostent * _gethostbynisname(const char *, int);
-struct hostent * _gethostbyhtaddr (const char *, int, int);
-struct hostent * _gethostbydnsaddr(const char *, int, int);
-struct hostent * _gethostbynisaddr(const char *, int, int);
-struct netent *  _getnetbyhtname (const char *);
-struct netent *  _getnetbydnsname(const char *);
-struct netent *  _getnetbynisname(const char *);
-struct netent *  _getnetbyhtaddr (unsigned long, int);
-struct netent *  _getnetbydnsaddr(unsigned long, int);
-struct netent *  _getnetbynisaddr(unsigned long, int);
-void _map_v4v6_address(const char *, char *);
-void _map_v4v6_hostent(struct hostent *, char **, int *len);
 __END_DECLS
 
 #endif /* !_NETDB_H_ */
diff --git a/cpukit/libnetworking/preinstall.am b/cpukit/libnetworking/preinstall.am
index 477b19a..f7bc342 100644
--- a/cpukit/libnetworking/preinstall.am
+++ b/cpukit/libnetworking/preinstall.am
@@ -310,6 +310,10 @@ $(PROJECT_INCLUDE)/rtems/rtems_mii_ioctl.h: rtems/rtems_mii_ioctl.h $(PROJECT_IN
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems_mii_ioctl.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems_mii_ioctl.h
 
+$(PROJECT_INCLUDE)/rtems/rtems_netdb.h: rtems/rtems_netdb.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems_netdb.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems_netdb.h
+
 $(PROJECT_INCLUDE)/sys/$(dirstamp):
 	@$(MKDIR_P) $(PROJECT_INCLUDE)/sys
 	@: > $(PROJECT_INCLUDE)/sys/$(dirstamp)
diff --git a/cpukit/libnetworking/rtems/rtems_netdb.h b/cpukit/libnetworking/rtems/rtems_netdb.h
new file mode 100644
index 0000000..ca4d3dd
--- /dev/null
+++ b/cpukit/libnetworking/rtems/rtems_netdb.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2016 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifndef _RTEMS_RTEMS_NETDB_H
+#define _RTEMS_RTEMS_NETDB_H
+
+#include <netdb.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* DO NOT USE THESE, THEY ARE SUBJECT TO CHANGE AND ARE NOT PORTABLE!!! */
+void	_sethosthtent(int);
+void	_endhosthtent(void);
+void	_sethostdnsent(int);
+void	_endhostdnsent(void);
+void	_setnethtent(int);
+void	_endnethtent(void);
+void	_setnetdnsent(int);
+void	_endnetdnsent(void);
+struct hostent * _gethostbyhtname(const char *, int);
+struct hostent * _gethostbydnsname(const char *, int);
+struct hostent * _gethostbynisname(const char *, int);
+struct hostent * _gethostbyhtaddr (const char *, int, int);
+struct hostent * _gethostbydnsaddr(const char *, int, int);
+struct hostent * _gethostbynisaddr(const char *, int, int);
+struct netent *  _getnetbyhtname (const char *);
+struct netent *  _getnetbydnsname(const char *);
+struct netent *  _getnetbynisname(const char *);
+struct netent *  _getnetbyhtaddr (unsigned long, int);
+struct netent *  _getnetbydnsaddr(unsigned long, int);
+struct netent *  _getnetbynisaddr(unsigned long, int);
+void _map_v4v6_address(const char *, char *);
+void _map_v4v6_hostent(struct hostent *, char **, int *len);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _RTEMS_RTEMS_NETDB_H */



More information about the vc mailing list