diff options
author | Himanshu40 <himanshuwindows8.1@gmail.com> | 2018-12-07 23:44:43 +0530 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2018-12-07 18:39:01 -0600 |
commit | aad6551b5efd639fbdbc85274555427c68960739 (patch) | |
tree | dd6982c3016e17efb0c24d91b809c2abc81732ee | |
parent | Implement POSIX API Signature Compliance Tests for uchar.h (diff) | |
download | rtems-aad6551b5efd639fbdbc85274555427c68960739.tar.bz2 |
psxhdrs: POSIX API Signature Compliance Tests for netdb.h (GCI 2018)
26 files changed, 1025 insertions, 1 deletions
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am index 736e8c4299..62378f1182 100644 --- a/testsuites/psxtests/Makefile.am +++ b/testsuites/psxtests/Makefile.am @@ -1579,7 +1579,30 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \ psxhdrs/inttypes/strtoimax.c \ psxhdrs/inttypes/strtoumax.c \ psxhdrs/inttypes/wcstoimax.c \ - psxhdrs/inttypes/wcstoumax.c + psxhdrs/inttypes/wcstoumax.c \ + psxhdrs/netdb/endhostent.c \ + psxhdrs/netdb/endnetent.c \ + psxhdrs/netdb/endprotoent.c \ + psxhdrs/netdb/endservent.c \ + psxhdrs/netdb/sethostent.c \ + psxhdrs/netdb/setnetent.c \ + psxhdrs/netdb/setservent.c \ + psxhdrs/netdb/gethostent.c \ + psxhdrs/netdb/getprotoent.c \ + psxhdrs/netdb/getnetent.c \ + psxhdrs/netdb/getservent.c \ + psxhdrs/netdb/freeaddrinfo.c \ + psxhdrs/netdb/gai_strerror.c \ + psxhdrs/netdb/getaddrinfo.c \ + psxhdrs/netdb/gethostbyaddr.c \ + psxhdrs/netdb/gethostbyname.c \ + psxhdrs/netdb/getnameinfo.c \ + psxhdrs/netdb/getnetbyname.c \ + psxhdrs/netdb/getprotobyname.c \ + psxhdrs/netdb/getprotobynumber.c \ + psxhdrs/netdb/getservbyname.c \ + psxhdrs/netdb/getservbyport.c \ + psxhdrs/netdb/h_errno.c ## Not supported by RTEMS, but POSIX API Compliance tests exist. diff --git a/testsuites/psxtests/psxhdrs/netdb/endhostent.c b/testsuites/psxtests/psxhdrs/netdb/endhostent.c new file mode 100644 index 0000000000..752aca1432 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/endhostent.c @@ -0,0 +1,40 @@ +/** + * @file + * @brief endhostent() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <sys/socket.h> + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct hostent *host; + + host = gethostent(); + sethostent( 1 ); + endhostent(); + + return ( host != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/endnetent.c b/testsuites/psxtests/psxhdrs/netdb/endnetent.c new file mode 100644 index 0000000000..6b46f772f3 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/endnetent.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief endnetent() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct netent *nent; + + nent = getnetent(); + setnetent( 1 ); + endnetent(); + + return ( nent != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/endprotoent.c b/testsuites/psxtests/psxhdrs/netdb/endprotoent.c new file mode 100644 index 0000000000..be0f55ef3e --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/endprotoent.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief endprotoent() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct protoent *protoc; + + protoc = getprotoent(); + setprotoent( 1 ); + endprotoent(); + + return ( protoc != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/endservent.c b/testsuites/psxtests/psxhdrs/netdb/endservent.c new file mode 100644 index 0000000000..71ea21efd4 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/endservent.c @@ -0,0 +1,40 @@ +/** + * @file + * @brief endservent() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <sys/socket.h> + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct servent *serv; + + serv = getservent(); + setservent( 1 ); + endservent(); + + return ( serv != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/freeaddrinfo.c b/testsuites/psxtests/psxhdrs/netdb/freeaddrinfo.c new file mode 100644 index 0000000000..2c04f33e84 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/freeaddrinfo.c @@ -0,0 +1,50 @@ +/** + * @file + * @brief freeaddrinfo() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <sys/types.h> + #include <sys/socket.h> + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct addrinfo hints; + struct addrinfo *finfo = (void *)0; + int result; + + hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ + hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */ + hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */ + hints.ai_protocol = 0; /* Any protocol */ + hints.ai_canonname = (void *)0; + hints.ai_addr = (void *)0; + hints.ai_next = (void *)0; + + result = getaddrinfo( (void *)0, (void *)0, &hints, &finfo ); + freeaddrinfo( finfo ); + + return result; + } diff --git a/testsuites/psxtests/psxhdrs/netdb/gai_strerror.c b/testsuites/psxtests/psxhdrs/netdb/gai_strerror.c new file mode 100644 index 0000000000..496a2d49e7 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/gai_strerror.c @@ -0,0 +1,40 @@ +/** + * @file + * @brief gai_strerror() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <sys/types.h> + #include <sys/socket.h> + #include <netdb.h> + + int test( void ); + + int test( void ) + { + int ecode = 2; + const char *result; + + result = gai_strerror( ecode ); + + return ( result != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/getaddrinfo.c b/testsuites/psxtests/psxhdrs/netdb/getaddrinfo.c new file mode 100644 index 0000000000..20695f6ad7 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/getaddrinfo.c @@ -0,0 +1,49 @@ +/** + * @file + * @brief getaddrinfo() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <sys/types.h> + #include <sys/socket.h> + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct addrinfo hints; + struct addrinfo *finfo = (void *)0; + int result; + + hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ + hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */ + hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */ + hints.ai_protocol = 0; /* Any protocol */ + hints.ai_canonname = (void *)0; + hints.ai_addr = (void *)0; + hints.ai_next = (void *)0; + + result = getaddrinfo( (void *)0, (void *)0, &hints, &finfo ); + + return result; + } diff --git a/testsuites/psxtests/psxhdrs/netdb/gethostbyaddr.c b/testsuites/psxtests/psxhdrs/netdb/gethostbyaddr.c new file mode 100644 index 0000000000..ff4e1f2834 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/gethostbyaddr.c @@ -0,0 +1,40 @@ +/** + * @file + * @brief gethostbyaddr() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <arpa/inet.h> + #include <sys/socket.h> + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct hostent *host; + struct in_addr ipv4addr; + + host = gethostbyaddr( &ipv4addr, sizeof(ipv4addr), AF_INET ); + + return ( host != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/gethostbyname.c b/testsuites/psxtests/psxhdrs/netdb/gethostbyname.c new file mode 100644 index 0000000000..21c58858e6 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/gethostbyname.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief gethostbyname() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <sys/socket.h> + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct hostent *host; + char *name = (void *)0; + + host = gethostbyname( name ); + + return ( host != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/gethostent.c b/testsuites/psxtests/psxhdrs/netdb/gethostent.c new file mode 100644 index 0000000000..8e61d9fbcf --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/gethostent.c @@ -0,0 +1,38 @@ +/** + * @file + * @brief getservent() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <sys/socket.h> + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct servent *serv; + + serv = getservent(); + + return ( serv != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/getnameinfo.c b/testsuites/psxtests/psxhdrs/netdb/getnameinfo.c new file mode 100644 index 0000000000..140f7863c2 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/getnameinfo.c @@ -0,0 +1,49 @@ +/** + * @file + * @brief getnameinfo() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <sys/socket.h> + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct sockaddr sa; + char host[1024]; + char service[20]; + int result; + + sa.sa_family = AF_INET; + + result = getnameinfo( &sa, + sizeof(sa), + host, + sizeof(host), + service, + sizeof(service), + 0 ); + + return result; + } diff --git a/testsuites/psxtests/psxhdrs/netdb/getnetbyaddr.c b/testsuites/psxtests/psxhdrs/netdb/getnetbyaddr.c new file mode 100644 index 0000000000..6f7adee7cf --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/getnetbyaddr.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief getnetbyaddr() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct netent *gnet; + uint32_t net = 2; + int type = 2; + + gnet = getnetbyaddr( net, type ); + + return ( gnet != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/getnetbyname.c b/testsuites/psxtests/psxhdrs/netdb/getnetbyname.c new file mode 100644 index 0000000000..7552aadd6e --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/getnetbyname.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief getnetbyname() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct netent *gnet; + char *name = "ipv4"; + + gnet = getnetbyname( name ); + (void) name; + + return ( gnet != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/getnetent.c b/testsuites/psxtests/psxhdrs/netdb/getnetent.c new file mode 100644 index 0000000000..9e15205a33 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/getnetent.c @@ -0,0 +1,37 @@ +/** + * @file + * @brief getnetent() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct netent *nent; + + nent = getnetent(); + + return ( nent != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/getprotobyname.c b/testsuites/psxtests/psxhdrs/netdb/getprotobyname.c new file mode 100644 index 0000000000..2379714b9c --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/getprotobyname.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief getprotobyname() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct protoent *pnet; + char *name = "ipv4"; + + pnet = getprotobyname( name ); + (void) name; + + return ( pnet != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/getprotobynumber.c b/testsuites/psxtests/psxhdrs/netdb/getprotobynumber.c new file mode 100644 index 0000000000..55db5e1421 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/getprotobynumber.c @@ -0,0 +1,38 @@ +/** + * @file + * @brief getprotobynumber() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct protoent *pnet; + int proto = 2; + + pnet = getprotobynumber( proto ); + + return ( pnet != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/getprotoent.c b/testsuites/psxtests/psxhdrs/netdb/getprotoent.c new file mode 100644 index 0000000000..699cd9e994 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/getprotoent.c @@ -0,0 +1,37 @@ +/** + * @file + * @brief getprotoent() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct protoent *protoc; + + protoc = getprotoent(); + + return ( protoc != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/getservbyname.c b/testsuites/psxtests/psxhdrs/netdb/getservbyname.c new file mode 100644 index 0000000000..afb5567862 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/getservbyname.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief getservbyname() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct servent *pserv; + char *name = "ip"; + char *proto = "ipv4"; + + pserv = getservbyname( name, proto ); + + return ( pserv != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/getservbyport.c b/testsuites/psxtests/psxhdrs/netdb/getservbyport.c new file mode 100644 index 0000000000..df4a013578 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/getservbyport.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief getservbyport() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct servent *pserv; + int port = 2; + char *proto = "ipv4"; + + pserv = getservbyport( port, proto ); + + return ( pserv != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/getservent.c b/testsuites/psxtests/psxhdrs/netdb/getservent.c new file mode 100644 index 0000000000..8e61d9fbcf --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/getservent.c @@ -0,0 +1,38 @@ +/** + * @file + * @brief getservent() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <sys/socket.h> + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct servent *serv; + + serv = getservent(); + + return ( serv != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/h_errno.c b/testsuites/psxtests/psxhdrs/netdb/h_errno.c new file mode 100644 index 0000000000..8b95b99849 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/h_errno.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief h_errno() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <sys/socket.h> + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct hostent *host; + + host = gethostent(); + sethostent( h_errno ); + + return ( host != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/sethostent.c b/testsuites/psxtests/psxhdrs/netdb/sethostent.c new file mode 100644 index 0000000000..8c4f319d00 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/sethostent.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief sethostent() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <sys/socket.h> + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct hostent *host; + + host = gethostent(); + sethostent( 1 ); + + return ( host != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/setnetent.c b/testsuites/psxtests/psxhdrs/netdb/setnetent.c new file mode 100644 index 0000000000..b6a8b7e63b --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/setnetent.c @@ -0,0 +1,38 @@ +/** + * @file + * @brief setnetent() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct netent *nent; + + nent = getnetent(); + setnetent( 1 ); + + return ( nent != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/setprotoent.c b/testsuites/psxtests/psxhdrs/netdb/setprotoent.c new file mode 100644 index 0000000000..f08cfec525 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/setprotoent.c @@ -0,0 +1,38 @@ +/** + * @file + * @brief setprotoent() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct protoent *protoc; + + protoc = getprotoent(); + setprotoent( 1 ); + + return ( protoc != (void *)0 ); + } diff --git a/testsuites/psxtests/psxhdrs/netdb/setservent.c b/testsuites/psxtests/psxhdrs/netdb/setservent.c new file mode 100644 index 0000000000..5599dd33ae --- /dev/null +++ b/testsuites/psxtests/psxhdrs/netdb/setservent.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief setservent() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <sys/socket.h> + #include <netdb.h> + + int test( void ); + + int test( void ) + { + struct servent *serv; + + serv = getservent(); + setservent( 1 ); + + return ( serv != (void *)0 ); + } |