1 2Interface name: foo 3Method: bar( uint64_t par1, string par2 ); 4 5 6// Enumeration for procedure numbers 7typedef enum foo_procnums_t { 8 foo_bar_procnum, 9}; 10 11// Structure to hold all the arguments of a message 12// We need these to keep them around while we unmarshal or marshal 13// them if they don't fit into a single underlying message 14// 15typedef struct foo_bar_args_t { 16 ... 17 }; 18 19// Type of a given method call 20typedef errval_t (foo_bar_method_t)(foo_binding_t *binding, uint64_t par1, const char *par2 ) 21 22// Union holding all args 23union foo_arg_union { 24 struct foo_bar_args bar_args; 25 <other method args> 26 }; 27 28// The binding structure, for both sides. 29typedef struct foo_binding_t { 30 foo_bar_method_t bar; 31 <other methods> 32 ...; 33 // Continuation information for fragmented messages 34 int _tx_current_arg; // Arg we are currently marshalling 35 int _tx_arg_progress; // How far through it? 36 union { 37 struct foo_bar_args bar_args; 38 <other method args> 39 } _tx_args; 40 foo_bar_method_t _bar_handler; 41 <other methods> 42 ...; 43 idc_error_t _error; // Points to user code 44 idc_register_fn _register; 45 idc_control_fn _control; 46 idc_malloc_fn _malloc; 47 idc_free_fn _free; 48 // Continuation information for fragmented messages 49 int _rx_current_arg; // Arg we are currently unmarshalling 50 int _rx_arg_progress; // How far through it? 51 union { 52 struct foo_bar_args_t bar_args; 53 <other method args> 54 } _rx_args; 55 56}; 57 58// Callbacks for export completion, and incoming bind request. 59typedef void (foo_export_cl *)( void *st, iref_t i, error_t e ) 60typedef int (foo_connect_cl *)( void *st, foo_binding_t *b, 61 ipc_flags_t f ) 62 63 64// Export function itself. 65int foo_export( foo_export_cl ec, foo_connect_cl cc ); 66 67 68// Callbacks for completed bind request 69typedef void (foo_bind_cl *)( foo_binding_t *binding, error_t e ); 70 71// Bind functions. 72int foo_bind( iref_t i, foo_bind_cl bc ); 73int foo_bind_ump( iref_t i, foo_bind_cl bc ); 74int foo_bind_lmp( iref_t i, foo_bind_cl bc ); 75 76// Static proxy method to send a message of a given type 77static foo_bar_method_t foo_ump_send_fn; 78 79// Static proxy function to continue sending a message of a given 80// type; only needed if the message might not fit into a single transport 81// frame. 82static foo_ump_send_continuation_t foo_bar_send_continuation; 83 84// Function called when something might be arriving 85static foo_ump_recv_fn(foo_binding_t *binding); 86 87// Function called to dispatch a function 88static foo_ump_bar_recv(foo_binding_t *binding); 89static foo_ump_bar_recv_continuation(foo_binding_t *binding); 90