1 /* 2 * Copyright 2002-2006, Haiku, Inc. All Rights Reserved. 3 * This file may be used under the terms of the MIT License. 4 */ 5 #ifndef USERLAND_IPC_H 6 #define USERLAND_IPC_H 7 8 /*! userland_ipc - Communication between the network driver 9 and the userland stack. 10 */ 11 12 #include <OS.h> 13 #include <Drivers.h> 14 15 #include "net_stack_driver.h" 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 #define NET_STACK_PORTNAME "net_server connection" 22 23 enum { 24 NET_STACK_OPEN = NET_STACK_IOCTL_MAX, 25 NET_STACK_CLOSE, 26 NET_STACK_NEW_CONNECTION, 27 }; 28 29 #define MAX_NET_AREAS 16 30 31 typedef struct { 32 area_id id; 33 uint8 *offset; 34 } net_area_info; 35 36 typedef struct { 37 int32 op; 38 // int32 buffer; 39 uint8 *data; 40 int32 length; 41 int32 result; 42 net_area_info area[MAX_NET_AREAS]; 43 } net_command; 44 45 #define CONNECTION_QUEUE_LENGTH 128 46 #define CONNECTION_COMMAND_SIZE 2048 47 48 typedef struct { 49 port_id port; 50 area_id area; 51 thread_id socket_thread; 52 53 sem_id commandSemaphore; // command queue 54 uint32 numCommands,bufferSize; 55 } net_connection; 56 57 58 extern status_t init_userland_ipc(void); 59 extern void shutdown_userland_ipc(void); 60 61 62 #ifdef __cplusplus 63 } // end of extern "C" 64 #endif 65 66 #endif /* USERLAND_IPC_H */ 67