xref: /haiku/headers/private/net/userland_ipc.h (revision 7120e97489acbf17d86d3f33e3b2e68974fd4b23)
1 #ifndef USERLAND_IPC_H
2 #define USERLAND_IPC_H
3 /* userland_ipc - Communication between the network driver
4 **		and the userland stack.
5 **
6 ** Initial version by Axel Dörfler, axeld@pinc-software.de
7 ** This file may be used under the terms of the OpenBeOS License.
8 */
9 
10 
11 #include <OS.h>
12 #include "net_stack_driver.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #define NET_STACK_PORTNAME "net_server connection"
19 
20 enum {
21 	NET_STACK_OPEN = NET_STACK_IOCTL_MAX,
22 	NET_STACK_CLOSE,
23 	NET_STACK_NEW_CONNECTION,
24 };
25 
26 #define MAX_NET_AREAS 5
27 
28 typedef struct {
29 	area_id id;
30 	uint8	*offset;
31 } net_area_info;
32 
33 typedef struct {
34 	int32	op;
35 //	int32	buffer;
36 	uint8	*data;
37 	int32	length;
38 	int32	result;
39 	net_area_info	area[MAX_NET_AREAS];
40 } net_command;
41 
42 #define CONNECTION_QUEUE_LENGTH 128
43 #define CONNECTION_COMMAND_SIZE 2048
44 
45 typedef struct {
46 	port_id	port;
47 	area_id area;
48 
49 	sem_id	commandSemaphore;	// command queue
50 	uint32	numCommands,bufferSize;
51 } net_connection;
52 
53 
54 extern status_t init_userland_ipc(void);
55 extern void shutdown_userland_ipc(void);
56 
57 
58 #ifdef __cplusplus
59 }  // end of extern "C"
60 #endif
61 
62 #endif	/* USERLAND_IPC_H */
63