1/** 2 * \file 3 * \brief Network server thread of the bulk server 4 */ 5 6/* 7 * Copyright (c) 2007, 2008, 2009, 2010, ETH Zurich. 8 * All rights reserved. 9 * 10 * This file is distributed under the terms in the attached LICENSE file. 11 * If you do not find this file, copies can be found by writing to: 12 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 13 */ 14 15 16 17#ifndef BS_USER_CONNECTOR_H 18#define BS_USER_CONNECTOR_H 19 20#include <if/block_service_defs.h> 21 22#include <bulk_transfer/bulk_transfer.h> 23#include <bulk_transfer/bulk_sm.h> 24 25#define BLOCK_SERVICE_NAME "blockservice" 26 27struct bs_meta_data 28{ 29 struct bulk_continuation cont; 30 size_t block_id; 31 uint32_t req_id; 32}; 33 34/* debug */ 35#define BS_CONN_DEBUG(fmt, msg...) debug_printf("%s: "fmt"\n", __func__, msg); 36//#define BS_CONN_DEBUG(fmt, msg...) 37 38enum block_err_code { 39 BLOCK_ERR_OK, 40 BLOCK_ERR_NOT_CONNECTED, 41 BLOCK_ERR_BAD_REQUEST, 42 BLOCK_ERR_BAD_BLOCK_ID, 43 BLOCK_ERR_NO_BUFS, 44}; 45 46 47enum bs_conn_state { 48 BS_CONN_CLOSED, 49 BS_CONN_SERVICE_BOUND, 50 BS_CONN_BULK_BINDING, 51 BS_CONN_CONNECTED, 52 BS_CONN_ERR 53}; 54 55 56 57struct bs_connection { 58 struct block_service_binding *service; 59 enum bs_conn_state state; 60 struct bulk_channel tx_channel; 61 struct bulk_channel rx_channel; 62 struct bulk_sm_endpoint_descriptor tx_ep; 63 struct bulk_sm_endpoint_descriptor rx_ep; 64}; 65 66errval_t bs_service_connect(struct bs_connection *conn, 67 struct bulk_channel_callbacks *rx_cb, 68 struct bulk_channel_callbacks *tx_cb); 69 70errval_t bs_service_read(struct bs_connection *conn, 71 uint32_t block_id, 72 uint32_t block_count, 73 struct bulk_continuation cont); 74 75#endif /* BS_USER_CONNECTOR_H */ 76