source: rtems/testsuites/psxtests/psxhdrs/netdb/getaddrinfo.c @ aad6551b

5
Last change on this file since aad6551b was aad6551b, checked in by Himanshu40 <himanshuwindows8.1@…>, on 12/07/18 at 18:14:43

psxhdrs: POSIX API Signature Compliance Tests for netdb.h (GCI 2018)

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 *  @file
3 *  @brief getaddrinfo() API Conformance Test
4 */
5
6/*
7 *  COPYRIGHT (c) 2018.
8 *  Himanshu Sekhar Nayak
9 *
10 *  Permission to use, copy, modify, and/or distribute this software
11 *  for any purpose with or without fee is hereby granted.
12 *
13 *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
14 *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
15 *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
16 *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
17 *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19 *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 */
21
22 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
25
26 #include <sys/types.h>
27 #include <sys/socket.h>
28 #include <netdb.h>
29
30 int test( void );
31
32 int test( void )
33 {
34   struct addrinfo hints;
35   struct addrinfo *finfo = (void *)0;
36   int result;
37
38   hints.ai_family = AF_UNSPEC;    /* Allow IPv4 or IPv6 */
39   hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */
40   hints.ai_flags = AI_PASSIVE;    /* For wildcard IP address */
41   hints.ai_protocol = 0;          /* Any protocol */
42   hints.ai_canonname = (void *)0;
43   hints.ai_addr = (void *)0;
44   hints.ai_next = (void *)0;
45
46   result = getaddrinfo( (void *)0, (void *)0, &hints, &finfo );
47
48   return result;
49 }
Note: See TracBrowser for help on using the repository browser.