Libinfo-517.200.9.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_loopback;
64 extern const struct in6_addr in6addr_nodelocal_allnodes;
65
66 int inet6_opt_append(void *extbuf, socklen_t extlen, int offset, u_int8_t type, socklen_t len, u_int8_t align, void **databufp);
67 int inet6_opt_find(void *extbuf, socklen_t extlen, int offset, u_int8_t type, socklen_t *lenp, void **databufp);
68 int inet6_opt_finish(void *extbuf, socklen_t extlen, int offset);
69 int inet6_opt_get_val(void *databuf, int offset, void *val, socklen_t vallen);
70 int inet6_opt_init(void *extbuf, socklen_t extlen);
71 int inet6_opt_next(void *extbuf, socklen_t extlen, int offset, u_int8_t *typep, socklen_t *lenp, void **databufp);
72 int inet6_opt_set_val(void *databuf, int offset, void *val, socklen_t vallen);
73 u_int8_t * inet6_option_alloc(struct cmsghdr *cmsg, int datalen, int multx, int plusy);
74 int inet6_option_append(struct cmsghdr *cmsg, const u_int8_t *typep, int multx, int plusy);
75 int inet6_option_find(const struct cmsghdr *cmsg, u_int8_t **tptrp, int type);
76 int inet6_option_init(void *bp, struct cmsghdr **cmsgp, int type);
77 int inet6_option_next(const struct cmsghdr *cmsg, u_int8_t **tptrp);
78 int inet6_option_space(int nbytes);
79 int inet6_rth_add(void *bp, const struct in6_addr *addr);
80 struct in6_addr * inet6_rth_getaddr(const void *bp, int idx);
81 void * inet6_rth_init(void *bp, socklen_t bp_len, int type, int segments);
82 int inet6_rth_reverse(const void *in, void *out);
83 int inet6_rth_segments(const void *bp);
84 socklen_t inet6_rth_space(int type, int segments);
85 int inet6_rthdr_add(struct cmsghdr *cmsg, const struct in6_addr *addr, u_int flags);
86 struct in6_addr * inet6_rthdr_getaddr(struct cmsghdr *cmsg, int idx);
87 int inet6_rthdr_getflags(const struct cmsghdr *cmsg, int idx);
88 struct cmsghdr * inet6_rthdr_init(void *bp, int type);
89 int inet6_rthdr_lasthop(struct cmsghdr *cmsg, unsigned int flags);
90 int inet6_rthdr_segments(const struct cmsghdr *cmsg);
91 size_t inet6_rthdr_space(int type, int seg);
92
93
94 // Declared in /usr/include/rpcsvc/yp.h
95
96 // bool_t xdr_keydat(XDR *xdrs, keydat *objp)
97 int xdr_keydat(void *xdrs, void *objp);
98 // bool_t xdr_valdat(XDR *xdrs, valdat *objp)
99 int xdr_valdat(void *xdrs, void *objp);
100
101
102 // Declared in /usr/include/rpcsvc/yppasswd.h
103
104 // bool_t xdr_x_passwd(XDR *xdrs, x_passwd *objp)
105 int xdr_x_passwd(void *xdrs, void *objp);
106 // bool_t xdr_yppasswd(XDR *xdrs, yppasswd *objp)
107 int xdr_yppasswd(void *xdrs, void *objp);
108
109
110 // Declared in /usr/include/unistd.h
111
112 int getdomainname(char *val, int inlen);
113 int getgrouplist(const char *name, int basegid, int *groups, int *ngroups);
114 int initgroups(const char *name, int basegid);
115 int iruserok(unsigned long raddr, int superuser, const char *ruser, const char *luser);
116 int iruserok_sa(const void *ra, int rlen, int superuser, const char *ruser, const char *luser);
117 int rcmd(char **ahost, int rport, const char *locuser, const char *remuser, const char *cmd, int *fd2p);
118 int rcmd_af(char **ahost, int rport, const char *locuser, const char *remuser, const char *cmd, int *fd2p, int af);
119 int rresvport(int *port);
120 int rresvport_af(int *alport, int family);
121 int ruserok(const char *rhost, int superuser, const char *ruser, const char *luser);
122 int setdomainname(const char *name, int namelen);
123
124
125 // The following symbols are part of the resolv API that have somehow managed to remain in libinfo. There's no header that
126 // declares them. Yet, according to https://mariana.itunes.apple.com, some developers are still using some of them, so, for
127 // the time being, we'll include them here so that they continue to get exported in libsystem_info.dylib.
128 // Note: The current proper resolv library prefixes its symbol names with "res_9_" (see /usr/include/resolv.h).
129
130 extern char _res[];
131
132 int __dn_skipname(const u_char *comp_dn, const u_char *eom);
133 u_int32_t _getlong(const u_char *msgp);
134 u_int16_t _getshort(const u_char *msgp);
135 int dn_expand(const u_char *msg, const u_char *eomorig, const u_char *comp_dn, char *exp_dn, int length);
136 int res_init(void);
137 int res_query(const char *name, int class, int type, u_char *answer, int anslen);
138 int res_search(const char *name, int class, int type, u_char *answer, int anslen);