source: rtems/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h @ c58c2ca

4.104.114.84.95
Last change on this file since c58c2ca was c58c2ca, checked in by Ralf Corsepius <ralf.corsepius@…>, on Feb 2, 2005 at 10:11:10 AM

New header guards.

  • Property mode set to 100644
File size: 5.1 KB
Line 
1/*
2 * Declarations to fit FreeBSD to RTEMS.
3 *
4 *******************************************************************
5 *                            WARNING                              *
6 * This file should *never* be included by any application program *
7 *******************************************************************
8 *
9 *  $Id$
10 */
11
12#ifndef _RTEMS_RTEMS_BSDNET_INTERNAL_H
13#define _RTEMS_RTEMS_BSDNET_INTERNAL_H
14
15#include <rtems.h>
16
17typedef unsigned int            vm_offset_t;
18typedef long long               vm_ooffset_t;
19typedef unsigned int            vm_pindex_t;
20typedef unsigned int            vm_size_t;
21
22#define _BSD_OFF_T_     int32_t
23#define _BSD_PID_T_     rtems_id
24#define _BSD_VA_LIST_   char *
25
26/* make sure we get the network versions of these */
27#include <machine/types.h>
28#include <machine/param.h>
29#include <rtems/cdefs.h>
30
31#include <sys/time.h>
32/*
33struct  itimerval {
34  struct  timeval it_interval;
35  struct  timeval it_value;
36};
37*/
38struct mdproc {
39        int     md_flags;
40        int     *md_regs;
41};
42
43/*
44 * Other RTEMS/BSD glue
45 */
46struct socket;
47extern int soconnsleep (struct socket *so);
48extern void soconnwakeup (struct socket *so);
49#define splnet()        0
50#define splimp()        0
51#define splx(_s)        do { (_s) = 0; } while(0)
52
53/* to avoid warnings */
54void *memcpy(void *dest, const void *src, size_t n);
55void *memset(void *s, int c, size_t n);
56
57#define ovbcopy(f,t,n) bcopy(f,t,n)
58#define copyout(f,t,n) (memcpy(t,f,n),0)
59#define copyin(f,t,n) (memcpy(t,f,n),0)
60
61#define random()        rtems_bsdnet_random()
62#define panic   rtems_panic
63#define suser(a,b)      0
64
65void    microtime (struct timeval *tv);
66#define hz rtems_bsdnet_ticks_per_second
67#define tick rtems_bsdnet_microseconds_per_tick
68
69#define log     rtems_bsdnet_log
70
71/*
72 * Since we can't have two sys/types.h files, we'll hack around
73 * and copy the contents of the BSD sys/types.h to here....
74 */
75#include <sys/cdefs.h>
76
77typedef u_int64_t       u_quad_t;       /* quads */
78typedef int64_t         quad_t;
79typedef quad_t *        qaddr_t;
80
81typedef void __sighandler_t __P((int));
82typedef __sighandler_t  *sig_t; /* type of pointer to a signal function */
83#define NSIG    32
84struct  sigaltstack {
85        char    *ss_sp;                 /* signal stack base */
86        int     ss_size;                /* signal stack length */
87        int     ss_flags;               /* SS_DISABLE and/or SS_ONSTACK */
88};
89
90#ifdef _KERNEL
91typedef int             boolean_t;
92typedef struct vm_page  *vm_page_t;
93#endif
94
95#ifndef _POSIX_SOURCE
96/*
97 * minor() gives a cookie instead of an index since we don't want to
98 * change the meanings of bits 0-15 or waste time and space shifting
99 * bits 16-31 for devices that don't use them.
100 */
101#define major(x)        ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
102#define minor(x)        ((int)((x)&0xffff00ff))         /* minor number */
103#define makedev(x,y)    ((dev_t)(((x) << 8) | (y)))     /* create dev_t */
104#endif
105
106#include <machine/endian.h>
107
108typedef quad_t          rlim_t;         /* resource limit */
109typedef u_int32_t       fixpt_t;        /* fixed point number */
110
111/*
112 * Forward structure declarations for function prototypes.  We include the
113 * common structures that cross subsystem boundaries here; others are mostly
114 * used in the same place that the structure is defined.
115 */
116struct  proc;
117struct  pgrp;
118struct  ucred;
119struct  rusage;
120struct  file;
121struct  buf;
122struct  tty;
123struct  uio;
124struct  rtems_bsdnet_ifconfig;
125
126/*
127 * Redo kernel memory allocation
128 */
129#define malloc rtems_bsdnet_malloc
130#define free rtems_bsdnet_free
131
132#define M_NOWAIT        0x0001
133void *rtems_bsdnet_malloc (unsigned long size, int type, int flags);
134void rtems_bsdnet_free (void *addr, int type);
135
136void rtems_bsdnet_semaphore_obtain (void);
137void rtems_bsdnet_semaphore_release (void);
138void rtems_bsdnet_schednetisr (int n);
139int rtems_bsdnet_parse_driver_name (const struct rtems_bsdnet_ifconfig *config, char **namep);
140
141unsigned long rtems_bsdnet_seconds_since_boot (void);
142unsigned long rtems_bsdnet_random (void);
143
144rtems_id rtems_bsdnet_newproc (
145  char  *name,
146  int   stacksize,
147  void  (*entry)(void *),
148  void  *arg
149);
150
151rtems_status_code rtems_bsdnet_event_receive (
152  rtems_event_set  event_in,
153  rtems_option     option_set,
154  rtems_interval   ticks,
155  rtems_event_set *event_out
156);
157
158/*
159 * Network configuration
160 */
161extern int rtems_bsdnet_ticks_per_second;
162extern int rtems_bsdnet_microseconds_per_tick;
163extern struct in_addr rtems_bsdnet_log_host_address;
164extern char *rtems_bsdnet_domain_name;
165extern struct in_addr rtems_bsdnet_nameserver[];
166extern int rtems_bsdnet_nameserver_count;
167
168/*
169 * Internal IOCTL command
170 */
171#define SIO_RTEMS_SHOW_STATS    _IO('i', 250)
172
173/*
174 * Some extra prototypes
175 */
176int sethostname (char *name, size_t namelen);
177void domaininit (void *);
178void ifinit (void *);
179void ipintr (void);
180void arpintr (void);
181void bootpc_init(int );
182int socket (int, int, int);
183int ioctl (int, int, ...);
184
185/*
186 * Events used by networking routines.
187 * Everything will break if the application
188 * tries to use these events or if the `sleep'
189 * events are equal to any of the NETISR * events.
190 */
191#define SBWAIT_EVENT   RTEMS_EVENT_24
192#define SOSLEEP_EVENT  RTEMS_EVENT_25
193#define NETISR_IP_EVENT                (1 << NETISR_IP)
194#define NETISR_ARP_EVENT       (1 << NETISR_ARP)
195#define NETISR_EVENTS  (NETISR_IP_EVENT|NETISR_ARP_EVENT)
196#if (SBWAIT_EVENT & SOSLEEP_EVENT & NETISR_EVENTS)
197# error "Network event conflict"
198#endif
199
200#endif /* _RTEMS_RTEMS_BSDNET_INTERNAL_H */
Note: See TracBrowser for help on using the repository browser.