1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/sctp/src/user_environment.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,117 @@ 1.4 +/*- 1.5 + * Copyright (c) 2009-2010 Brad Penoff 1.6 + * Copyright (c) 2009-2010 Humaira Kamal 1.7 + * Copyright (c) 2011-2012 Irene Ruengeler 1.8 + * Copyright (c) 2011-2012 Michael Tuexen 1.9 + * 1.10 + * All rights reserved. 1.11 + * 1.12 + * Redistribution and use in source and binary forms, with or without 1.13 + * modification, are permitted provided that the following conditions 1.14 + * are met: 1.15 + * 1. Redistributions of source code must retain the above copyright 1.16 + * notice, this list of conditions and the following disclaimer. 1.17 + * 2. Redistributions in binary form must reproduce the above copyright 1.18 + * notice, this list of conditions and the following disclaimer in the 1.19 + * documentation and/or other materials provided with the distribution. 1.20 + * 1.21 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1.22 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1.23 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1.24 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1.25 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1.26 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1.27 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1.28 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1.29 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1.30 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.31 + * SUCH DAMAGE. 1.32 + */ 1.33 + 1.34 +#ifndef _USER_ENVIRONMENT_H_ 1.35 +#define _USER_ENVIRONMENT_H_ 1.36 +/* __Userspace__ */ 1.37 +#include <sys/types.h> 1.38 + 1.39 +#ifdef __Userspace_os_FreeBSD 1.40 +#ifndef _SYS_MUTEX_H_ 1.41 +#include <sys/mutex.h> 1.42 +#endif 1.43 +#endif 1.44 +#if defined (__Userspace_os_Windows) 1.45 +#include "netinet/sctp_os_userspace.h" 1.46 +#endif 1.47 + 1.48 +/* maxsockets is used in SCTP_ZONE_INIT call. It refers to 1.49 + * kern.ipc.maxsockets kernel environment variable. 1.50 + */ 1.51 +extern int maxsockets; 1.52 + 1.53 +/* int hz; is declared in sys/kern/subr_param.c and refers to kernel timer frequency. 1.54 + * See http://ivoras.sharanet.org/freebsd/vmware.html for additional info about kern.hz 1.55 + * hz is initialized in void init_param1(void) in that file. 1.56 + */ 1.57 +extern int hz; 1.58 + 1.59 + 1.60 +/* The following two ints define a range of available ephermal ports. */ 1.61 +extern int ipport_firstauto, ipport_lastauto; 1.62 + 1.63 +/* nmbclusters is used in sctp_usrreq.c (e.g., sctp_init). In the FreeBSD kernel, 1.64 + * this is 1024 + maxusers * 64. 1.65 + */ 1.66 +extern int nmbclusters; 1.67 + 1.68 +#if !defined (__Userspace_os_Windows) 1.69 +#define min(a,b) ((a)>(b)?(b):(a)) 1.70 +#define max(a,b) ((a)>(b)?(a):(b)) 1.71 +#endif 1.72 + 1.73 +extern int read_random(void *buf, int count); 1.74 + 1.75 +/* errno's may differ per OS. errno.h now included in sctp_os_userspace.h */ 1.76 +/* Source: /usr/src/sys/sys/errno.h */ 1.77 +/* #define ENOSPC 28 */ /* No space left on device */ 1.78 +/* #define ENOBUFS 55 */ /* No buffer space available */ 1.79 +/* #define ENOMEM 12 */ /* Cannot allocate memory */ 1.80 +/* #define EACCES 13 */ /* Permission denied */ 1.81 +/* #define EFAULT 14 */ /* Bad address */ 1.82 +/* #define EHOSTDOWN 64 */ /* Host is down */ 1.83 +/* #define EHOSTUNREACH 65 */ /* No route to host */ 1.84 + 1.85 +/* Source ip_output.c. extern'd in ip_var.h */ 1.86 +extern u_short ip_id; 1.87 + 1.88 +#if defined(__Userspace_os_Linux) 1.89 +#define IPV6_VERSION 0x60 1.90 +#endif 1.91 +#if defined(INVARIANTS) 1.92 +#define panic(args...) \ 1.93 + do { \ 1.94 + SCTP_PRINTF(args);\ 1.95 + exit(1); \ 1.96 +} while (0) 1.97 +#endif 1.98 + 1.99 +#if defined(INVARIANTS) 1.100 +#define KASSERT(cond, args) \ 1.101 + do { \ 1.102 + if (!(cond)) { \ 1.103 + printf args ;\ 1.104 + exit(1); \ 1.105 + } \ 1.106 + } while (0) 1.107 +#else 1.108 +#define KASSERT(cond, args) 1.109 +#endif 1.110 + 1.111 +/* necessary for sctp_pcb.c */ 1.112 +extern int ip_defttl; 1.113 + 1.114 + 1.115 +/* dummy definitions used (temporarily?) for inpcb userspace port */ 1.116 + 1.117 +/* called in sctp_usrreq.c */ 1.118 +#define in6_sin_2_v4mapsin6(arg1, arg2) /* STUB */ 1.119 + 1.120 +#endif