00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef SU_ADDRINFO_H
00031
00032 #define SU_ADDRINFO_H
00033
00042 #ifndef SU_TYPES_H
00043 #include <sofia-sip/su_types.h>
00044 #endif
00045
00046 #if SU_HAVE_BSDSOCK
00047 #include <netdb.h>
00048 #endif
00049
00050 SOFIA_BEGIN_DECLS
00051
00052 #if !SU_HAVE_ADDRINFO
00053
00054
00055
00056 #ifndef EAI_ADDRFAMILY
00057 #define EAI_ADDRFAMILY 1
00058 #define EAI_AGAIN 2
00059 #define EAI_BADFLAGS 3
00060 #define EAI_FAIL 4
00061 #define EAI_FAMILY 5
00062 #define EAI_MEMORY 6
00063 #define EAI_NODATA 7
00064 #define EAI_NONAME 8
00065 #define EAI_SERVICE 9
00066 #define EAI_SOCKTYPE 10
00067 #define EAI_SYSTEM 11
00068 #define EAI_BADHINTS 12
00069 #define EAI_PROTOCOL 13
00070 #define EAI_MAX 14
00071 #endif
00072
00073
00074
00075
00076 #ifndef AI_PASSIVE
00077 #define AI_PASSIVE 0x00000001
00078 #define AI_CANONNAME 0x00000002
00079 #define AI_NUMERICHOST 0x00000004
00080
00081 #define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
00082
00083 #define AI_ALL 0x00000100
00084 #define AI_V4MAPPED_CFG 0x00000200
00085 #define AI_ADDRCONFIG 0x00000400
00086 #define AI_V4MAPPED 0x00000800
00087
00088 #define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
00089 #endif
00090
00091
00092
00093
00094 #ifndef NI_MAXHOST
00095 #define NI_MAXHOST 1025
00096 #define NI_MAXSERV 32
00097 #endif
00098
00099
00100
00101
00102 #ifndef NI_NOFQDN
00103 #define NI_NOFQDN 0x00000001
00104 #define NI_NUMERICHOST 0x00000002
00105 #define NI_NAMEREQD 0x00000004
00106 #define NI_NUMERICSERV 0x00000008
00107 #define NI_DGRAM 0x00000010
00108 #endif
00109
00110 struct addrinfo {
00111 int ai_flags;
00112 int ai_family;
00113 int ai_socktype;
00114 int ai_protocol;
00115 size_t ai_addrlen;
00116 char *ai_canonname;
00117 struct sockaddr *ai_addr;
00118 struct addrinfo *ai_next;
00119 };
00120 #endif
00121
00122 #ifndef EAI_BADHINTS
00123 #define EAI_BADHINTS 10012
00124 #endif
00125 #ifndef EAI_PROTOCOL
00126 #define EAI_PROTOCOL 10013
00127 #endif
00128
00129 #ifndef AI_MASK
00130 #define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
00131 #endif
00132
00134 typedef struct addrinfo su_addrinfo_t;
00135
00137 SOFIAPUBFUN
00138 int su_getaddrinfo(char const *node, char const *service,
00139 su_addrinfo_t const *hints,
00140 su_addrinfo_t **res);
00142 SOFIAPUBFUN void su_freeaddrinfo(su_addrinfo_t *res);
00143
00145 SOFIAPUBFUN char const *su_gai_strerror(int errcode);
00146
00147 union su_sockaddr_u;
00148
00149 SOFIAPUBFUN
00150 int su_getnameinfo(const union su_sockaddr_u *su, size_t sulen,
00151 char *host, size_t hostlen,
00152 char *serv, size_t servlen,
00153 int flags);
00154
00155 SOFIA_END_DECLS
00156
00157 #endif