1ebfedea0SLionel Sambuc /* This is an OS dependent, generated file */ 2ebfedea0SLionel Sambuc 3ebfedea0SLionel Sambuc 4ebfedea0SLionel Sambuc #ifndef __ROKEN_H__ 5ebfedea0SLionel Sambuc #define __ROKEN_H__ 6ebfedea0SLionel Sambuc 7ebfedea0SLionel Sambuc /* -*- C -*- */ 8ebfedea0SLionel Sambuc /* 9ebfedea0SLionel Sambuc * Copyright (c) 1995-2005 Kungliga Tekniska Högskolan 10ebfedea0SLionel Sambuc * (Royal Institute of Technology, Stockholm, Sweden). 11ebfedea0SLionel Sambuc * All rights reserved. 12ebfedea0SLionel Sambuc * 13ebfedea0SLionel Sambuc * Redistribution and use in source and binary forms, with or without 14ebfedea0SLionel Sambuc * modification, are permitted provided that the following conditions 15ebfedea0SLionel Sambuc * are met: 16ebfedea0SLionel Sambuc * 17ebfedea0SLionel Sambuc * 1. Redistributions of source code must retain the above copyright 18ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer. 19ebfedea0SLionel Sambuc * 20ebfedea0SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 21ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer in the 22ebfedea0SLionel Sambuc * documentation and/or other materials provided with the distribution. 23ebfedea0SLionel Sambuc * 24ebfedea0SLionel Sambuc * 3. Neither the name of the Institute nor the names of its contributors 25ebfedea0SLionel Sambuc * may be used to endorse or promote products derived from this software 26ebfedea0SLionel Sambuc * without specific prior written permission. 27ebfedea0SLionel Sambuc * 28ebfedea0SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 29ebfedea0SLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30ebfedea0SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31ebfedea0SLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 32ebfedea0SLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33ebfedea0SLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34ebfedea0SLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35ebfedea0SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36ebfedea0SLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 37ebfedea0SLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 38ebfedea0SLionel Sambuc * SUCH DAMAGE. 39ebfedea0SLionel Sambuc */ 40ebfedea0SLionel Sambuc 41ebfedea0SLionel Sambuc #include <stdio.h> 42ebfedea0SLionel Sambuc #include <stdlib.h> 43ebfedea0SLionel Sambuc #include <stdarg.h> 44ebfedea0SLionel Sambuc #include <stdint.h> 45ebfedea0SLionel Sambuc #include <string.h> 46ebfedea0SLionel Sambuc #include <signal.h> 47ebfedea0SLionel Sambuc 48ebfedea0SLionel Sambuc 49ebfedea0SLionel Sambuc 50ebfedea0SLionel Sambuc typedef int rk_socket_t; 51ebfedea0SLionel Sambuc 52ebfedea0SLionel Sambuc #define rk_closesocket(x) close(x) 53ebfedea0SLionel Sambuc #define rk_SOCK_IOCTL(s,c,a) ioctl((s),(c),(a)) 54ebfedea0SLionel Sambuc #define rk_IS_BAD_SOCKET(s) ((s) < 0) 55ebfedea0SLionel Sambuc #define rk_IS_SOCKET_ERROR(rv) ((rv) < 0) 56ebfedea0SLionel Sambuc #define rk_SOCK_ERRNO errno 57ebfedea0SLionel Sambuc #define rk_INVALID_SOCKET (-1) 58ebfedea0SLionel Sambuc 59ebfedea0SLionel Sambuc #define rk_SOCK_INIT() 0 60ebfedea0SLionel Sambuc #define rk_SOCK_EXIT() do { } while(0) 61ebfedea0SLionel Sambuc 62ebfedea0SLionel Sambuc 63*0a6a1f1dSLionel Sambuc #define IN_LOOPBACKNET 127 64*0a6a1f1dSLionel Sambuc 65ebfedea0SLionel Sambuc 66ebfedea0SLionel Sambuc #define UNREACHABLE(x) 67ebfedea0SLionel Sambuc #define UNUSED_ARGUMENT(x) 68ebfedea0SLionel Sambuc 69ebfedea0SLionel Sambuc 70ebfedea0SLionel Sambuc #include <sys/param.h> 71ebfedea0SLionel Sambuc #include <inttypes.h> 72ebfedea0SLionel Sambuc #include <sys/types.h> 73ebfedea0SLionel Sambuc #include <unistd.h> 74ebfedea0SLionel Sambuc #include <sys/socket.h> 75ebfedea0SLionel Sambuc #include <sys/uio.h> 76ebfedea0SLionel Sambuc #include <grp.h> 77ebfedea0SLionel Sambuc #include <sys/stat.h> 78ebfedea0SLionel Sambuc #include <netinet/in.h> 79ebfedea0SLionel Sambuc #include <arpa/inet.h> 80ebfedea0SLionel Sambuc #include <netdb.h> 81ebfedea0SLionel Sambuc #include <arpa/nameser.h> 82ebfedea0SLionel Sambuc #include <resolv.h> 83ebfedea0SLionel Sambuc #include <syslog.h> 84ebfedea0SLionel Sambuc #include <fcntl.h> 85ebfedea0SLionel Sambuc #include <errno.h> 86ebfedea0SLionel Sambuc #include <err.h> 87ebfedea0SLionel Sambuc #include <termios.h> 88ebfedea0SLionel Sambuc #include <sys/ioctl.h> 89ebfedea0SLionel Sambuc #include <sys/time.h> 90ebfedea0SLionel Sambuc #include <time.h> 91ebfedea0SLionel Sambuc 92ebfedea0SLionel Sambuc #include <paths.h> 93ebfedea0SLionel Sambuc 94ebfedea0SLionel Sambuc #include <dirent.h> 95ebfedea0SLionel Sambuc 96ebfedea0SLionel Sambuc 97ebfedea0SLionel Sambuc 98ebfedea0SLionel Sambuc #include <krb5/roken-common.h> 99ebfedea0SLionel Sambuc 100ebfedea0SLionel Sambuc ROKEN_CPP_START 101ebfedea0SLionel Sambuc 102ebfedea0SLionel Sambuc #define rk_UNCONST(x) ((void *)(uintptr_t)(const void *)(x)) 103ebfedea0SLionel Sambuc 104ebfedea0SLionel Sambuc 105ebfedea0SLionel Sambuc 106ebfedea0SLionel Sambuc 107ebfedea0SLionel Sambuc 108ebfedea0SLionel Sambuc 109ebfedea0SLionel Sambuc 110ebfedea0SLionel Sambuc 111ebfedea0SLionel Sambuc 112ebfedea0SLionel Sambuc 113ebfedea0SLionel Sambuc 114ebfedea0SLionel Sambuc 115ebfedea0SLionel Sambuc #define asnprintf rk_asnprintf 116ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 117ebfedea0SLionel Sambuc rk_asnprintf (char **, size_t, const char *, ...) 118ebfedea0SLionel Sambuc __attribute__ ((format (printf, 3, 4))); 119ebfedea0SLionel Sambuc 120ebfedea0SLionel Sambuc #define vasnprintf rk_vasnprintf 121ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 122ebfedea0SLionel Sambuc vasnprintf (char **, size_t, const char *, va_list) 123ebfedea0SLionel Sambuc __attribute__((format (printf, 3, 0))); 124ebfedea0SLionel Sambuc 125ebfedea0SLionel Sambuc 126ebfedea0SLionel Sambuc 127ebfedea0SLionel Sambuc #define strlwr rk_strlwr 128ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strlwr(char *); 129ebfedea0SLionel Sambuc 130ebfedea0SLionel Sambuc 131ebfedea0SLionel Sambuc 132ebfedea0SLionel Sambuc #define strsep_copy rk_strsep_copy 133ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL strsep_copy(const char**, const char*, char*, size_t); 134ebfedea0SLionel Sambuc 135ebfedea0SLionel Sambuc 136ebfedea0SLionel Sambuc 137ebfedea0SLionel Sambuc 138ebfedea0SLionel Sambuc #define strupr rk_strupr 139ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strupr(char *); 140ebfedea0SLionel Sambuc 141ebfedea0SLionel Sambuc 142ebfedea0SLionel Sambuc 143ebfedea0SLionel Sambuc 144ebfedea0SLionel Sambuc 145ebfedea0SLionel Sambuc #define rk_strerror_r strerror_r 146ebfedea0SLionel Sambuc 147ebfedea0SLionel Sambuc 148ebfedea0SLionel Sambuc 149ebfedea0SLionel Sambuc 150ebfedea0SLionel Sambuc 151ebfedea0SLionel Sambuc 152ebfedea0SLionel Sambuc 153ebfedea0SLionel Sambuc #include <pwd.h> 154ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION struct passwd * ROKEN_LIB_CALL k_getpwnam (const char *); 155ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION struct passwd * ROKEN_LIB_CALL k_getpwuid (uid_t); 156ebfedea0SLionel Sambuc 157ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL get_default_username (void); 158ebfedea0SLionel Sambuc 159ebfedea0SLionel Sambuc 160ebfedea0SLionel Sambuc 161ebfedea0SLionel Sambuc 162ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL mkstemp(char *); 163ebfedea0SLionel Sambuc 164ebfedea0SLionel Sambuc 165ebfedea0SLionel Sambuc 166ebfedea0SLionel Sambuc 167ebfedea0SLionel Sambuc #define rk_rename(__rk_rn_from,__rk_rn_to) rename(__rk_rn_from,__rk_rn_to) 168ebfedea0SLionel Sambuc 169ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL daemon(int, int); 170ebfedea0SLionel Sambuc 171ebfedea0SLionel Sambuc 172ebfedea0SLionel Sambuc 173ebfedea0SLionel Sambuc 174ebfedea0SLionel Sambuc 175ebfedea0SLionel Sambuc 176ebfedea0SLionel Sambuc 177ebfedea0SLionel Sambuc 178ebfedea0SLionel Sambuc 179ebfedea0SLionel Sambuc 180ebfedea0SLionel Sambuc 181ebfedea0SLionel Sambuc 182ebfedea0SLionel Sambuc 183ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION time_t ROKEN_LIB_CALL tm2time (struct tm, int); 184ebfedea0SLionel Sambuc 185ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unix_verify_user(char *, char *); 186ebfedea0SLionel Sambuc 187ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_concat (char *, size_t, ...); 188ebfedea0SLionel Sambuc 189ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL roken_mconcat (char **, size_t, ...); 190ebfedea0SLionel Sambuc 191ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_vconcat (char *, size_t, va_list); 192ebfedea0SLionel Sambuc 193ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL 194ebfedea0SLionel Sambuc roken_vmconcat (char **, size_t, va_list); 195ebfedea0SLionel Sambuc 196ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 197ebfedea0SLionel Sambuc net_write (rk_socket_t, const void *, size_t); 198ebfedea0SLionel Sambuc 199ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 200ebfedea0SLionel Sambuc net_read (rk_socket_t, void *, size_t); 201ebfedea0SLionel Sambuc 202ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 203ebfedea0SLionel Sambuc issuid(void); 204ebfedea0SLionel Sambuc 205ebfedea0SLionel Sambuc 206ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL get_window_size(int fd, int *, int *); 207ebfedea0SLionel Sambuc 208ebfedea0SLionel Sambuc 209ebfedea0SLionel Sambuc 210ebfedea0SLionel Sambuc 211ebfedea0SLionel Sambuc #define getipnodebyname rk_getipnodebyname 212ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL 213ebfedea0SLionel Sambuc getipnodebyname (const char *, int, int, int *); 214ebfedea0SLionel Sambuc 215ebfedea0SLionel Sambuc #define getipnodebyaddr rk_getipnodebyaddr 216ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL 217ebfedea0SLionel Sambuc getipnodebyaddr (const void *, size_t, int, int *); 218ebfedea0SLionel Sambuc 219ebfedea0SLionel Sambuc #define freehostent rk_freehostent 220ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 221ebfedea0SLionel Sambuc freehostent (struct hostent *); 222ebfedea0SLionel Sambuc 223ebfedea0SLionel Sambuc #define copyhostent rk_copyhostent 224ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL 225ebfedea0SLionel Sambuc copyhostent (const struct hostent *); 226ebfedea0SLionel Sambuc 227ebfedea0SLionel Sambuc 228ebfedea0SLionel Sambuc 229ebfedea0SLionel Sambuc 230ebfedea0SLionel Sambuc 231ebfedea0SLionel Sambuc 232ebfedea0SLionel Sambuc 233ebfedea0SLionel Sambuc 234ebfedea0SLionel Sambuc 235ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 236ebfedea0SLionel Sambuc getnameinfo_verified(const struct sockaddr *, socklen_t, 237ebfedea0SLionel Sambuc char *, size_t, 238ebfedea0SLionel Sambuc char *, size_t, 239ebfedea0SLionel Sambuc int); 240ebfedea0SLionel Sambuc 241ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 242ebfedea0SLionel Sambuc roken_getaddrinfo_hostspec(const char *, int, struct addrinfo **); 243ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 244ebfedea0SLionel Sambuc roken_getaddrinfo_hostspec2(const char *, int, int, struct addrinfo **); 245ebfedea0SLionel Sambuc 246ebfedea0SLionel Sambuc 247ebfedea0SLionel Sambuc 248ebfedea0SLionel Sambuc 249ebfedea0SLionel Sambuc #define emalloc rk_emalloc 250ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL emalloc (size_t); 251ebfedea0SLionel Sambuc #define ecalloc rk_ecalloc 252ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL ecalloc(size_t, size_t); 253ebfedea0SLionel Sambuc #define erealloc rk_erealloc 254ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL erealloc (void *, size_t); 255ebfedea0SLionel Sambuc #define estrdup rk_estrdup 256ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL estrdup (const char *); 257ebfedea0SLionel Sambuc 258ebfedea0SLionel Sambuc /* 259ebfedea0SLionel Sambuc * kludges and such 260ebfedea0SLionel Sambuc */ 261ebfedea0SLionel Sambuc 262ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 263ebfedea0SLionel Sambuc roken_gethostby_setup(const char*, const char*); 264ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION struct hostent* ROKEN_LIB_CALL 265ebfedea0SLionel Sambuc roken_gethostbyname(const char*); 266ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION struct hostent* ROKEN_LIB_CALL 267ebfedea0SLionel Sambuc roken_gethostbyaddr(const void*, size_t, int); 268ebfedea0SLionel Sambuc 269ebfedea0SLionel Sambuc #define roken_getservbyname(x,y) getservbyname(x,y) 270ebfedea0SLionel Sambuc 271ebfedea0SLionel Sambuc #define roken_openlog(a,b,c) openlog(a,b,c) 272ebfedea0SLionel Sambuc 273ebfedea0SLionel Sambuc #define roken_getsockname(a,b,c) getsockname(a,b,c) 274ebfedea0SLionel Sambuc 275ebfedea0SLionel Sambuc 276ebfedea0SLionel Sambuc 277ebfedea0SLionel Sambuc 278ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 279ebfedea0SLionel Sambuc mini_inetd_addrinfo (struct addrinfo*, rk_socket_t *); 280ebfedea0SLionel Sambuc 281ebfedea0SLionel Sambuc ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 282ebfedea0SLionel Sambuc mini_inetd (int, rk_socket_t *); 283ebfedea0SLionel Sambuc 284ebfedea0SLionel Sambuc 285ebfedea0SLionel Sambuc 286ebfedea0SLionel Sambuc 287ebfedea0SLionel Sambuc 288ebfedea0SLionel Sambuc 289ebfedea0SLionel Sambuc 290ebfedea0SLionel Sambuc 291ebfedea0SLionel Sambuc 292ebfedea0SLionel Sambuc 293ebfedea0SLionel Sambuc 294ebfedea0SLionel Sambuc 295ebfedea0SLionel Sambuc 296ebfedea0SLionel Sambuc #ifdef HAVE_NBTOOL_CONFIG_H 297ebfedea0SLionel Sambuc #define rk_random() 0 298ebfedea0SLionel Sambuc #else 299ebfedea0SLionel Sambuc #define rk_random() arc4random() 300ebfedea0SLionel Sambuc #endif 301ebfedea0SLionel Sambuc 302ebfedea0SLionel Sambuc 303ebfedea0SLionel Sambuc 304ebfedea0SLionel Sambuc 305ebfedea0SLionel Sambuc ROKEN_CPP_END 306ebfedea0SLionel Sambuc 307ebfedea0SLionel Sambuc #endif /* __ROKEN_H__ */ 308