source: rtems/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h @ 4ab3a29

4.104.114.84.95
Last change on this file since 4ab3a29 was 4ab3a29, checked in by Joel Sherrill <joel.sherrill@…>, on 06/21/07 at 15:32:37

2007-06-21 Joel Sherrill <joel.sherrill@…>

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