]> andersk Git - openssh.git/blame - openbsd-compat/fake-rfc2553.h
- (djm) Merge all the openbsd/fake-* into fake-rfc2553.[ch]
[openssh.git] / openbsd-compat / fake-rfc2553.h
CommitLineData
52d58495 1/*
2 * Pseudo-implementation of RFC2553 name / address resolution functions
3 *
4 * But these functions are not implemented correctly. The minimum subset
5 * is implemented for ssh use only. For exapmle, this routine assumes
6 * that ai_family is AF_INET. Don't use it for another purpose.
7 */
8
9/* $Id$ */
10
11#ifndef _FAKE_RFC2553_H
12#define _FAKE_RFC2553_H
13
14#include "includes.h"
15#include "sys/types.h"
16
17/*
18 * First, socket and INET6 related definitions
19 */
20#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
21# define _SS_MAXSIZE 128 /* Implementation specific max size */
22# define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr))
23struct sockaddr_storage {
24 struct sockaddr ss_sa;
25 char __ss_pad2[_SS_PADSIZE];
26};
27# define ss_family ss_sa.sa_family
28#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */
29
30#ifndef IN6_IS_ADDR_LOOPBACK
31# define IN6_IS_ADDR_LOOPBACK(a) \
32 (((u_int32_t *)(a))[0] == 0 && ((u_int32_t *)(a))[1] == 0 && \
33 ((u_int32_t *)(a))[2] == 0 && ((u_int32_t *)(a))[3] == htonl(1))
34#endif /* !IN6_IS_ADDR_LOOPBACK */
35
36#ifndef HAVE_STRUCT_IN6_ADDR
37struct in6_addr {
38 u_int8_t s6_addr[16];
39};
40#endif /* !HAVE_STRUCT_IN6_ADDR */
41
42#ifndef HAVE_STRUCT_SOCKADDR_IN6
43struct sockaddr_in6 {
44 unsigned short sin6_family;
45 u_int16_t sin6_port;
46 u_int32_t sin6_flowinfo;
47 struct in6_addr sin6_addr;
48};
49#endif /* !HAVE_STRUCT_SOCKADDR_IN6 */
50
51#ifndef AF_INET6
52/* Define it to something that should never appear */
53#define AF_INET6 AF_MAX
54#endif
55
56/*
57 * Next, RFC2553 name / address resolution API
58 */
59
60#ifndef NI_NUMERICHOST
61# define NI_NUMERICHOST (1)
62# define NI_NAMEREQD (1<<1)
63# define NI_NUMERICSERV (1<<2)
64#endif
65#ifndef AI_PASSIVE
66# define AI_PASSIVE (1)
67# define AI_CANONNAME (1<<1)
68# define AI_NUMERICHOST (1<<2)
69#endif
70
71#ifndef NI_MAXSERV
72# define NI_MAXSERV 32
73#endif /* !NI_MAXSERV */
74#ifndef NI_MAXHOST
75# define NI_MAXHOST 1025
76#endif /* !NI_MAXHOST */
77
78#ifndef EAI_NODATA
79# define EAI_NODATA 1
80# define EAI_MEMORY 2
81#endif
82
83#ifndef HAVE_STRUCT_ADDRINFO
84struct addrinfo {
85 int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
86 int ai_family; /* PF_xxx */
87 int ai_socktype; /* SOCK_xxx */
88 int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
89 size_t ai_addrlen; /* length of ai_addr */
90 char *ai_canonname; /* canonical name for hostname */
91 struct sockaddr *ai_addr; /* binary address */
92 struct addrinfo *ai_next; /* next structure in linked list */
93};
94#endif /* !HAVE_STRUCT_ADDRINFO */
95
96#ifndef HAVE_GETADDRINFO
97int getaddrinfo(const char *, const char *,
98 const struct addrinfo *, struct addrinfo **);
99#endif /* !HAVE_GETADDRINFO */
100
101#ifndef HAVE_GAI_STRERROR
102char *gai_strerror(int);
103#endif /* !HAVE_GAI_STRERROR */
104
105#ifndef HAVE_FREEADDRINFO
106void freeaddrinfo(struct addrinfo *);
107#endif /* !HAVE_FREEADDRINFO */
108
109#ifndef HAVE_GETNAMEINFO
110int getnameinfo(const struct sockaddr *, size_t, char *, size_t,
111 char *, size_t, int);
112#endif /* !HAVE_GETNAMEINFO */
113
114#endif /* !_FAKE_RFC2553_H */
115
This page took 0.067531 seconds and 5 git commands to generate.