roken.h.in revision 178825
155682Smarkm/* -*- C -*- */ 255682Smarkm/* 3178825Sdfr * Copyright (c) 1995-2005 Kungliga Tekniska H�gskolan 455682Smarkm * (Royal Institute of Technology, Stockholm, Sweden). 555682Smarkm * All rights reserved. 655682Smarkm * 755682Smarkm * Redistribution and use in source and binary forms, with or without 855682Smarkm * modification, are permitted provided that the following conditions 955682Smarkm * are met: 1055682Smarkm * 1155682Smarkm * 1. Redistributions of source code must retain the above copyright 1255682Smarkm * notice, this list of conditions and the following disclaimer. 1355682Smarkm * 1455682Smarkm * 2. Redistributions in binary form must reproduce the above copyright 1555682Smarkm * notice, this list of conditions and the following disclaimer in the 1655682Smarkm * documentation and/or other materials provided with the distribution. 1755682Smarkm * 1855682Smarkm * 3. Neither the name of the Institute nor the names of its contributors 1955682Smarkm * may be used to endorse or promote products derived from this software 2055682Smarkm * without specific prior written permission. 2155682Smarkm * 2255682Smarkm * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 2355682Smarkm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2455682Smarkm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2555682Smarkm * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 2655682Smarkm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2755682Smarkm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2855682Smarkm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2955682Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3055682Smarkm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3155682Smarkm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3255682Smarkm * SUCH DAMAGE. 3355682Smarkm */ 3455682Smarkm 35178825Sdfr/* $Id: roken.h.in 18612 2006-10-19 16:35:16Z lha $ */ 3655682Smarkm 3755682Smarkm#include <stdio.h> 3855682Smarkm#include <stdlib.h> 3955682Smarkm#include <stdarg.h> 40178825Sdfr#ifdef HAVE_STDINT_H 41178825Sdfr#include <stdint.h> 42178825Sdfr#endif 4355682Smarkm#include <string.h> 4455682Smarkm#include <signal.h> 4572445Sassar 4672445Sassar#ifdef _AIX 4772445Sassarstruct ether_addr; 4872445Sassarstruct sockaddr_dl; 4972445Sassar#endif 5055682Smarkm#ifdef HAVE_SYS_PARAM_H 5155682Smarkm#include <sys/param.h> 5255682Smarkm#endif 5378527Sassar#ifdef HAVE_INTTYPES_H 5478527Sassar#include <inttypes.h> 5578527Sassar#endif 5655682Smarkm#ifdef HAVE_SYS_TYPES_H 5755682Smarkm#include <sys/types.h> 5855682Smarkm#endif 5978527Sassar#ifdef HAVE_SYS_BITYPES_H 6078527Sassar#include <sys/bitypes.h> 6178527Sassar#endif 6278527Sassar#ifdef HAVE_BIND_BITYPES_H 6378527Sassar#include <bind/bitypes.h> 6478527Sassar#endif 6578527Sassar#ifdef HAVE_NETINET_IN6_MACHTYPES_H 6678527Sassar#include <netinet/in6_machtypes.h> 6778527Sassar#endif 6855682Smarkm#ifdef HAVE_UNISTD_H 6955682Smarkm#include <unistd.h> 7055682Smarkm#endif 7155682Smarkm#ifdef HAVE_SYS_SOCKET_H 7255682Smarkm#include <sys/socket.h> 7355682Smarkm#endif 7455682Smarkm#ifdef HAVE_SYS_UIO_H 7555682Smarkm#include <sys/uio.h> 7655682Smarkm#endif 7755682Smarkm#ifdef HAVE_GRP_H 7855682Smarkm#include <grp.h> 7955682Smarkm#endif 8055682Smarkm#ifdef HAVE_SYS_STAT_H 8155682Smarkm#include <sys/stat.h> 8255682Smarkm#endif 8355682Smarkm#ifdef HAVE_NETINET_IN_H 8455682Smarkm#include <netinet/in.h> 8555682Smarkm#endif 8655682Smarkm#ifdef HAVE_NETINET_IN6_H 8755682Smarkm#include <netinet/in6.h> 8855682Smarkm#endif 8955682Smarkm#ifdef HAVE_NETINET6_IN6_H 9055682Smarkm#include <netinet6/in6.h> 9155682Smarkm#endif 9255682Smarkm#ifdef HAVE_ARPA_INET_H 9355682Smarkm#include <arpa/inet.h> 9455682Smarkm#endif 9555682Smarkm#ifdef HAVE_NETDB_H 9655682Smarkm#include <netdb.h> 9755682Smarkm#endif 9890926Snectar#ifdef HAVE_ARPA_NAMESER_H 9990926Snectar#include <arpa/nameser.h> 10090926Snectar#endif 10190926Snectar#ifdef HAVE_RESOLV_H 10290926Snectar#include <resolv.h> 10390926Snectar#endif 10455682Smarkm#ifdef HAVE_SYSLOG_H 10555682Smarkm#include <syslog.h> 10655682Smarkm#endif 10755682Smarkm#ifdef HAVE_FCNTL_H 10855682Smarkm#include <fcntl.h> 10955682Smarkm#endif 11055682Smarkm#ifdef HAVE_ERRNO_H 11155682Smarkm#include <errno.h> 11255682Smarkm#endif 11355682Smarkm#include <err.h> 11455682Smarkm#ifdef HAVE_TERMIOS_H 11555682Smarkm#include <termios.h> 11655682Smarkm#endif 11755682Smarkm#if defined(HAVE_SYS_IOCTL_H) && SunOS != 40 11855682Smarkm#include <sys/ioctl.h> 11955682Smarkm#endif 12055682Smarkm#ifdef TIME_WITH_SYS_TIME 12155682Smarkm#include <sys/time.h> 12255682Smarkm#include <time.h> 12355682Smarkm#elif defined(HAVE_SYS_TIME_H) 12455682Smarkm#include <sys/time.h> 12555682Smarkm#else 12655682Smarkm#include <time.h> 12755682Smarkm#endif 128178825Sdfr#ifdef HAVE_STRINGS_H 129178825Sdfr#include <strings.h> 130178825Sdfr#endif 13155682Smarkm 13255682Smarkm#ifdef HAVE_PATHS_H 13355682Smarkm#include <paths.h> 13455682Smarkm#endif 13555682Smarkm 136102644Snectar#ifndef HAVE_SSIZE_T 137102644Snectartypedef int ssize_t; 138102644Snectar#endif 139102644Snectar 14055682Smarkm#include <roken-common.h> 14155682Smarkm 14272445SassarROKEN_CPP_START 14372445Sassar 144178825Sdfr#ifdef HAVE_UINTPTR_T 145178825Sdfr#define rk_UNCONST(x) ((void *)(uintptr_t)(const void *)(x)) 146178825Sdfr#else 147178825Sdfr#define rk_UNCONST(x) ((void *)(unsigned long)(const void *)(x)) 148178825Sdfr#endif 149178825Sdfr 15055682Smarkm#if !defined(HAVE_SETSID) && defined(HAVE__SETSID) 15155682Smarkm#define setsid _setsid 15255682Smarkm#endif 15355682Smarkm 15455682Smarkm#ifndef HAVE_PUTENV 155178825Sdfrint ROKEN_LIB_FUNCTION putenv(const char *); 15655682Smarkm#endif 15755682Smarkm 15855682Smarkm#if !defined(HAVE_SETENV) || defined(NEED_SETENV_PROTO) 159178825Sdfrint ROKEN_LIB_FUNCTION setenv(const char *, const char *, int); 16055682Smarkm#endif 16155682Smarkm 16255682Smarkm#if !defined(HAVE_UNSETENV) || defined(NEED_UNSETENV_PROTO) 163178825Sdfrvoid ROKEN_LIB_FUNCTION unsetenv(const char *); 16455682Smarkm#endif 16555682Smarkm 16655682Smarkm#if !defined(HAVE_GETUSERSHELL) || defined(NEED_GETUSERSHELL_PROTO) 167178825Sdfrchar * ROKEN_LIB_FUNCTION getusershell(void); 168178825Sdfrvoid ROKEN_LIB_FUNCTION endusershell(void); 16955682Smarkm#endif 17055682Smarkm 17155682Smarkm#if !defined(HAVE_SNPRINTF) || defined(NEED_SNPRINTF_PROTO) 172178825Sdfrint ROKEN_LIB_FUNCTION snprintf (char *, size_t, const char *, ...) 17355682Smarkm __attribute__ ((format (printf, 3, 4))); 17455682Smarkm#endif 17555682Smarkm 17655682Smarkm#if !defined(HAVE_VSNPRINTF) || defined(NEED_VSNPRINTF_PROTO) 177178825Sdfrint ROKEN_LIB_FUNCTION 178178825Sdfr vsnprintf (char *, size_t, const char *, va_list) 17955682Smarkm __attribute__((format (printf, 3, 0))); 18055682Smarkm#endif 18155682Smarkm 18255682Smarkm#if !defined(HAVE_ASPRINTF) || defined(NEED_ASPRINTF_PROTO) 183178825Sdfrint ROKEN_LIB_FUNCTION 184178825Sdfr asprintf (char **, const char *, ...) 18555682Smarkm __attribute__ ((format (printf, 2, 3))); 18655682Smarkm#endif 18755682Smarkm 18855682Smarkm#if !defined(HAVE_VASPRINTF) || defined(NEED_VASPRINTF_PROTO) 189178825Sdfrint ROKEN_LIB_FUNCTION 190178825Sdfr vasprintf (char **, const char *, va_list) 19155682Smarkm __attribute__((format (printf, 2, 0))); 19255682Smarkm#endif 19355682Smarkm 19455682Smarkm#if !defined(HAVE_ASNPRINTF) || defined(NEED_ASNPRINTF_PROTO) 195178825Sdfrint ROKEN_LIB_FUNCTION 196178825Sdfr asnprintf (char **, size_t, const char *, ...) 19755682Smarkm __attribute__ ((format (printf, 3, 4))); 19855682Smarkm#endif 19955682Smarkm 20055682Smarkm#if !defined(HAVE_VASNPRINTF) || defined(NEED_VASNPRINTF_PROTO) 201178825Sdfrint ROKEN_LIB_FUNCTION 202178825Sdfr vasnprintf (char **, size_t, const char *, va_list) 20355682Smarkm __attribute__((format (printf, 3, 0))); 20455682Smarkm#endif 20555682Smarkm 20655682Smarkm#ifndef HAVE_STRDUP 207178825Sdfrchar * ROKEN_LIB_FUNCTION strdup(const char *); 20855682Smarkm#endif 20955682Smarkm 210102644Snectar#if !defined(HAVE_STRNDUP) || defined(NEED_STRNDUP_PROTO) 211178825Sdfrchar * ROKEN_LIB_FUNCTION strndup(const char *, size_t); 21255682Smarkm#endif 21355682Smarkm 21455682Smarkm#ifndef HAVE_STRLWR 215178825Sdfrchar * ROKEN_LIB_FUNCTION strlwr(char *); 21655682Smarkm#endif 21755682Smarkm 21855682Smarkm#ifndef HAVE_STRNLEN 219178825Sdfrsize_t ROKEN_LIB_FUNCTION strnlen(const char*, size_t); 22055682Smarkm#endif 22155682Smarkm 22255682Smarkm#if !defined(HAVE_STRSEP) || defined(NEED_STRSEP_PROTO) 223178825Sdfrchar * ROKEN_LIB_FUNCTION strsep(char**, const char*); 22455682Smarkm#endif 22555682Smarkm 22672445Sassar#if !defined(HAVE_STRSEP_COPY) || defined(NEED_STRSEP_COPY_PROTO) 227178825Sdfrssize_t ROKEN_LIB_FUNCTION strsep_copy(const char**, const char*, char*, size_t); 22872445Sassar#endif 22972445Sassar 23055682Smarkm#ifndef HAVE_STRCASECMP 231178825Sdfrint ROKEN_LIB_FUNCTION strcasecmp(const char *, const char *); 23255682Smarkm#endif 23355682Smarkm 23455682Smarkm#ifdef NEED_FCLOSE_PROTO 235178825Sdfrint ROKEN_LIB_FUNCTION fclose(FILE *); 23655682Smarkm#endif 23755682Smarkm 23855682Smarkm#ifdef NEED_STRTOK_R_PROTO 239178825Sdfrchar * ROKEN_LIB_FUNCTION strtok_r(char *, const char *, char **); 24055682Smarkm#endif 24155682Smarkm 24255682Smarkm#ifndef HAVE_STRUPR 243178825Sdfrchar * ROKEN_LIB_FUNCTION strupr(char *); 24455682Smarkm#endif 24555682Smarkm 24655682Smarkm#ifndef HAVE_STRLCPY 247178825Sdfrsize_t ROKEN_LIB_FUNCTION strlcpy (char *, const char *, size_t); 24855682Smarkm#endif 24955682Smarkm 25055682Smarkm#ifndef HAVE_STRLCAT 251178825Sdfrsize_t ROKEN_LIB_FUNCTION strlcat (char *, const char *, size_t); 25255682Smarkm#endif 25355682Smarkm 25455682Smarkm#ifndef HAVE_GETDTABLESIZE 255178825Sdfrint ROKEN_LIB_FUNCTION getdtablesize(void); 25655682Smarkm#endif 25755682Smarkm 25855682Smarkm#if !defined(HAVE_STRERROR) && !defined(strerror) 259178825Sdfrchar * ROKEN_LIB_FUNCTION strerror(int); 26055682Smarkm#endif 26155682Smarkm 26255682Smarkm#if !defined(HAVE_HSTRERROR) || defined(NEED_HSTRERROR_PROTO) 26355682Smarkm/* This causes a fatal error under Psoriasis */ 26455682Smarkm#if !(defined(SunOS) && (SunOS >= 50)) 265178825Sdfrconst char * ROKEN_LIB_FUNCTION hstrerror(int); 26655682Smarkm#endif 26755682Smarkm#endif 26855682Smarkm 269178825Sdfr#if !HAVE_DECL_H_ERRNO 27055682Smarkmextern int h_errno; 27155682Smarkm#endif 27255682Smarkm 27355682Smarkm#if !defined(HAVE_INET_ATON) || defined(NEED_INET_ATON_PROTO) 274178825Sdfrint ROKEN_LIB_FUNCTION inet_aton(const char *, struct in_addr *); 27555682Smarkm#endif 27655682Smarkm 27755682Smarkm#ifndef HAVE_INET_NTOP 278178825Sdfrconst char * ROKEN_LIB_FUNCTION 27955682Smarkminet_ntop(int af, const void *src, char *dst, size_t size); 28055682Smarkm#endif 28155682Smarkm 28255682Smarkm#ifndef HAVE_INET_PTON 283178825Sdfrint ROKEN_LIB_FUNCTION 284178825Sdfrinet_pton(int, const char *, void *); 28555682Smarkm#endif 28655682Smarkm 28755682Smarkm#if !defined(HAVE_GETCWD) 288178825Sdfrchar* ROKEN_LIB_FUNCTION getcwd(char *, size_t); 28955682Smarkm#endif 29055682Smarkm 29155682Smarkm#ifdef HAVE_PWD_H 29255682Smarkm#include <pwd.h> 293178825Sdfrstruct passwd * ROKEN_LIB_FUNCTION k_getpwnam (const char *); 294178825Sdfrstruct passwd * ROKEN_LIB_FUNCTION k_getpwuid (uid_t); 29555682Smarkm#endif 29655682Smarkm 297178825Sdfrconst char * ROKEN_LIB_FUNCTION get_default_username (void); 29855682Smarkm 29955682Smarkm#ifndef HAVE_SETEUID 300178825Sdfrint ROKEN_LIB_FUNCTION seteuid(uid_t); 30155682Smarkm#endif 30255682Smarkm 30355682Smarkm#ifndef HAVE_SETEGID 304178825Sdfrint ROKEN_LIB_FUNCTION setegid(gid_t); 30555682Smarkm#endif 30655682Smarkm 30755682Smarkm#ifndef HAVE_LSTAT 308178825Sdfrint ROKEN_LIB_FUNCTION lstat(const char *, struct stat *); 30955682Smarkm#endif 31055682Smarkm 31155682Smarkm#if !defined(HAVE_MKSTEMP) || defined(NEED_MKSTEMP_PROTO) 312178825Sdfrint ROKEN_LIB_FUNCTION mkstemp(char *); 31355682Smarkm#endif 31455682Smarkm 31555682Smarkm#ifndef HAVE_CGETENT 316178825Sdfrint ROKEN_LIB_FUNCTION cgetent(char **, char **, const char *); 317178825Sdfrint ROKEN_LIB_FUNCTION cgetstr(char *, const char *, char **); 31855682Smarkm#endif 31955682Smarkm 32055682Smarkm#ifndef HAVE_INITGROUPS 321178825Sdfrint ROKEN_LIB_FUNCTION initgroups(const char *, gid_t); 32255682Smarkm#endif 32355682Smarkm 32455682Smarkm#ifndef HAVE_FCHOWN 325178825Sdfrint ROKEN_LIB_FUNCTION fchown(int, uid_t, gid_t); 32655682Smarkm#endif 32755682Smarkm 328178825Sdfr#if !defined(HAVE_DAEMON) || defined(NEED_DAEMON_PROTO) 329178825Sdfrint ROKEN_LIB_FUNCTION daemon(int, int); 33055682Smarkm#endif 33155682Smarkm 33255682Smarkm#ifndef HAVE_INNETGR 333178825Sdfrint ROKEN_LIB_FUNCTION innetgr(const char *, const char *, 334178825Sdfr const char *, const char *); 33555682Smarkm#endif 33655682Smarkm 33755682Smarkm#ifndef HAVE_CHOWN 338178825Sdfrint ROKEN_LIB_FUNCTION chown(const char *, uid_t, gid_t); 33955682Smarkm#endif 34055682Smarkm 34155682Smarkm#ifndef HAVE_RCMD 342178825Sdfrint ROKEN_LIB_FUNCTION 343178825Sdfr rcmd(char **, unsigned short, const char *, 344178825Sdfr const char *, const char *, int *); 34555682Smarkm#endif 34655682Smarkm 34755682Smarkm#if !defined(HAVE_INNETGR) || defined(NEED_INNETGR_PROTO) 348178825Sdfrint ROKEN_LIB_FUNCTION innetgr(const char*, const char*, 349178825Sdfr const char*, const char*); 35055682Smarkm#endif 35155682Smarkm 35255682Smarkm#ifndef HAVE_IRUSEROK 353178825Sdfrint ROKEN_LIB_FUNCTION iruserok(unsigned, int, 354178825Sdfr const char *, const char *); 35555682Smarkm#endif 35655682Smarkm 35755682Smarkm#if !defined(HAVE_GETHOSTNAME) || defined(NEED_GETHOSTNAME_PROTO) 358178825Sdfrint ROKEN_LIB_FUNCTION gethostname(char *, int); 35955682Smarkm#endif 36055682Smarkm 36155682Smarkm#ifndef HAVE_WRITEV 362178825Sdfrssize_t ROKEN_LIB_FUNCTION 363178825Sdfrwritev(int, const struct iovec *, int); 36455682Smarkm#endif 36555682Smarkm 36655682Smarkm#ifndef HAVE_READV 367178825Sdfrssize_t ROKEN_LIB_FUNCTION 368178825Sdfrreadv(int, const struct iovec *, int); 36955682Smarkm#endif 37055682Smarkm 37155682Smarkm#ifndef HAVE_MKSTEMP 372178825Sdfrint ROKEN_LIB_FUNCTION 373178825Sdfrmkstemp(char *); 37455682Smarkm#endif 37555682Smarkm 37672445Sassar#ifndef HAVE_PIDFILE 377178825Sdfrvoid ROKEN_LIB_FUNCTION pidfile (const char*); 37872445Sassar#endif 37972445Sassar 38078527Sassar#ifndef HAVE_BSWAP32 381178825Sdfrunsigned int ROKEN_LIB_FUNCTION bswap32(unsigned int); 38278527Sassar#endif 38378527Sassar 38478527Sassar#ifndef HAVE_BSWAP16 385178825Sdfrunsigned short ROKEN_LIB_FUNCTION bswap16(unsigned short); 38678527Sassar#endif 38778527Sassar 38855682Smarkm#ifndef HAVE_FLOCK 38955682Smarkm#ifndef LOCK_SH 39055682Smarkm#define LOCK_SH 1 /* Shared lock */ 39155682Smarkm#endif 39255682Smarkm#ifndef LOCK_EX 39355682Smarkm#define LOCK_EX 2 /* Exclusive lock */ 39455682Smarkm#endif 39555682Smarkm#ifndef LOCK_NB 39655682Smarkm#define LOCK_NB 4 /* Don't block when locking */ 39755682Smarkm#endif 39855682Smarkm#ifndef LOCK_UN 39955682Smarkm#define LOCK_UN 8 /* Unlock */ 40055682Smarkm#endif 40155682Smarkm 40255682Smarkmint flock(int fd, int operation); 40355682Smarkm#endif /* HAVE_FLOCK */ 40455682Smarkm 405178825Sdfrtime_t ROKEN_LIB_FUNCTION tm2time (struct tm, int); 40655682Smarkm 407178825Sdfrint ROKEN_LIB_FUNCTION unix_verify_user(char *, char *); 40855682Smarkm 409178825Sdfrint ROKEN_LIB_FUNCTION roken_concat (char *, size_t, ...); 41055682Smarkm 411178825Sdfrsize_t ROKEN_LIB_FUNCTION roken_mconcat (char **, size_t, ...); 41255682Smarkm 413178825Sdfrint ROKEN_LIB_FUNCTION roken_vconcat (char *, size_t, va_list); 41455682Smarkm 415178825Sdfrsize_t ROKEN_LIB_FUNCTION 416178825Sdfr roken_vmconcat (char **, size_t, va_list); 41755682Smarkm 418178825Sdfrssize_t ROKEN_LIB_FUNCTION net_write (int, const void *, size_t); 41955682Smarkm 420178825Sdfrssize_t ROKEN_LIB_FUNCTION net_read (int, void *, size_t); 42155682Smarkm 422178825Sdfrint ROKEN_LIB_FUNCTION issuid(void); 42355682Smarkm 42455682Smarkm#ifndef HAVE_STRUCT_WINSIZE 42555682Smarkmstruct winsize { 42655682Smarkm unsigned short ws_row, ws_col; 42755682Smarkm unsigned short ws_xpixel, ws_ypixel; 42855682Smarkm}; 42955682Smarkm#endif 43055682Smarkm 431178825Sdfrint ROKEN_LIB_FUNCTION get_window_size(int fd, struct winsize *); 43255682Smarkm 43355682Smarkm#ifndef HAVE_VSYSLOG 434178825Sdfrvoid ROKEN_LIB_FUNCTION vsyslog(int, const char *, va_list); 43555682Smarkm#endif 43655682Smarkm 437178825Sdfr#if !HAVE_DECL_OPTARG 43855682Smarkmextern char *optarg; 43955682Smarkm#endif 440178825Sdfr#if !HAVE_DECL_OPTIND 44155682Smarkmextern int optind; 44255682Smarkm#endif 443178825Sdfr#if !HAVE_DECL_OPTERR 44455682Smarkmextern int opterr; 44555682Smarkm#endif 44655682Smarkm 447178825Sdfr#if !HAVE_DECL_ENVIRON 44855682Smarkmextern char **environ; 44955682Smarkm#endif 45055682Smarkm 45155682Smarkm#ifndef HAVE_GETIPNODEBYNAME 452178825Sdfrstruct hostent * ROKEN_LIB_FUNCTION 453178825Sdfrgetipnodebyname (const char *, int, int, int *); 45455682Smarkm#endif 45555682Smarkm 45655682Smarkm#ifndef HAVE_GETIPNODEBYADDR 457178825Sdfrstruct hostent * ROKEN_LIB_FUNCTION 458178825Sdfrgetipnodebyaddr (const void *, size_t, int, int *); 45955682Smarkm#endif 46055682Smarkm 46155682Smarkm#ifndef HAVE_FREEHOSTENT 462178825Sdfrvoid ROKEN_LIB_FUNCTION 463178825Sdfrfreehostent (struct hostent *); 46455682Smarkm#endif 46555682Smarkm 46655682Smarkm#ifndef HAVE_COPYHOSTENT 467178825Sdfrstruct hostent * ROKEN_LIB_FUNCTION 468178825Sdfrcopyhostent (const struct hostent *); 46955682Smarkm#endif 47055682Smarkm 47155682Smarkm#ifndef HAVE_SOCKLEN_T 47255682Smarkmtypedef int socklen_t; 47355682Smarkm#endif 47455682Smarkm 47555682Smarkm#ifndef HAVE_STRUCT_SOCKADDR_STORAGE 47655682Smarkm 47755682Smarkm#ifndef HAVE_SA_FAMILY_T 47855682Smarkmtypedef unsigned short sa_family_t; 47955682Smarkm#endif 48055682Smarkm 48155682Smarkm#ifdef HAVE_IPV6 48255682Smarkm#define _SS_MAXSIZE sizeof(struct sockaddr_in6) 48355682Smarkm#else 48455682Smarkm#define _SS_MAXSIZE sizeof(struct sockaddr_in) 48555682Smarkm#endif 48655682Smarkm 48755682Smarkm#define _SS_ALIGNSIZE sizeof(unsigned long) 48855682Smarkm 48955682Smarkm#if HAVE_STRUCT_SOCKADDR_SA_LEN 49055682Smarkm 49155682Smarkmtypedef unsigned char roken_sa_family_t; 49255682Smarkm 49372445Sassar#define _SS_PAD1SIZE ((2 * _SS_ALIGNSIZE - sizeof (roken_sa_family_t) - sizeof(unsigned char)) % _SS_ALIGNSIZE) 49455682Smarkm#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (roken_sa_family_t) + sizeof(unsigned char) + _SS_PAD1SIZE + _SS_ALIGNSIZE)) 49555682Smarkm 49655682Smarkmstruct sockaddr_storage { 49755682Smarkm unsigned char ss_len; 49855682Smarkm roken_sa_family_t ss_family; 49955682Smarkm char __ss_pad1[_SS_PAD1SIZE]; 50055682Smarkm unsigned long __ss_align[_SS_PAD2SIZE / sizeof(unsigned long) + 1]; 50155682Smarkm}; 50255682Smarkm 50355682Smarkm#else /* !HAVE_STRUCT_SOCKADDR_SA_LEN */ 50455682Smarkm 50555682Smarkmtypedef unsigned short roken_sa_family_t; 50655682Smarkm 50772445Sassar#define _SS_PAD1SIZE ((2 * _SS_ALIGNSIZE - sizeof (roken_sa_family_t)) % _SS_ALIGNSIZE) 50855682Smarkm#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (roken_sa_family_t) + _SS_PAD1SIZE + _SS_ALIGNSIZE)) 50955682Smarkm 51055682Smarkmstruct sockaddr_storage { 51155682Smarkm roken_sa_family_t ss_family; 51255682Smarkm char __ss_pad1[_SS_PAD1SIZE]; 51355682Smarkm unsigned long __ss_align[_SS_PAD2SIZE / sizeof(unsigned long) + 1]; 51455682Smarkm}; 51555682Smarkm 51655682Smarkm#endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */ 51755682Smarkm 51855682Smarkm#endif /* HAVE_STRUCT_SOCKADDR_STORAGE */ 51955682Smarkm 52055682Smarkm#ifndef HAVE_STRUCT_ADDRINFO 52155682Smarkmstruct addrinfo { 52255682Smarkm int ai_flags; 52355682Smarkm int ai_family; 52455682Smarkm int ai_socktype; 52555682Smarkm int ai_protocol; 52655682Smarkm size_t ai_addrlen; 52755682Smarkm char *ai_canonname; 52855682Smarkm struct sockaddr *ai_addr; 52955682Smarkm struct addrinfo *ai_next; 53055682Smarkm}; 53155682Smarkm#endif 53255682Smarkm 53355682Smarkm#ifndef HAVE_GETADDRINFO 534178825Sdfrint ROKEN_LIB_FUNCTION 535178825Sdfrgetaddrinfo(const char *, 536178825Sdfr const char *, 537178825Sdfr const struct addrinfo *, 538178825Sdfr struct addrinfo **); 53955682Smarkm#endif 54055682Smarkm 54155682Smarkm#ifndef HAVE_GETNAMEINFO 542178825Sdfrint ROKEN_LIB_FUNCTION 543178825Sdfrgetnameinfo(const struct sockaddr *, socklen_t, 544178825Sdfr char *, size_t, 545178825Sdfr char *, size_t, 546178825Sdfr int); 54755682Smarkm#endif 54855682Smarkm 54955682Smarkm#ifndef HAVE_FREEADDRINFO 550178825Sdfrvoid ROKEN_LIB_FUNCTION 551178825Sdfrfreeaddrinfo(struct addrinfo *); 55255682Smarkm#endif 55355682Smarkm 55455682Smarkm#ifndef HAVE_GAI_STRERROR 555178825Sdfrconst char * ROKEN_LIB_FUNCTION 556178825Sdfrgai_strerror(int); 55755682Smarkm#endif 55855682Smarkm 559178825Sdfrint ROKEN_LIB_FUNCTION 560178825Sdfrgetnameinfo_verified(const struct sockaddr *, socklen_t, 561178825Sdfr char *, size_t, 562178825Sdfr char *, size_t, 563178825Sdfr int); 56455682Smarkm 565178825Sdfrint ROKEN_LIB_FUNCTION 566178825Sdfrroken_getaddrinfo_hostspec(const char *, int, struct addrinfo **); 567178825Sdfrint ROKEN_LIB_FUNCTION 568178825Sdfrroken_getaddrinfo_hostspec2(const char *, int, int, struct addrinfo **); 56957419Smarkm 57055682Smarkm#ifndef HAVE_STRFTIME 571178825Sdfrsize_t ROKEN_LIB_FUNCTION 572178825Sdfrstrftime (char *, size_t, const char *, const struct tm *); 57355682Smarkm#endif 57455682Smarkm 57555682Smarkm#ifndef HAVE_STRPTIME 576178825Sdfrchar * ROKEN_LIB_FUNCTION 577178825Sdfrstrptime (const char *, const char *, struct tm *); 57855682Smarkm#endif 57955682Smarkm 58090926Snectar#ifndef HAVE_EMALLOC 581178825Sdfrvoid * ROKEN_LIB_FUNCTION emalloc (size_t); 58290926Snectar#endif 58390926Snectar#ifndef HAVE_ECALLOC 584178825Sdfrvoid * ROKEN_LIB_FUNCTION ecalloc(size_t, size_t); 58590926Snectar#endif 58690926Snectar#ifndef HAVE_EREALLOC 587178825Sdfrvoid * ROKEN_LIB_FUNCTION erealloc (void *, size_t); 58890926Snectar#endif 58990926Snectar#ifndef HAVE_ESTRDUP 590178825Sdfrchar * ROKEN_LIB_FUNCTION estrdup (const char *); 59190926Snectar#endif 59290926Snectar 59355682Smarkm/* 59455682Smarkm * kludges and such 59555682Smarkm */ 59655682Smarkm 59755682Smarkm#if 1 598178825Sdfrint ROKEN_LIB_FUNCTION 599178825Sdfrroken_gethostby_setup(const char*, const char*); 600178825Sdfrstruct hostent* ROKEN_LIB_FUNCTION 601178825Sdfrroken_gethostbyname(const char*); 602178825Sdfrstruct hostent* ROKEN_LIB_FUNCTION 603178825Sdfrroken_gethostbyaddr(const void*, size_t, int); 60455682Smarkm#else 60555682Smarkm#ifdef GETHOSTBYNAME_PROTO_COMPATIBLE 60655682Smarkm#define roken_gethostbyname(x) gethostbyname(x) 60755682Smarkm#else 60855682Smarkm#define roken_gethostbyname(x) gethostbyname((char *)x) 60955682Smarkm#endif 61055682Smarkm 61155682Smarkm#ifdef GETHOSTBYADDR_PROTO_COMPATIBLE 61255682Smarkm#define roken_gethostbyaddr(a, l, t) gethostbyaddr(a, l, t) 61355682Smarkm#else 61455682Smarkm#define roken_gethostbyaddr(a, l, t) gethostbyaddr((char *)a, l, t) 61555682Smarkm#endif 61655682Smarkm#endif 61755682Smarkm 61855682Smarkm#ifdef GETSERVBYNAME_PROTO_COMPATIBLE 61955682Smarkm#define roken_getservbyname(x,y) getservbyname(x,y) 62055682Smarkm#else 62155682Smarkm#define roken_getservbyname(x,y) getservbyname((char *)x, (char *)y) 62255682Smarkm#endif 62355682Smarkm 62455682Smarkm#ifdef OPENLOG_PROTO_COMPATIBLE 62555682Smarkm#define roken_openlog(a,b,c) openlog(a,b,c) 62655682Smarkm#else 62755682Smarkm#define roken_openlog(a,b,c) openlog((char *)a,b,c) 62855682Smarkm#endif 62955682Smarkm 63072445Sassar#ifdef GETSOCKNAME_PROTO_COMPATIBLE 63172445Sassar#define roken_getsockname(a,b,c) getsockname(a,b,c) 63272445Sassar#else 63372445Sassar#define roken_getsockname(a,b,c) getsockname(a, b, (void*)c) 63472445Sassar#endif 63572445Sassar 63678527Sassar#ifndef HAVE_SETPROGNAME 637178825Sdfrvoid ROKEN_LIB_FUNCTION setprogname(const char *); 63878527Sassar#endif 63978527Sassar 64078527Sassar#ifndef HAVE_GETPROGNAME 641178825Sdfrconst char * ROKEN_LIB_FUNCTION getprogname(void); 64278527Sassar#endif 64378527Sassar 644178825Sdfr#if !defined(HAVE_SETPROGNAME) && !defined(HAVE_GETPROGNAME) && !HAVE_DECL___PROGNAME 645178825Sdfrextern const char *__progname; 646178825Sdfr#endif 647102644Snectar 648178825Sdfrvoid ROKEN_LIB_FUNCTION mini_inetd_addrinfo (struct addrinfo*); 649178825Sdfrvoid ROKEN_LIB_FUNCTION mini_inetd (int); 65055682Smarkm 65190926Snectar#ifndef HAVE_LOCALTIME_R 652178825Sdfrstruct tm * ROKEN_LIB_FUNCTION 653178825Sdfrlocaltime_r(const time_t *, struct tm *); 65490926Snectar#endif 65590926Snectar 656102644Snectar#if !defined(HAVE_STRSVIS) || defined(NEED_STRSVIS_PROTO) 657178825Sdfrint ROKEN_LIB_FUNCTION 658178825Sdfrstrsvis(char *, const char *, int, const char *); 659102644Snectar#endif 660102644Snectar 661102644Snectar#if !defined(HAVE_STRUNVIS) || defined(NEED_STRUNVIS_PROTO) 662178825Sdfrint ROKEN_LIB_FUNCTION 663178825Sdfrstrunvis(char *, const char *); 664102644Snectar#endif 665102644Snectar 666102644Snectar#if !defined(HAVE_STRVIS) || defined(NEED_STRVIS_PROTO) 667178825Sdfrint ROKEN_LIB_FUNCTION 668178825Sdfrstrvis(char *, const char *, int); 669102644Snectar#endif 670102644Snectar 671102644Snectar#if !defined(HAVE_STRVISX) || defined(NEED_STRVISX_PROTO) 672178825Sdfrint ROKEN_LIB_FUNCTION 673178825Sdfrstrvisx(char *, const char *, size_t, int); 674102644Snectar#endif 675102644Snectar 676102644Snectar#if !defined(HAVE_SVIS) || defined(NEED_SVIS_PROTO) 677178825Sdfrchar * ROKEN_LIB_FUNCTION 678178825Sdfrsvis(char *, int, int, int, const char *); 679102644Snectar#endif 680102644Snectar 681102644Snectar#if !defined(HAVE_UNVIS) || defined(NEED_UNVIS_PROTO) 682178825Sdfrint ROKEN_LIB_FUNCTION 683178825Sdfrunvis(char *, int, int *, int); 684102644Snectar#endif 685102644Snectar 686102644Snectar#if !defined(HAVE_VIS) || defined(NEED_VIS_PROTO) 687178825Sdfrchar * ROKEN_LIB_FUNCTION 688178825Sdfrvis(char *, int, int, int); 689102644Snectar#endif 690102644Snectar 691178825Sdfr#if !defined(HAVE_CLOSEFROM) 692178825Sdfrint ROKEN_LIB_FUNCTION 693178825Sdfrclosefrom(int); 694178825Sdfr#endif 695178825Sdfr 696178825Sdfr#if !defined(HAVE_TIMEGM) 697178825Sdfr#define timegm rk_timegm 698178825Sdfrtime_t ROKEN_LIB_FUNCTION 699178825Sdfrrk_timegm(struct tm *tm); 700178825Sdfr#endif 701178825Sdfr 702178825Sdfr#ifdef SOCKET_WRAPPER_REPLACE 703178825Sdfr#include <socket_wrapper.h> 704178825Sdfr#endif 705178825Sdfr 70672445SassarROKEN_CPP_END 707