nexmon – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /* source: sysutils.h */
2 /* Copyright Gerhard Rieger */
3 /* Published under the GNU General Public License V.2, see file COPYING */
4  
5 #ifndef __sysutils_h_included
6 #define __sysutils_h_included 1
7  
8 #if WITH_IP6
9 /* not all OSes provide in6_addr that allows splitting to 16 or 32 bit junks of
10 the host address part of sockaddr_in6; here we help ourselves */
11 union xioin6_u {
12 uint8_t u6_addr8[16];
13 uint16_t u6_addr16[8];
14 uint32_t u6_addr32[4];
15 } ;
16 #endif /* WITH_IP6 */
17  
18 #if _WITH_SOCKET
19 union sockaddr_union {
20 struct sockaddr soa;
21 #if _WITH_UNIX
22 struct sockaddr_un un;
23 #endif /* _WITH_UNIX */
24 #if _WITH_IP4
25 struct sockaddr_in ip4;
26 #endif /* _WITH_IP4 */
27 #if _WITH_IP6
28 struct sockaddr_in6 ip6;
29 #endif /* _WITH_IP6 */
30 #if WITH_INTERFACE
31 struct sockaddr_ll ll;
32 #endif
33  
34 } ;
35 #endif /* _WITH_SOCKET */
36  
37 #if _WITH_SOCKET
38 struct xiorange {
39 union sockaddr_union netaddr;
40 union sockaddr_union netmask;
41 } ;
42 #endif /* _WITH_SOCKET */
43  
44 extern ssize_t writefull(int fd, const void *buff, size_t bytes);
45  
46 #if _WITH_SOCKET
47 extern socklen_t socket_init(int af, union sockaddr_union *sa);
48 #endif
49 #if WITH_UNIX
50 extern void socket_un_init(struct sockaddr_un *sa);
51 #endif /* WITH_UNIX */
52 #if _WITH_IP4
53 extern void socket_in_init(struct sockaddr_in *sa);
54 #endif /* _WITH_IP4 */
55 #if _WITH_IP6
56 extern void socket_in6_init(struct sockaddr_in6 *sa);
57 #endif /* _WITH_IP4 */
58  
59 #if _WITH_SOCKET
60 extern char *sockaddr_info(const struct sockaddr *sa, socklen_t salen, char *buff, size_t blen);
61 #endif
62 #if WITH_UNIX
63 extern char *sockaddr_unix_info(const struct sockaddr_un *sa, socklen_t salen, char *buff, size_t blen);
64 #endif /* WITH_UNIX */
65 #if WITH_IP4
66 extern char *inet4addr_info(uint32_t addr, char *buff, size_t blen);
67 extern char *sockaddr_inet4_info(const struct sockaddr_in *sa, char *buff, size_t blen);
68 #endif /* WITH_IP4 */
69 #if WITH_IP6
70 extern char *sockaddr_inet6_info(const struct sockaddr_in6 *sa, char *buff, size_t blen);
71 #endif /* WITH_IP6 */
72 #if !HAVE_INET_NTOP
73 extern const char *inet_ntop(int pf, const void *binaddr,
74 char *addrtext, socklen_t textlen);
75 #endif
76  
77 #if defined(HAVE_SETGRENT) && defined(HAVE_GETGRENT) && defined(HAVE_ENDGRENT)
78 extern int getusergroups(const char *user, gid_t *list, int *ngroups);
79 #endif
80  
81 #if !HAVE_HSTRERROR
82 extern const char *hstrerror(int err);
83 #endif
84  
85 extern int xiopoll(struct pollfd fds[], unsigned long nfds, struct timeval *timeout);
86  
87 extern int parseport(const char *portname, int proto);
88  
89 extern int ifindexbyname(const char *ifname, int anysock);
90 extern int ifindex(const char *ifname, unsigned int *ifindex, int anysock);
91  
92 extern int xiosetenv(const char *varname, const char *value, int overwrite, const char *sep);
93 extern int
94 xiosetenv2(const char *varname, const char *varname2, const char *value,
95 int overwrite, const char *sep);
96 extern int
97 xiosetenv3(const char *varname, const char *varname2, const char *varname3,
98 const char *value, int overwrite, const char *sep);
99 extern int xiosetenvulong(const char *varname, unsigned long value,
100 int overwrite);
101 extern int xiosetenvushort(const char *varname, unsigned short value,
102 int overwrite);
103  
104 #endif /* !defined(__sysutils_h_included) */