1/** 2 * \file 3 * \brief octopus service handler header file. 4 */ 5 6/* 7 * Copyright (c) 2011, 2012, 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, CAB F.78, Universitaetstrasse 6, CH-8092 Zurich, 13 * Attn: Systems Group. 14 */ 15 16#ifndef OCTOPUS_SERVICE_H_ 17#define OCTOPUS_SERVICE_H_ 18 19#include <barrelfish/barrelfish.h> 20#include <octopus/definitions.h> 21#include <octopus/getset.h> 22 23struct oct_reply_state; 24 25struct skb_writer { 26 size_t length; 27 char buffer[MAX_QUERY_LENGTH]; // TODO can be bigger than max query length... 28}; 29 30struct oct_query_state { 31 struct skb_writer std_out; 32 struct skb_writer std_err; 33 int exec_res; 34}; 35 36typedef void(*oct_reply_handler_fn)(struct octopus_binding*, struct oct_reply_state*); 37 38struct oct_reply_state { 39 struct octopus_binding* binding; 40 oct_reply_handler_fn reply; 41 42 struct oct_query_state query_state; 43 bool return_record; 44 errval_t error; 45 46 // Pubsub / Trigger state 47 uint64_t client_handler; 48 uint64_t client_state; 49 oct_mode_t mode; 50 octopus_trigger_id_t server_id; 51 52 // For capability storage 53 struct capref cap; 54 char* retkey; 55 56 struct oct_reply_state *next; 57}; 58 59errval_t new_oct_reply_state(struct oct_reply_state**, oct_reply_handler_fn); 60 61void get_names_handler(struct octopus_binding*, const char*, octopus_trigger_t); 62void get_handler(struct octopus_binding*, const char*, octopus_trigger_t); 63void set_handler(struct octopus_binding*, const char*, uint64_t, octopus_trigger_t, bool); 64void get_with_idcap_handler(struct octopus_binding*, struct capref, 65 octopus_trigger_t); 66void set_with_idcap_handler(struct octopus_binding*, struct capref, const char*, 67 uint64_t, octopus_trigger_t, bool); 68void del_handler(struct octopus_binding*, const char*, octopus_trigger_t); 69void exists_handler(struct octopus_binding*, const char*, octopus_trigger_t); 70void wait_for_handler(struct octopus_binding*, const char*); 71void remove_trigger_handler(struct octopus_binding*, octopus_trigger_id_t); 72 73void subscribe_handler(struct octopus_binding*, const char*, uint64_t, uint64_t); 74void publish_handler(struct octopus_binding*, const char*); 75void unsubscribe_handler(struct octopus_binding*, uint64_t); 76 77void get_identifier(struct octopus_binding*); 78void identify_binding(struct octopus_binding*, uint64_t, octopus_binding_type_t); 79 80// Capability Storage 81void get_cap_handler(struct octopus_binding*, const char*); 82void put_cap_handler(struct octopus_binding*, const char*, struct capref); 83void sput_cap_handler(struct octopus_binding*, const char*, struct capref); 84void remove_cap_handler(struct octopus_binding*, const char*); 85 86#endif /* OCTOPUS_SERVICE_H_ */ 87