Libinfo-538.tar.gz
[apple/libinfo.git] / Libinfo / pseudo_public.h
1 /*
2 Copyright (c) 2018 Apple Inc. All rights reserved.
3
4 This pseduo-header file contains declarations for public symbols that are exported in libsystem_info.dylib but don't have
5 a proper header file in the Libinfo project. These symbols are typically declared in header files installed by other
6 projects. The purpose of this file is to allow InstallAPI, which parses header files to infer the symbols exported by a
7 library, to know about these symbols.
8 */
9
10
11 #include <arpa/inet.h>
12 #include <fstab.h>
13 #include <net/ethernet.h>
14 #include <net/if.h>
15 #include <netinet/in.h>
16 #include <stdio.h>
17 #include <unistd.h>
18
19 // Declared in /usr/include/arpa/inet.h
20 // Note: These are currently implemented as macros based on machine endianness. Include for completeness.
21
22 #undef ntohl
23 uint32_t ntohl(uint32_t x);
24 #undef htonl
25 uint32_t htonl(uint32_t x);
26 #undef ntohs
27 uint16_t ntohs(uint16_t x);
28 #undef htons
29 uint16_t htons(uint16_t x);
30
31
32 // Declared in /usr/include/fstab.h
33
34 void endfsent(void);
35 struct fstab * getfsent(void);
36 struct fstab * getfsfile(const char *file);
37 struct fstab * getfsspec(const char *spec);
38 int setfsent(void);
39
40
41 // Declared in /usr/include/net/ethernet.h
42
43 struct ether_addr * ether_aton(const char *s);
44 int ether_hostton(const char *name, struct ether_addr *e);
45 int ether_line(const char *s, struct ether_addr *e, char *hostname);
46 char * ether_ntoa(const struct ether_addr *e);
47 int ether_ntohost(char *name, const struct ether_addr *e);
48
49
50 // Declared in /usr/include/net/if.h
51
52 void if_freenameindex(struct if_nameindex *ptr);
53 char * if_indextoname(unsigned int ifindex, char *ifname);
54 struct if_nameindex * if_nameindex(void);
55 unsigned int if_nametoindex(const char *ifname);
56
57
58 // Declared in /usr/include/netinet/in.h
59
60 extern const struct in6_addr in6addr_any;
61 extern const struct in6_addr in6addr_linklocal_allnodes;
62 extern const struct in6_addr in6addr_linklocal_allrouters;
63 extern const struct in6_addr in6addr_linklocal_allv2routers;
64 extern const struct in6_addr in6addr_loopback;
65 extern const struct in6_addr in6addr_nodelocal_allnodes;
66
67 int inet6_opt_append(void *extbuf, socklen_t extlen, int offset, u_int8_t type, socklen_t len, u_int8_t align, void **databufp);
68 int inet6_opt_find(void *extbuf, socklen_t extlen, int offset, u_int8_t type, socklen_t *lenp, void **databufp);
69 int inet6_opt_finish(void *extbuf, socklen_t extlen, int offset);
70 int inet6_opt_get_val(void *databuf, int offset, void *val, socklen_t vallen);
71 int inet6_opt_init(void *extbuf, socklen_t extlen);
72 int inet6_opt_next(void *extbuf, socklen_t extlen, int offset, u_int8_t *typep, socklen_t *lenp, void **databufp);
73 int inet6_opt_set_val(void *databuf, int offset, void *val, socklen_t vallen);
74 u_int8_t * inet6_option_alloc(struct cmsghdr *cmsg, int datalen, int multx, int plusy);
75 int inet6_option_append(struct cmsghdr *cmsg, const u_int8_t *typep, int multx, int plusy);
76 int inet6_option_find(const struct cmsghdr *cmsg, u_int8_t **tptrp, int type);
77 int inet6_option_init(void *bp, struct cmsghdr **cmsgp, int type);
78 int inet6_option_next(const struct cmsghdr *cmsg, u_int8_t **tptrp);
79 int inet6_option_space(int nbytes);
80 int inet6_rth_add(void *bp, const struct in6_addr *addr);
81 struct in6_addr * inet6_rth_getaddr(const void *bp, int idx);
82 void * inet6_rth_init(void *bp, socklen_t bp_len, int type, int segments);
83 int inet6_rth_reverse(const void *in, void *out);
84 int inet6_rth_segments(const void *bp);
85 socklen_t inet6_rth_space(int type, int segments);
86 int inet6_rthdr_add(struct cmsghdr *cmsg, const struct in6_addr *addr, u_int flags);
87 struct in6_addr * inet6_rthdr_getaddr(struct cmsghdr *cmsg, int idx);
88 int inet6_rthdr_getflags(const struct cmsghdr *cmsg, int idx);
89 struct cmsghdr * inet6_rthdr_init(void *bp, int type);
90 int inet6_rthdr_lasthop(struct cmsghdr *cmsg, unsigned int flags);
91 int inet6_rthdr_segments(const struct cmsghdr *cmsg);
92 size_t inet6_rthdr_space(int type, int seg);
93
94
95 // Declared in /usr/include/rpcsvc/yp.h
96
97 // bool_t xdr_keydat(XDR *xdrs, keydat *objp)
98 int xdr_keydat(void *xdrs, void *objp);
99 // bool_t xdr_valdat(XDR *xdrs, valdat *objp)
100 int xdr_valdat(void *xdrs, void *objp);
101
102
103 // Declared in /usr/include/rpcsvc/yppasswd.h
104
105 // bool_t xdr_x_passwd(XDR *xdrs, x_passwd *objp)
106 int xdr_x_passwd(void *xdrs, void *objp);
107 // bool_t xdr_yppasswd(XDR *xdrs, yppasswd *objp)
108 int xdr_yppasswd(void *xdrs, void *objp);
109
110
111 // Declared in /usr/include/unistd.h
112
113 int getdomainname(char *val, int inlen);
114 int getgrouplist(const char *name, int basegid, int *groups, int *ngroups);
115 int initgroups(const char *name, int basegid);
116 int iruserok(unsigned long raddr, int superuser, const char *ruser, const char *luser);
117 int iruserok_sa(const void *ra, int rlen, int superuser, const char *ruser, const char *luser);
118 int rcmd(char **ahost, int rport, const char *locuser, const char *remuser, const char *cmd, int *fd2p);
119 int rcmd_af(char **ahost, int rport, const char *locuser, const char *remuser, const char *cmd, int *fd2p, int af);
120 int rresvport(int *port);
121 int rresvport_af(int *alport, int family);
122 int ruserok(const char *rhost, int superuser, const char *ruser, const char *luser);
123 int setdomainname(const char *name, int namelen);
124
125
126 // The following symbols are part of the resolv API that have somehow managed to remain in libinfo. There's no header that
127 // declares them. Yet, according to https://mariana.itunes.apple.com, some developers are still using some of them, so, for
128 // the time being, we'll include them here so that they continue to get exported in libsystem_info.dylib.
129 // Note: The current proper resolv library prefixes its symbol names with "res_9_" (see /usr/include/resolv.h).
130
131 extern char _res[];
132
133 int __dn_skipname(const u_char *comp_dn, const u_char *eom);
134 u_int32_t _getlong(const u_char *msgp);
135 u_int16_t _getshort(const u_char *msgp);
136 int dn_expand(const u_char *msg, const u_char *eomorig, const u_char *comp_dn, char *exp_dn, int length);
137 int res_init(void);
138 int res_query(const char *name, int class, int type, u_char *answer, int anslen);
139 int res_search(const char *name, int class, int type, u_char *answer, int anslen);