OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [packages/] [net/] [tcpip/] [v2_0/] [include/] [netinet6/] [osdep.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1254 phoenix
//==========================================================================
2
//
3
//      include/netinet6_osdep.h
4
//
5
//      
6
//
7
//==========================================================================
8
//####BSDCOPYRIGHTBEGIN####
9
//
10
// -------------------------------------------
11
//
12
// Portions of this software may have been derived from OpenBSD or other sources,
13
// and are covered by the appropriate copyright disclaimers included herein.
14
//
15
// -------------------------------------------
16
//
17
//####BSDCOPYRIGHTEND####
18
//==========================================================================
19
//#####DESCRIPTIONBEGIN####
20
//
21
// Author(s):    gthomas
22
// Contributors: gthomas
23
// Date:         2000-01-10
24
// Purpose:      
25
// Description:  
26
//              
27
//
28
//####DESCRIPTIONEND####
29
//
30
//==========================================================================
31
 
32
 
33
/* $OpenBSD: osdep.h,v 1.3 1999/12/10 08:53:18 angelos Exp $ */
34
/*
35
%%% copyright-nrl-97
36
This software is Copyright 1997-1998 by Randall Atkinson, Ronald Lee,
37
Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All
38
rights under this copyright have been assigned to the US Naval Research
39
Laboratory (NRL). The NRL Copyright Notice and License Agreement Version
40
1.1 (January 17, 1995) applies to this software.
41
You should have received a copy of the license with this software. If you
42
didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
43
 
44
%%% copyright-cmetz-97
45
This software is Copyright 1997-1998 by Craig Metz, All Rights Reserved.
46
The Inner Net License Version 2 applies to this software.
47
You should have received a copy of the license with this software. If
48
you didn't get a copy, you may request one from <license@inner.net>.
49
 
50
*/
51
#ifndef _NETINET6_OSDEP_H_
52
#define _NETINET6_OSDEP_H_
53
 
54
#define OSDEP_BSD 1
55
 
56
#include <sys/types.h>
57
#include <sys/param.h>
58
#include <sys/socket.h>
59
#ifdef KERNEL
60
#ifndef ATSH_ADD
61
#include <sys/systm.h>
62
#endif /* ATSH_ADD */
63
#ifndef MLEN
64
#include <sys/mbuf.h>
65
#endif /* MLEN */
66
#include <sys/kernel.h>
67
#include <sys/malloc.h>
68
#ifndef SB_MAX
69
#include <sys/socketvar.h>
70
#endif /* SB_MAX */
71
#include <sys/proc.h>
72
#ifndef RTM_RTTUNIT
73
#include <net/route.h>
74
#endif /* RTM_RTTUNIT */
75
#endif /* KERNEL */
76
struct ifnet;
77
struct mbuf;
78
#include <netinet/in.h>
79
struct route6;
80
 
81
#ifdef KERNEL
82
/* XXX */
83
#define OSDEP_CRITICALDCL int __s;
84
#define OSDEP_CRITICALSTART __s = splnet()
85
#define OSDEP_CRITICALEND splx(__s)
86
#define OSDEP_TIMESECONDS (time.tv_sec)
87
#define OSDEP_PROCESS struct proc
88
#define OSDEP_PROCESSCURRENT (curproc)
89
#define OSDEP_PROCESSPARENT(x) ((x)->p_pptr)
90
#define OSDEP_PROCESSPID(x) ((x)->p_pid)
91
 
92
#ifdef SS_PRIV
93
#define OSDEP_SOCKETPRIVELEGED(socket) (socket->so_state & SS_PRIV)
94
#else /* SS_PRIV */
95
/* XXX? */
96
#define OSDEP_SOCKETPRIVELEGED(socket) (!curproc || !curproc->p_ucred || !curproc->p_ucred->cr_uid)
97
#endif /* SS_PRIV */
98
#define OSDEP_PCAST(x) ((unsigned int)(x) & 0xffffffff)
99
#define OSDEP_SOCKET struct socket
100
#define OSDEP_PACKET struct mbuf
101
struct mbuf;
102
 
103
#define OSDEP_REAL_MALLOC(n) malloc((unsigned long)(n), M_TEMP, M_DONTWAIT)
104
#define OSDEP_REAL_FREE(p) free((void *)p, M_TEMP)
105
#define OSDEP_FAMILY(socket) (socket->so_proto->pr_domain->dom_family)
106
#define OSDEP_PSEUDORANDOM (uint32_t)random()
107
 
108
struct ifnet;
109
struct mbuf *m_devget(char *, int, int, struct ifnet *, void (*)(const void *, void *, size_t));
110
 
111
static __inline__ int __osdep_datatopacket(void *data, int len, OSDEP_PACKET **packet)
112
{
113
  if (!(*packet = m_devget(data, len, 0, NULL, NULL)))
114
    return -ENOMEM;
115
 
116
  return 0;
117
};
118
 
119
#define OSDEP_DATATOPACKET(data, len, packet) __osdep_datatopacket(data, len, packet)
120
 
121
#define OSDEP_ZEROPACKET(packet) m_zero(packet)
122
#define OSDEP_FREEPACKET(packet) m_freem(packet)
123
 
124
#define memcpy(dst, src, len) bcopy(src, dst, len)
125
#define memmove(dst, src, len) bcopy(src, dst, len)
126
#define memset(p, zero, len) bzero(p, len) /* XXX */
127
#define memcmp(p1, p2, len) bcmp(p1, p2, len)
128
 
129
#define OSDEP_COPYFROMUSER(dst, src, len) copyin(src, dst, len)
130
#define OSDEP_COPYTOUSER(dst, src, len) copyout(src, dst, len)
131
 
132
#endif /* KERNEL */
133
#define OSDEP_SALEN 1
134
#define OSDEP_ERROR(x) (x)
135
 
136
#define ENETSECURITYPOLICY -ECOMM
137
 
138
#ifdef DEBUG_MALLOC
139
#undef OSDEP_MALLOC
140
#undef OSDEP_FREE
141
#define OSDEP_MALLOC(n) debug_malloc_malloc(n, DEBUG_STATUS)
142
#define OSDEP_FREE(p) debug_malloc_free(p)
143
#else /* DEBUG_MALLOC */
144
#undef OSDEP_MALLOC
145
#define OSDEP_MALLOC(n) OSDEP_REAL_MALLOC(n)
146
#undef OSDEP_FREE
147
#define OSDEP_FREE(p) OSDEP_REAL_FREE(p)
148
#endif /* DEBUG_MALLOC */
149
 
150
#endif // _NETINET6_OSDEP_H_

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.