00001 /**************************************************************** 00002 * (c) 2005 - 2007 Technische Universitaet Dresden * 00003 * This file is part of DROPS, which is distributed under the * 00004 * terms of the GNU General Public License 2. Please see the * 00005 * COPYING file for details. * 00006 ****************************************************************/ 00007 00008 #ifndef __ORE_H 00009 #define __ORE_H 00010 00011 #include <l4/ore/ore-types.h> 00012 #include <l4/dm_generic/types.h> 00013 00014 /* distinguish blocking and non-blocking calls */ 00015 #define ORE_BLOCKING_CALL 1 00016 #define ORE_NONBLOCKING_CALL 0 00017 00018 /*!\brief Open a connection to ORe. 00019 * \ingroup management 00020 * 00021 * \param device name of the device to open (e.g. "eth0") 00022 * \return mac Space for MAC address provided by server 00023 * \param conf initial configuration for this connection 00024 * 00025 * \return connection handle 00026 * <0 for failure 00027 */ 00028 L4_CV int l4ore_open(char *device, unsigned char mac[6], l4ore_config *conf); 00029 00030 /*!\brief Send packet through the connection specified. 00031 * \ingroup send_receive 00032 * 00033 * \param handle connection handle 00034 * \param buf packet buffer 00035 * \param size packet size 00036 * 00037 * \return 0 succes 00038 * \return <0 error 00039 */ 00040 L4_CV int l4ore_send(int handle, char *buf, l4_size_t size); 00041 00042 /*!\brief Receive packet. Block until a packet is available. 00043 * \ingroup send_receive 00044 * 00045 * \param handle connection handle 00046 * \param buf receive buffer 00047 * \param size receive buffer size 00048 * \param timeout IPC timeout 00049 * 00050 * \return 0 success 00051 * \return <0 error 00052 * \return >0 if buffer is too small, the return value specifies 00053 * the buffer size needed. 00054 */ 00055 L4_CV int l4ore_recv_blocking(int handle, char **buf, l4_size_t *size, l4_timeout_t timeout); 00056 00057 /*!\brief Receive packet. Return immediately when no data available. 00058 * \ingroup send_receive 00059 * 00060 * \param handle connection handle 00061 * \param buf receive buffer 00062 * \param size receive buffer size 00063 * 00064 * \return 0 success 00065 * \return <0 error 00066 * \return >0 if buffer is too small, the return value specifies 00067 * the buffer size needed. 00068 */ 00069 L4_CV int l4ore_recv_nonblocking(int handle, char **buf, unsigned int *size); 00070 00071 /*!\brief Close connection. 00072 * \ingroup management 00073 * 00074 * \param handle Connection handle. 00075 */ 00076 L4_CV void l4ore_close(int handle); 00077 00078 /*!\brief Set configuration for connection. Note that ro values in the 00079 * connection descriptor will be ignored. 00080 * \ingroup management 00081 * 00082 * \param handle connection handle 00083 * \param new_desc new connection configuration 00084 */ 00085 L4_CV void l4ore_set_config(int handle, l4ore_config *conf); 00086 00087 /*!\brief Get configuration for connection. 00088 * \ingroup management 00089 * 00090 * \param handle connection handle 00091 * 00092 * \return The current configuration info for this channel. 00093 */ 00094 L4_CV l4ore_config l4ore_get_config(int handle); 00095 00096 /*!\brief Set/unset debugging. 00097 * \ingroup debug 00098 * 00099 * \param conf config data 00100 * \param flag Debugging flag. 00101 */ 00102 L4_CV void l4ore_debug(l4ore_config *conf, int flag); 00103 00104 /*!\brief Get address of the send dataspace. 00105 * \ingroup sharedmem 00106 * 00107 * \param handle connection handle 00108 */ 00109 L4_CV void *l4ore_get_send_area(int handle); 00110 00111 /*!\brief Get address of the receive dataspace. 00112 * \ingroup sharedmem 00113 * 00114 * \param handle connection handle 00115 */ 00116 L4_CV void *l4ore_get_recv_area(int handle); 00117 00118 /*!\brief Return packet at address addr to the DSI pool. 00119 * \ingroup sharedmem 00120 * 00121 * \param addr packet address 00122 */ 00123 L4_CV void l4ore_packet_to_pool(void *addr); 00124 #endif