roken.h.in revision 57419
155682Smarkm/* -*- C -*- */ 255682Smarkm/* 357419Smarkm * Copyright (c) 1995 - 2000 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 3557419Smarkm/* $Id: roken.h.in,v 1.135 2000/02/14 02:24:20 assar Exp $ */ 3655682Smarkm 3755682Smarkm#include <stdio.h> 3855682Smarkm#include <stdlib.h> 3955682Smarkm#include <stdarg.h> 4055682Smarkm#include <string.h> 4155682Smarkm#include <signal.h> 4255682Smarkm#ifdef HAVE_SYS_PARAM_H 4355682Smarkm#include <sys/param.h> 4455682Smarkm#endif 4555682Smarkm#ifdef HAVE_SYS_TYPES_H 4655682Smarkm#include <sys/types.h> 4755682Smarkm#endif 4855682Smarkm#ifdef HAVE_UNISTD_H 4955682Smarkm#include <unistd.h> 5055682Smarkm#endif 5155682Smarkm#ifdef HAVE_SYS_SOCKET_H 5255682Smarkm#include <sys/socket.h> 5355682Smarkm#endif 5455682Smarkm#ifdef HAVE_SYS_UIO_H 5555682Smarkm#include <sys/uio.h> 5655682Smarkm#endif 5755682Smarkm#ifdef HAVE_GRP_H 5855682Smarkm#include <grp.h> 5955682Smarkm#endif 6055682Smarkm#ifdef HAVE_SYS_STAT_H 6155682Smarkm#include <sys/stat.h> 6255682Smarkm#endif 6355682Smarkm#ifdef HAVE_NETINET_IN_H 6455682Smarkm#include <netinet/in.h> 6555682Smarkm#endif 6655682Smarkm#ifdef HAVE_NETINET_IN6_H 6755682Smarkm#include <netinet/in6.h> 6855682Smarkm#endif 6955682Smarkm#ifdef HAVE_NETINET6_IN6_H 7055682Smarkm#include <netinet6/in6.h> 7155682Smarkm#endif 7255682Smarkm#ifdef HAVE_ARPA_INET_H 7355682Smarkm#include <arpa/inet.h> 7455682Smarkm#endif 7555682Smarkm#ifdef HAVE_NETDB_H 7655682Smarkm#include <netdb.h> 7755682Smarkm#endif 7855682Smarkm#ifdef HAVE_SYSLOG_H 7955682Smarkm#include <syslog.h> 8055682Smarkm#endif 8155682Smarkm#ifdef HAVE_WINSOCK_H 8255682Smarkm#include <winsock.h> 8355682Smarkm#endif 8455682Smarkm#ifdef HAVE_FCNTL_H 8555682Smarkm#include <fcntl.h> 8655682Smarkm#endif 8755682Smarkm#ifdef HAVE_ERRNO_H 8855682Smarkm#include <errno.h> 8955682Smarkm#endif 9055682Smarkm#ifdef HAVE_ERR_H 9155682Smarkm#include <err.h> 9255682Smarkm#endif 9355682Smarkm#ifdef HAVE_TERMIOS_H 9455682Smarkm#include <termios.h> 9555682Smarkm#endif 9655682Smarkm#if defined(HAVE_SYS_IOCTL_H) && SunOS != 40 9755682Smarkm#include <sys/ioctl.h> 9855682Smarkm#endif 9955682Smarkm#ifdef TIME_WITH_SYS_TIME 10055682Smarkm#include <sys/time.h> 10155682Smarkm#include <time.h> 10255682Smarkm#elif defined(HAVE_SYS_TIME_H) 10355682Smarkm#include <sys/time.h> 10455682Smarkm#else 10555682Smarkm#include <time.h> 10655682Smarkm#endif 10755682Smarkm 10855682Smarkm#ifdef HAVE_PATHS_H 10955682Smarkm#include <paths.h> 11055682Smarkm#endif 11155682Smarkm 11255682Smarkm#ifdef __cplusplus 11355682Smarkmextern "C" { 11455682Smarkm#endif 11555682Smarkm 11655682Smarkm#ifndef ROKEN_LIB_FUNCTION 11755682Smarkm#if defined(__BORLANDC__) 11855682Smarkm#define ROKEN_LIB_FUNCTION /* not-ready-definition-yet */ 11955682Smarkm#elif defined(_MSC_VER) 12055682Smarkm#define ROKEN_LIB_FUNCTION /* not-ready-definition-yet2 */ 12155682Smarkm#else 12255682Smarkm#define ROKEN_LIB_FUNCTION 12355682Smarkm#endif 12455682Smarkm#endif 12555682Smarkm 12655682Smarkm#include <roken-common.h> 12755682Smarkm 12855682Smarkm#if !defined(HAVE_SETSID) && defined(HAVE__SETSID) 12955682Smarkm#define setsid _setsid 13055682Smarkm#endif 13155682Smarkm 13255682Smarkm#ifndef HAVE_PUTENV 13355682Smarkmint putenv(const char *string); 13455682Smarkm#endif 13555682Smarkm 13655682Smarkm#if !defined(HAVE_SETENV) || defined(NEED_SETENV_PROTO) 13755682Smarkmint setenv(const char *var, const char *val, int rewrite); 13855682Smarkm#endif 13955682Smarkm 14055682Smarkm#if !defined(HAVE_UNSETENV) || defined(NEED_UNSETENV_PROTO) 14155682Smarkmvoid unsetenv(const char *name); 14255682Smarkm#endif 14355682Smarkm 14455682Smarkm#if !defined(HAVE_GETUSERSHELL) || defined(NEED_GETUSERSHELL_PROTO) 14555682Smarkmchar *getusershell(void); 14655682Smarkmvoid endusershell(void); 14755682Smarkm#endif 14855682Smarkm 14955682Smarkm#if !defined(HAVE_SNPRINTF) || defined(NEED_SNPRINTF_PROTO) 15055682Smarkmint snprintf (char *str, size_t sz, const char *format, ...) 15155682Smarkm __attribute__ ((format (printf, 3, 4))); 15255682Smarkm#endif 15355682Smarkm 15455682Smarkm#if !defined(HAVE_VSNPRINTF) || defined(NEED_VSNPRINTF_PROTO) 15555682Smarkmint vsnprintf (char *str, size_t sz, const char *format, va_list ap) 15655682Smarkm __attribute__((format (printf, 3, 0))); 15755682Smarkm#endif 15855682Smarkm 15955682Smarkm#if !defined(HAVE_ASPRINTF) || defined(NEED_ASPRINTF_PROTO) 16055682Smarkmint asprintf (char **ret, const char *format, ...) 16155682Smarkm __attribute__ ((format (printf, 2, 3))); 16255682Smarkm#endif 16355682Smarkm 16455682Smarkm#if !defined(HAVE_VASPRINTF) || defined(NEED_VASPRINTF_PROTO) 16555682Smarkmint vasprintf (char **ret, const char *format, va_list ap) 16655682Smarkm __attribute__((format (printf, 2, 0))); 16755682Smarkm#endif 16855682Smarkm 16955682Smarkm#if !defined(HAVE_ASNPRINTF) || defined(NEED_ASNPRINTF_PROTO) 17055682Smarkmint asnprintf (char **ret, size_t max_sz, const char *format, ...) 17155682Smarkm __attribute__ ((format (printf, 3, 4))); 17255682Smarkm#endif 17355682Smarkm 17455682Smarkm#if !defined(HAVE_VASNPRINTF) || defined(NEED_VASNPRINTF_PROTO) 17555682Smarkmint vasnprintf (char **ret, size_t max_sz, const char *format, va_list ap) 17655682Smarkm __attribute__((format (printf, 3, 0))); 17755682Smarkm#endif 17855682Smarkm 17955682Smarkm#ifndef HAVE_STRDUP 18055682Smarkmchar * strdup(const char *old); 18155682Smarkm#endif 18255682Smarkm 18355682Smarkm#ifndef HAVE_STRNDUP 18455682Smarkmchar * strndup(const char *old, size_t sz); 18555682Smarkm#endif 18655682Smarkm 18755682Smarkm#ifndef HAVE_STRLWR 18855682Smarkmchar * strlwr(char *); 18955682Smarkm#endif 19055682Smarkm 19155682Smarkm#ifndef HAVE_STRNLEN 19255682Smarkmsize_t strnlen(const char*, size_t); 19355682Smarkm#endif 19455682Smarkm 19555682Smarkm#if !defined(HAVE_STRSEP) || defined(NEED_STRSEP_PROTO) 19655682Smarkmchar *strsep(char**, const char*); 19755682Smarkm#endif 19855682Smarkm 19955682Smarkm#ifndef HAVE_STRCASECMP 20055682Smarkmint strcasecmp(const char *s1, const char *s2); 20155682Smarkm#endif 20255682Smarkm 20355682Smarkm#ifdef NEED_FCLOSE_PROTO 20455682Smarkmint fclose(FILE *); 20555682Smarkm#endif 20655682Smarkm 20755682Smarkm#ifdef NEED_STRTOK_R_PROTO 20855682Smarkmchar *strtok_r(char *s1, const char *s2, char **lasts); 20955682Smarkm#endif 21055682Smarkm 21155682Smarkm#ifndef HAVE_STRUPR 21255682Smarkmchar * strupr(char *); 21355682Smarkm#endif 21455682Smarkm 21555682Smarkm#ifndef HAVE_STRLCPY 21655682Smarkmsize_t strlcpy (char *dst, const char *src, size_t dst_sz); 21755682Smarkm#endif 21855682Smarkm 21955682Smarkm#ifndef HAVE_STRLCAT 22055682Smarkmsize_t strlcat (char *dst, const char *src, size_t dst_sz); 22155682Smarkm#endif 22255682Smarkm 22355682Smarkm#ifndef HAVE_GETDTABLESIZE 22455682Smarkmint getdtablesize(void); 22555682Smarkm#endif 22655682Smarkm 22755682Smarkm#if !defined(HAVE_STRERROR) && !defined(strerror) 22855682Smarkmchar *strerror(int eno); 22955682Smarkm#endif 23055682Smarkm 23155682Smarkm#if !defined(HAVE_HSTRERROR) || defined(NEED_HSTRERROR_PROTO) 23255682Smarkm/* This causes a fatal error under Psoriasis */ 23355682Smarkm#if !(defined(SunOS) && (SunOS >= 50)) 23455682Smarkmconst char *hstrerror(int herr); 23555682Smarkm#endif 23655682Smarkm#endif 23755682Smarkm 23855682Smarkm#ifndef HAVE_H_ERRNO_DECLARATION 23955682Smarkmextern int h_errno; 24055682Smarkm#endif 24155682Smarkm 24255682Smarkm#if !defined(HAVE_INET_ATON) || defined(NEED_INET_ATON_PROTO) 24355682Smarkmint inet_aton(const char *cp, struct in_addr *adr); 24455682Smarkm#endif 24555682Smarkm 24655682Smarkm#ifndef HAVE_INET_NTOP 24755682Smarkmconst char * 24855682Smarkminet_ntop(int af, const void *src, char *dst, size_t size); 24955682Smarkm#endif 25055682Smarkm 25155682Smarkm#ifndef HAVE_INET_PTON 25255682Smarkmint 25355682Smarkminet_pton(int af, const char *src, void *dst); 25455682Smarkm#endif 25555682Smarkm 25655682Smarkm#if !defined(HAVE_GETCWD) 25755682Smarkmchar* getcwd(char *path, size_t size); 25855682Smarkm#endif 25955682Smarkm 26055682Smarkm#ifdef HAVE_PWD_H 26155682Smarkm#include <pwd.h> 26255682Smarkmstruct passwd *k_getpwnam (const char *user); 26355682Smarkmstruct passwd *k_getpwuid (uid_t uid); 26455682Smarkm#endif 26555682Smarkm 26655682Smarkmconst char *get_default_username (void); 26755682Smarkm 26855682Smarkm#ifndef HAVE_SETEUID 26955682Smarkmint seteuid(uid_t euid); 27055682Smarkm#endif 27155682Smarkm 27255682Smarkm#ifndef HAVE_SETEGID 27355682Smarkmint setegid(gid_t egid); 27455682Smarkm#endif 27555682Smarkm 27655682Smarkm#ifndef HAVE_LSTAT 27755682Smarkmint lstat(const char *path, struct stat *buf); 27855682Smarkm#endif 27955682Smarkm 28055682Smarkm#if !defined(HAVE_MKSTEMP) || defined(NEED_MKSTEMP_PROTO) 28155682Smarkmint mkstemp(char *); 28255682Smarkm#endif 28355682Smarkm 28455682Smarkm#ifndef HAVE_CGETENT 28555682Smarkmint cgetent(char **buf, char **db_array, const char *name); 28655682Smarkmint cgetstr(char *buf, const char *cap, char **str); 28755682Smarkm#endif 28855682Smarkm 28955682Smarkm#ifndef HAVE_INITGROUPS 29055682Smarkmint initgroups(const char *name, gid_t basegid); 29155682Smarkm#endif 29255682Smarkm 29355682Smarkm#ifndef HAVE_FCHOWN 29455682Smarkmint fchown(int fd, uid_t owner, gid_t group); 29555682Smarkm#endif 29655682Smarkm 29755682Smarkm#ifndef HAVE_DAEMON 29855682Smarkmint daemon(int nochdir, int noclose); 29955682Smarkm#endif 30055682Smarkm 30155682Smarkm#ifndef HAVE_INNETGR 30255682Smarkmint innetgr(const char *netgroup, const char *machine, 30355682Smarkm const char *user, const char *domain); 30455682Smarkm#endif 30555682Smarkm 30655682Smarkm#ifndef HAVE_CHOWN 30755682Smarkmint chown(const char *path, uid_t owner, gid_t group); 30855682Smarkm#endif 30955682Smarkm 31055682Smarkm#ifndef HAVE_RCMD 31155682Smarkmint rcmd(char **ahost, unsigned short inport, const char *locuser, 31255682Smarkm const char *remuser, const char *cmd, int *fd2p); 31355682Smarkm#endif 31455682Smarkm 31555682Smarkm#if !defined(HAVE_INNETGR) || defined(NEED_INNETGR_PROTO) 31655682Smarkmint innetgr(const char*, const char*, const char*, const char*); 31755682Smarkm#endif 31855682Smarkm 31955682Smarkm#ifndef HAVE_IRUSEROK 32055682Smarkmint iruserok(unsigned raddr, int superuser, const char *ruser, 32155682Smarkm const char *luser); 32255682Smarkm#endif 32355682Smarkm 32455682Smarkm#if !defined(HAVE_GETHOSTNAME) || defined(NEED_GETHOSTNAME_PROTO) 32555682Smarkmint gethostname(char *name, int namelen); 32655682Smarkm#endif 32755682Smarkm 32855682Smarkm#ifndef HAVE_WRITEV 32955682Smarkmssize_t 33055682Smarkmwritev(int d, const struct iovec *iov, int iovcnt); 33155682Smarkm#endif 33255682Smarkm 33355682Smarkm#ifndef HAVE_READV 33455682Smarkmssize_t 33555682Smarkmreadv(int d, const struct iovec *iov, int iovcnt); 33655682Smarkm#endif 33755682Smarkm 33855682Smarkm#ifndef HAVE_MKSTEMP 33955682Smarkmint 34055682Smarkmmkstemp(char *template); 34155682Smarkm#endif 34255682Smarkm 34355682Smarkm#ifndef HAVE_FLOCK 34455682Smarkm#ifndef LOCK_SH 34555682Smarkm#define LOCK_SH 1 /* Shared lock */ 34655682Smarkm#endif 34755682Smarkm#ifndef LOCK_EX 34855682Smarkm#define LOCK_EX 2 /* Exclusive lock */ 34955682Smarkm#endif 35055682Smarkm#ifndef LOCK_NB 35155682Smarkm#define LOCK_NB 4 /* Don't block when locking */ 35255682Smarkm#endif 35355682Smarkm#ifndef LOCK_UN 35455682Smarkm#define LOCK_UN 8 /* Unlock */ 35555682Smarkm#endif 35655682Smarkm 35755682Smarkmint flock(int fd, int operation); 35855682Smarkm#endif /* HAVE_FLOCK */ 35955682Smarkm 36055682Smarkmtime_t tm2time (struct tm tm, int local); 36155682Smarkm 36255682Smarkmint unix_verify_user(char *user, char *password); 36355682Smarkm 36455682Smarkmvoid mini_inetd (int port); 36555682Smarkm 36655682Smarkmint roken_concat (char *s, size_t len, ...); 36755682Smarkm 36855682Smarkmsize_t roken_mconcat (char **s, size_t max_len, ...); 36955682Smarkm 37055682Smarkmint roken_vconcat (char *s, size_t len, va_list args); 37155682Smarkm 37255682Smarkmsize_t roken_vmconcat (char **s, size_t max_len, va_list args); 37355682Smarkm 37455682Smarkmssize_t net_write (int fd, const void *buf, size_t nbytes); 37555682Smarkm 37655682Smarkmssize_t net_read (int fd, void *buf, size_t nbytes); 37755682Smarkm 37855682Smarkmint issuid(void); 37955682Smarkm 38055682Smarkm#ifndef HAVE_STRUCT_WINSIZE 38155682Smarkmstruct winsize { 38255682Smarkm unsigned short ws_row, ws_col; 38355682Smarkm unsigned short ws_xpixel, ws_ypixel; 38455682Smarkm}; 38555682Smarkm#endif 38655682Smarkm 38755682Smarkmint get_window_size(int fd, struct winsize *); 38855682Smarkm 38955682Smarkm#ifndef HAVE_VSYSLOG 39055682Smarkmvoid vsyslog(int pri, const char *fmt, va_list ap); 39155682Smarkm#endif 39255682Smarkm 39355682Smarkm#ifndef HAVE_OPTARG_DECLARATION 39455682Smarkmextern char *optarg; 39555682Smarkm#endif 39655682Smarkm#ifndef HAVE_OPTIND_DECLARATION 39755682Smarkmextern int optind; 39855682Smarkm#endif 39955682Smarkm#ifndef HAVE_OPTERR_DECLARATION 40055682Smarkmextern int opterr; 40155682Smarkm#endif 40255682Smarkm 40355682Smarkm#ifndef HAVE___PROGNAME_DECLARATION 40455682Smarkmextern const char *__progname; 40555682Smarkm#endif 40655682Smarkm 40755682Smarkm#ifndef HAVE_ENVIRON_DECLARATION 40855682Smarkmextern char **environ; 40955682Smarkm#endif 41055682Smarkm 41155682Smarkm#ifndef HAVE_GETIPNODEBYNAME 41255682Smarkmstruct hostent * 41355682Smarkmgetipnodebyname (const char *name, int af, int flags, int *error_num); 41455682Smarkm#endif 41555682Smarkm 41655682Smarkm#ifndef HAVE_GETIPNODEBYADDR 41755682Smarkmstruct hostent * 41855682Smarkmgetipnodebyaddr (const void *src, size_t len, int af, int *error_num); 41955682Smarkm#endif 42055682Smarkm 42155682Smarkm#ifndef HAVE_FREEHOSTENT 42255682Smarkmvoid 42355682Smarkmfreehostent (struct hostent *h); 42455682Smarkm#endif 42555682Smarkm 42655682Smarkm#ifndef HAVE_COPYHOSTENT 42755682Smarkmstruct hostent * 42855682Smarkmcopyhostent (const struct hostent *h); 42955682Smarkm#endif 43055682Smarkm 43155682Smarkm#ifndef HAVE_SOCKLEN_T 43255682Smarkmtypedef int socklen_t; 43355682Smarkm#endif 43455682Smarkm 43555682Smarkm#ifndef HAVE_STRUCT_SOCKADDR_STORAGE 43655682Smarkm 43755682Smarkm#ifndef HAVE_SA_FAMILY_T 43855682Smarkmtypedef unsigned short sa_family_t; 43955682Smarkm#endif 44055682Smarkm 44155682Smarkm#ifdef HAVE_IPV6 44255682Smarkm#define _SS_MAXSIZE sizeof(struct sockaddr_in6) 44355682Smarkm#else 44455682Smarkm#define _SS_MAXSIZE sizeof(struct sockaddr_in) 44555682Smarkm#endif 44655682Smarkm 44755682Smarkm#define _SS_ALIGNSIZE sizeof(unsigned long) 44855682Smarkm 44955682Smarkm#if HAVE_STRUCT_SOCKADDR_SA_LEN 45055682Smarkm 45155682Smarkmtypedef unsigned char roken_sa_family_t; 45255682Smarkm 45355682Smarkm#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof (roken_sa_family_t) - sizeof(unsigned char)) 45455682Smarkm#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (roken_sa_family_t) + sizeof(unsigned char) + _SS_PAD1SIZE + _SS_ALIGNSIZE)) 45555682Smarkm 45655682Smarkmstruct sockaddr_storage { 45755682Smarkm unsigned char ss_len; 45855682Smarkm roken_sa_family_t ss_family; 45955682Smarkm char __ss_pad1[_SS_PAD1SIZE]; 46055682Smarkm unsigned long __ss_align[_SS_PAD2SIZE / sizeof(unsigned long) + 1]; 46155682Smarkm}; 46255682Smarkm 46355682Smarkm#else /* !HAVE_STRUCT_SOCKADDR_SA_LEN */ 46455682Smarkm 46555682Smarkmtypedef unsigned short roken_sa_family_t; 46655682Smarkm 46755682Smarkm#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof (roken_sa_family_t)) 46855682Smarkm#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (roken_sa_family_t) + _SS_PAD1SIZE + _SS_ALIGNSIZE)) 46955682Smarkm 47055682Smarkmstruct sockaddr_storage { 47155682Smarkm roken_sa_family_t ss_family; 47255682Smarkm char __ss_pad1[_SS_PAD1SIZE]; 47355682Smarkm unsigned long __ss_align[_SS_PAD2SIZE / sizeof(unsigned long) + 1]; 47455682Smarkm}; 47555682Smarkm 47655682Smarkm#endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */ 47755682Smarkm 47855682Smarkm#endif /* HAVE_STRUCT_SOCKADDR_STORAGE */ 47955682Smarkm 48055682Smarkm#ifndef HAVE_STRUCT_ADDRINFO 48155682Smarkmstruct addrinfo { 48255682Smarkm int ai_flags; 48355682Smarkm int ai_family; 48455682Smarkm int ai_socktype; 48555682Smarkm int ai_protocol; 48655682Smarkm size_t ai_addrlen; 48755682Smarkm char *ai_canonname; 48855682Smarkm struct sockaddr *ai_addr; 48955682Smarkm struct addrinfo *ai_next; 49055682Smarkm}; 49155682Smarkm#endif 49255682Smarkm 49355682Smarkm#ifndef HAVE_GETADDRINFO 49455682Smarkmint 49555682Smarkmgetaddrinfo(const char *nodename, 49655682Smarkm const char *servname, 49755682Smarkm const struct addrinfo *hints, 49855682Smarkm struct addrinfo **res); 49955682Smarkm#endif 50055682Smarkm 50155682Smarkm#ifndef HAVE_GETNAMEINFO 50255682Smarkmint getnameinfo(const struct sockaddr *sa, socklen_t salen, 50355682Smarkm char *host, size_t hostlen, 50455682Smarkm char *serv, size_t servlen, 50555682Smarkm int flags); 50655682Smarkm#endif 50755682Smarkm 50855682Smarkm#ifndef HAVE_FREEADDRINFO 50955682Smarkmvoid 51055682Smarkmfreeaddrinfo(struct addrinfo *ai); 51155682Smarkm#endif 51255682Smarkm 51355682Smarkm#ifndef HAVE_GAI_STRERROR 51455682Smarkmchar * 51555682Smarkmgai_strerror(int ecode); 51655682Smarkm#endif 51755682Smarkm 51855682Smarkmint 51955682Smarkmgetnameinfo_verified(const struct sockaddr *sa, socklen_t salen, 52055682Smarkm char *host, size_t hostlen, 52155682Smarkm char *serv, size_t servlen, 52255682Smarkm int flags); 52355682Smarkm 52457419Smarkmint 52557419Smarkmroken_getaddrinfo_hostspec(const char *, int, struct addrinfo **); 52657419Smarkm 52755682Smarkm#ifndef HAVE_STRFTIME 52855682Smarkmsize_t 52955682Smarkmstrftime (char *buf, size_t maxsize, const char *format, 53055682Smarkm const struct tm *tm); 53155682Smarkm#endif 53255682Smarkm 53355682Smarkm#ifndef HAVE_STRPTIME 53455682Smarkmchar * 53555682Smarkmstrptime (const char *buf, const char *format, struct tm *timeptr); 53655682Smarkm#endif 53755682Smarkm 53855682Smarkm/* 53955682Smarkm * kludges and such 54055682Smarkm */ 54155682Smarkm 54255682Smarkm#if 1 54355682Smarkmint roken_gethostby_setup(const char*, const char*); 54455682Smarkmstruct hostent* roken_gethostbyname(const char*); 54555682Smarkmstruct hostent* roken_gethostbyaddr(const void*, size_t, int); 54655682Smarkm#else 54755682Smarkm#ifdef GETHOSTBYNAME_PROTO_COMPATIBLE 54855682Smarkm#define roken_gethostbyname(x) gethostbyname(x) 54955682Smarkm#else 55055682Smarkm#define roken_gethostbyname(x) gethostbyname((char *)x) 55155682Smarkm#endif 55255682Smarkm 55355682Smarkm#ifdef GETHOSTBYADDR_PROTO_COMPATIBLE 55455682Smarkm#define roken_gethostbyaddr(a, l, t) gethostbyaddr(a, l, t) 55555682Smarkm#else 55655682Smarkm#define roken_gethostbyaddr(a, l, t) gethostbyaddr((char *)a, l, t) 55755682Smarkm#endif 55855682Smarkm#endif 55955682Smarkm 56055682Smarkm#ifdef GETSERVBYNAME_PROTO_COMPATIBLE 56155682Smarkm#define roken_getservbyname(x,y) getservbyname(x,y) 56255682Smarkm#else 56355682Smarkm#define roken_getservbyname(x,y) getservbyname((char *)x, (char *)y) 56455682Smarkm#endif 56555682Smarkm 56655682Smarkm#ifdef OPENLOG_PROTO_COMPATIBLE 56755682Smarkm#define roken_openlog(a,b,c) openlog(a,b,c) 56855682Smarkm#else 56955682Smarkm#define roken_openlog(a,b,c) openlog((char *)a,b,c) 57055682Smarkm#endif 57155682Smarkm 57255682Smarkmvoid set_progname(char *argv0); 57355682Smarkm 57455682Smarkm#ifdef __cplusplus 57555682Smarkm} 57655682Smarkm#endif 577