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 <Drivers.h> 13 14 #include "net_stack_driver.h" 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 #define NET_STACK_PORTNAME "net_server connection" 21 22 enum { 23 NET_STACK_OPEN = NET_STACK_IOCTL_MAX, 24 NET_STACK_CLOSE, 25 NET_STACK_NEW_CONNECTION, 26 }; 27 28 #define MAX_NET_AREAS 16 29 30 typedef struct { 31 area_id id; 32 uint8 *offset; 33 } net_area_info; 34 35 typedef struct { 36 int32 op; 37 // int32 buffer; 38 uint8 *data; 39 int32 length; 40 int32 result; 41 net_area_info area[MAX_NET_AREAS]; 42 } net_command; 43 44 #define CONNECTION_QUEUE_LENGTH 128 45 #define CONNECTION_COMMAND_SIZE 2048 46 47 typedef struct { 48 port_id port; 49 area_id area; 50 thread_id socket_thread; 51 52 sem_id commandSemaphore; // command queue 53 uint32 numCommands,bufferSize; 54 } net_connection; 55 56 57 extern status_t init_userland_ipc(void); 58 extern void shutdown_userland_ipc(void); 59 60 61 #ifdef __cplusplus 62 } // end of extern "C" 63 #endif 64 65 #endif /* USERLAND_IPC_H */ 66