michael@0: /*- michael@0: * Copyright (c) 2009-2010 Brad Penoff michael@0: * Copyright (c) 2009-2010 Humaira Kamal michael@0: * Copyright (c) 2011-2012 Irene Ruengeler michael@0: * Copyright (c) 2011-2012 Michael Tuexen michael@0: * michael@0: * All rights reserved. michael@0: * michael@0: * Redistribution and use in source and binary forms, with or without michael@0: * modification, are permitted provided that the following conditions michael@0: * are met: michael@0: * 1. Redistributions of source code must retain the above copyright michael@0: * notice, this list of conditions and the following disclaimer. michael@0: * 2. Redistributions in binary form must reproduce the above copyright michael@0: * notice, this list of conditions and the following disclaimer in the michael@0: * documentation and/or other materials provided with the distribution. michael@0: * michael@0: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND michael@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE michael@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE michael@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE michael@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL michael@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS michael@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) michael@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT michael@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY michael@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@0: * SUCH DAMAGE. michael@0: */ michael@0: michael@0: #ifndef _USER_ENVIRONMENT_H_ michael@0: #define _USER_ENVIRONMENT_H_ michael@0: /* __Userspace__ */ michael@0: #include michael@0: michael@0: #ifdef __Userspace_os_FreeBSD michael@0: #ifndef _SYS_MUTEX_H_ michael@0: #include michael@0: #endif michael@0: #endif michael@0: #if defined (__Userspace_os_Windows) michael@0: #include "netinet/sctp_os_userspace.h" michael@0: #endif michael@0: michael@0: /* maxsockets is used in SCTP_ZONE_INIT call. It refers to michael@0: * kern.ipc.maxsockets kernel environment variable. michael@0: */ michael@0: extern int maxsockets; michael@0: michael@0: /* int hz; is declared in sys/kern/subr_param.c and refers to kernel timer frequency. michael@0: * See http://ivoras.sharanet.org/freebsd/vmware.html for additional info about kern.hz michael@0: * hz is initialized in void init_param1(void) in that file. michael@0: */ michael@0: extern int hz; michael@0: michael@0: michael@0: /* The following two ints define a range of available ephermal ports. */ michael@0: extern int ipport_firstauto, ipport_lastauto; michael@0: michael@0: /* nmbclusters is used in sctp_usrreq.c (e.g., sctp_init). In the FreeBSD kernel, michael@0: * this is 1024 + maxusers * 64. michael@0: */ michael@0: extern int nmbclusters; michael@0: michael@0: #if !defined (__Userspace_os_Windows) michael@0: #define min(a,b) ((a)>(b)?(b):(a)) michael@0: #define max(a,b) ((a)>(b)?(a):(b)) michael@0: #endif michael@0: michael@0: extern int read_random(void *buf, int count); michael@0: michael@0: /* errno's may differ per OS. errno.h now included in sctp_os_userspace.h */ michael@0: /* Source: /usr/src/sys/sys/errno.h */ michael@0: /* #define ENOSPC 28 */ /* No space left on device */ michael@0: /* #define ENOBUFS 55 */ /* No buffer space available */ michael@0: /* #define ENOMEM 12 */ /* Cannot allocate memory */ michael@0: /* #define EACCES 13 */ /* Permission denied */ michael@0: /* #define EFAULT 14 */ /* Bad address */ michael@0: /* #define EHOSTDOWN 64 */ /* Host is down */ michael@0: /* #define EHOSTUNREACH 65 */ /* No route to host */ michael@0: michael@0: /* Source ip_output.c. extern'd in ip_var.h */ michael@0: extern u_short ip_id; michael@0: michael@0: #if defined(__Userspace_os_Linux) michael@0: #define IPV6_VERSION 0x60 michael@0: #endif michael@0: #if defined(INVARIANTS) michael@0: #define panic(args...) \ michael@0: do { \ michael@0: SCTP_PRINTF(args);\ michael@0: exit(1); \ michael@0: } while (0) michael@0: #endif michael@0: michael@0: #if defined(INVARIANTS) michael@0: #define KASSERT(cond, args) \ michael@0: do { \ michael@0: if (!(cond)) { \ michael@0: printf args ;\ michael@0: exit(1); \ michael@0: } \ michael@0: } while (0) michael@0: #else michael@0: #define KASSERT(cond, args) michael@0: #endif michael@0: michael@0: /* necessary for sctp_pcb.c */ michael@0: extern int ip_defttl; michael@0: michael@0: michael@0: /* dummy definitions used (temporarily?) for inpcb userspace port */ michael@0: michael@0: /* called in sctp_usrreq.c */ michael@0: #define in6_sin_2_v4mapsin6(arg1, arg2) /* STUB */ michael@0: michael@0: #endif