16#ifndef NM_RPC_INTERFACE_H
17#define NM_RPC_INTERFACE_H
void nm_rpc_req_set_notifier(nm_rpc_req_t p_req, nm_rpc_req_notifier_t p_notifier, void *ref)
set a handler called upon RPC send completion
static void nm_rpc_req_set_priority(nm_rpc_req_t p_req, nm_prio_t priority)
set priority of the rpc send request
static void nm_rpc_token_set_ref(nm_rpc_token_t p_token, void *ref)
attach a user reference to a token, to transmit information between rpc handler and finalizer
void(* nm_rpc_handler_t)(nm_rpc_token_t p_token)
a RPC handler called upon request invocation
static void nm_rpc_recv_header(nm_rpc_token_t p_token, void *hptr, nm_len_t hlen)
receive header; to be called from a handler; data is available immediately upon function return
void nm_rpc_req_pack_body(nm_rpc_req_t p_rpc_req, const void *ptr, nm_len_t len)
pack a body chunk into an rpc request; may be called multiple times for multiple body chunks.
struct nm_rpc_req_s * nm_rpc_req_t
a RPC send request
nm_rpc_req_t nm_rpc_req_init(nm_rpc_service_t p_service, nm_gate_t p_gate, nm_tag_t tag)
initializes a new rpc send request
struct nm_rpc_service_s * nm_rpc_service_t
a RPC registered service
nm_rpc_req_t nm_rpc_isend(nm_rpc_service_t p_service, nm_gate_t p_gate, nm_tag_t tag, void *hptr, nm_len_t hlen, struct nm_data_s *p_body)
Legacy function to send an rpc request with one header and one nm_data body; non-blocking.
static void nm_rpc_send(nm_rpc_service_t p_service, nm_gate_t p_gate, nm_tag_t tag, void *hptr, nm_len_t hlen, struct nm_data_s *p_body)
Legacy function to send an rpc request with one header and one nm_data body; blocking.
void(* nm_rpc_req_notifier_t)(nm_rpc_req_t p_req, void *ref)
a RPC req notifier, called when the request send operation is completed
static void nm_rpc_req_wait(nm_rpc_req_t p_req)
wait for a send request completion
void nm_rpc_token_complete(struct nm_rpc_token_s *p_token)
complete a delayed RPC request
static void nm_rpc_irecv_body(nm_rpc_token_t p_token, void *ptr, nm_len_t len)
asynchronously posts the recv for the body of a received request; to be called from a handler; there ...
void nm_rpc_req_pack_header(nm_rpc_req_t p_rpc_req, const void *ptr, nm_len_t len)
pack a header chunk into an rpc request; may be called multiple times for multiple header chunks.
static void nm_rpc_irecv_body_data(nm_rpc_token_t p_token, struct nm_data_s *p_body)
asynchronously posts the recv for the body of a received request; to be called from a handler; same a...
void(* nm_rpc_finalizer_t)(nm_rpc_token_t p_token)
a RPC finalizer, called when all data has been received
static void nm_rpc_recv_header_data(nm_rpc_token_t p_token, struct nm_data_s *p_header)
receive header; to be called from a handler
static void * nm_rpc_service_get_ref(nm_rpc_service_t p_service)
get a user reference given upon service registration
static nm_gate_t nm_rpc_get_source(nm_rpc_token_t p_token)
get the source for the received request; to be called from a handler
void nm_rpc_req_set_hlen(nm_rpc_req_t p_rpc_req, nm_len_t hlen)
add extra size to the default hlen, so as to consider beginning of body as header.
void nm_rpc_req_isend(nm_rpc_req_t p_req)
send an rpc request once it is built; non-blocking operation, user must set a notifier or explicitely...
static nm_rpc_service_t nm_rpc_get_service(nm_rpc_token_t p_token)
get the service on which the given request has arrived
void nm_rpc_req_pack_body_data(nm_rpc_req_t p_rpc_req, const struct nm_data_s *p_data)
pack a body chunk into an rpc request (using an nm_data type); may be called multiple times for multi...
void nm_rpc_unregister(nm_rpc_service_t p_service)
stop listenning from RPC requests on given service
static void * nm_rpc_token_get_ref(nm_rpc_token_t p_token)
get a user reference previously attached to the token
static void nm_rpc_req_wait_all(nm_rpc_req_t *p_reqs, int n)
wait for completion of a vector of send requests
struct nm_rpc_token_s * nm_rpc_token_t
a RPC invocation token given to handlers
static nm_tag_t nm_rpc_get_tag(nm_rpc_token_t p_token)
get the tag for the received request; to be called from a handler
static void nm_rpc_token_delay(struct nm_rpc_token_s *p_token)
delay the unpacking of received body data.
nm_rpc_service_t nm_rpc_register(nm_session_t p_session, nm_tag_t tag, nm_tag_t tag_mask, nm_rpc_handler_t p_handler, nm_rpc_finalizer_t p_finalizer, void *ref)
register a new RPC service, listenning on the given tag/tag_mask.
nm_tag_t tag
the user-supplied tag
static nm_session_t p_session
This is the common public header for NewMad.
Private header for the RPC interface; this is not part of the public API and is not supposed to be us...
int32_t nm_prio_t
message priority
uint64_t nm_tag_t
user tags, 64 bits, contained in indirect hashtable
uint64_t nm_len_t
data length used by nmad
a data descriptor, used to pack/unpack data from app layout to/from contiguous buffers
Connection to another process.
descriptor for a registered RPC service
void * ref
user ref for the token
struct nm_rpc_service_s * p_service
service this token belongs to