quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

curl_addrinfo.h (3381B)


      1 #ifndef HEADER_CURL_ADDRINFO_H
      2 #define HEADER_CURL_ADDRINFO_H
      3 /***************************************************************************
      4  *                                  _   _ ____  _
      5  *  Project                     ___| | | |  _ \| |
      6  *                             / __| | | | |_) | |
      7  *                            | (__| |_| |  _ <| |___
      8  *                             \___|\___/|_| \_\_____|
      9  *
     10  * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
     11  *
     12  * This software is licensed as described in the file COPYING, which
     13  * you should have received as part of this distribution. The terms
     14  * are also available at https://curl.se/docs/copyright.html.
     15  *
     16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
     17  * copies of the Software, and permit persons to whom the Software is
     18  * furnished to do so, under the terms of the COPYING file.
     19  *
     20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
     21  * KIND, either express or implied.
     22  *
     23  * SPDX-License-Identifier: curl
     24  *
     25  ***************************************************************************/
     26 
     27 #include "curl_setup.h"
     28 
     29 #ifdef HAVE_NETINET_IN_H
     30 #  include <netinet/in.h>
     31 #endif
     32 #ifdef HAVE_NETDB_H
     33 #  include <netdb.h>
     34 #endif
     35 #ifdef HAVE_ARPA_INET_H
     36 #  include <arpa/inet.h>
     37 #endif
     38 
     39 #ifdef __VMS
     40 #  include <in.h>
     41 #  include <inet.h>
     42 #  include <stdlib.h>
     43 #endif
     44 
     45 /*
     46  * Curl_addrinfo is our internal struct definition that we use to allow
     47  * consistent internal handling of this data. We use this even when the system
     48  * provides an addrinfo structure definition. We use this for all sorts of
     49  * IPv4 and IPV6 builds.
     50  */
     51 
     52 struct Curl_addrinfo {
     53   int                   ai_flags;
     54   int                   ai_family;
     55   int                   ai_socktype;
     56   int                   ai_protocol;
     57   curl_socklen_t        ai_addrlen;   /* Follow rfc3493 struct addrinfo */
     58   char                 *ai_canonname;
     59   struct sockaddr      *ai_addr;
     60   struct Curl_addrinfo *ai_next;
     61 };
     62 
     63 void
     64 Curl_freeaddrinfo(struct Curl_addrinfo *cahead);
     65 
     66 #ifdef HAVE_GETADDRINFO
     67 int
     68 Curl_getaddrinfo_ex(const char *nodename,
     69                     const char *servname,
     70                     const struct addrinfo *hints,
     71                     struct Curl_addrinfo **result);
     72 #endif
     73 
     74 #if !(defined(HAVE_GETADDRINFO) && defined(HAVE_GETADDRINFO_THREADSAFE))
     75 struct Curl_addrinfo *
     76 Curl_he2ai(const struct hostent *he, int port);
     77 #endif
     78 
     79 struct Curl_addrinfo *
     80 Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port);
     81 
     82 struct Curl_addrinfo *Curl_str2addr(char *dotted, int port);
     83 
     84 #ifdef USE_UNIX_SOCKETS
     85 struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath,
     86                                      bool abstract);
     87 #endif
     88 
     89 #if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) && \
     90     defined(HAVE_FREEADDRINFO)
     91 void
     92 curl_dbg_freeaddrinfo(struct addrinfo *freethis, int line, const char *source);
     93 #endif
     94 
     95 #if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO)
     96 int
     97 curl_dbg_getaddrinfo(const char *hostname, const char *service,
     98                      const struct addrinfo *hints, struct addrinfo **result,
     99                      int line, const char *source);
    100 #endif
    101 
    102 #ifdef HAVE_GETADDRINFO
    103 #ifdef USE_RESOLVE_ON_IPS
    104 void Curl_addrinfo_set_port(struct Curl_addrinfo *addrinfo, int port);
    105 #else
    106 #define Curl_addrinfo_set_port(x,y)
    107 #endif
    108 #endif
    109 
    110 #endif /* HEADER_CURL_ADDRINFO_H */