netwerk/sctp/src/user_environment.h

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rwxr-xr-x

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

michael@0 1 /*-
michael@0 2 * Copyright (c) 2009-2010 Brad Penoff
michael@0 3 * Copyright (c) 2009-2010 Humaira Kamal
michael@0 4 * Copyright (c) 2011-2012 Irene Ruengeler
michael@0 5 * Copyright (c) 2011-2012 Michael Tuexen
michael@0 6 *
michael@0 7 * All rights reserved.
michael@0 8 *
michael@0 9 * Redistribution and use in source and binary forms, with or without
michael@0 10 * modification, are permitted provided that the following conditions
michael@0 11 * are met:
michael@0 12 * 1. Redistributions of source code must retain the above copyright
michael@0 13 * notice, this list of conditions and the following disclaimer.
michael@0 14 * 2. Redistributions in binary form must reproduce the above copyright
michael@0 15 * notice, this list of conditions and the following disclaimer in the
michael@0 16 * documentation and/or other materials provided with the distribution.
michael@0 17 *
michael@0 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
michael@0 19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
michael@0 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
michael@0 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
michael@0 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
michael@0 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
michael@0 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
michael@0 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
michael@0 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
michael@0 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@0 28 * SUCH DAMAGE.
michael@0 29 */
michael@0 30
michael@0 31 #ifndef _USER_ENVIRONMENT_H_
michael@0 32 #define _USER_ENVIRONMENT_H_
michael@0 33 /* __Userspace__ */
michael@0 34 #include <sys/types.h>
michael@0 35
michael@0 36 #ifdef __Userspace_os_FreeBSD
michael@0 37 #ifndef _SYS_MUTEX_H_
michael@0 38 #include <sys/mutex.h>
michael@0 39 #endif
michael@0 40 #endif
michael@0 41 #if defined (__Userspace_os_Windows)
michael@0 42 #include "netinet/sctp_os_userspace.h"
michael@0 43 #endif
michael@0 44
michael@0 45 /* maxsockets is used in SCTP_ZONE_INIT call. It refers to
michael@0 46 * kern.ipc.maxsockets kernel environment variable.
michael@0 47 */
michael@0 48 extern int maxsockets;
michael@0 49
michael@0 50 /* int hz; is declared in sys/kern/subr_param.c and refers to kernel timer frequency.
michael@0 51 * See http://ivoras.sharanet.org/freebsd/vmware.html for additional info about kern.hz
michael@0 52 * hz is initialized in void init_param1(void) in that file.
michael@0 53 */
michael@0 54 extern int hz;
michael@0 55
michael@0 56
michael@0 57 /* The following two ints define a range of available ephermal ports. */
michael@0 58 extern int ipport_firstauto, ipport_lastauto;
michael@0 59
michael@0 60 /* nmbclusters is used in sctp_usrreq.c (e.g., sctp_init). In the FreeBSD kernel,
michael@0 61 * this is 1024 + maxusers * 64.
michael@0 62 */
michael@0 63 extern int nmbclusters;
michael@0 64
michael@0 65 #if !defined (__Userspace_os_Windows)
michael@0 66 #define min(a,b) ((a)>(b)?(b):(a))
michael@0 67 #define max(a,b) ((a)>(b)?(a):(b))
michael@0 68 #endif
michael@0 69
michael@0 70 extern int read_random(void *buf, int count);
michael@0 71
michael@0 72 /* errno's may differ per OS. errno.h now included in sctp_os_userspace.h */
michael@0 73 /* Source: /usr/src/sys/sys/errno.h */
michael@0 74 /* #define ENOSPC 28 */ /* No space left on device */
michael@0 75 /* #define ENOBUFS 55 */ /* No buffer space available */
michael@0 76 /* #define ENOMEM 12 */ /* Cannot allocate memory */
michael@0 77 /* #define EACCES 13 */ /* Permission denied */
michael@0 78 /* #define EFAULT 14 */ /* Bad address */
michael@0 79 /* #define EHOSTDOWN 64 */ /* Host is down */
michael@0 80 /* #define EHOSTUNREACH 65 */ /* No route to host */
michael@0 81
michael@0 82 /* Source ip_output.c. extern'd in ip_var.h */
michael@0 83 extern u_short ip_id;
michael@0 84
michael@0 85 #if defined(__Userspace_os_Linux)
michael@0 86 #define IPV6_VERSION 0x60
michael@0 87 #endif
michael@0 88 #if defined(INVARIANTS)
michael@0 89 #define panic(args...) \
michael@0 90 do { \
michael@0 91 SCTP_PRINTF(args);\
michael@0 92 exit(1); \
michael@0 93 } while (0)
michael@0 94 #endif
michael@0 95
michael@0 96 #if defined(INVARIANTS)
michael@0 97 #define KASSERT(cond, args) \
michael@0 98 do { \
michael@0 99 if (!(cond)) { \
michael@0 100 printf args ;\
michael@0 101 exit(1); \
michael@0 102 } \
michael@0 103 } while (0)
michael@0 104 #else
michael@0 105 #define KASSERT(cond, args)
michael@0 106 #endif
michael@0 107
michael@0 108 /* necessary for sctp_pcb.c */
michael@0 109 extern int ip_defttl;
michael@0 110
michael@0 111
michael@0 112 /* dummy definitions used (temporarily?) for inpcb userspace port */
michael@0 113
michael@0 114 /* called in sctp_usrreq.c */
michael@0 115 #define in6_sin_2_v4mapsin6(arg1, arg2) /* STUB */
michael@0 116
michael@0 117 #endif

mercurial