NewMadeleine

Documentation

« back to PM2 home.
nm_rpc_interface.h File Reference
#include <nm_public.h>
#include <nm_sendrecv_interface.h>
#include <nm_session_interface.h>
#include <nm_rpc_private.h>
Include dependency graph for nm_rpc_interface.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

typedef struct nm_rpc_service_snm_rpc_service_t
 a RPC registered service
 
typedef struct nm_rpc_req_snm_rpc_req_t
 a RPC send request
 
typedef struct nm_rpc_token_snm_rpc_token_t
 a RPC invocation token given to handlers
 
typedef void(* nm_rpc_handler_t) (nm_rpc_token_t p_token)
 a RPC handler called upon request invocation
 
typedef void(* nm_rpc_finalizer_t) (nm_rpc_token_t p_token)
 a RPC finalizer, called when all data has been received
 
typedef 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
 
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.
 
void nm_rpc_unregister (nm_rpc_service_t p_service)
 stop listenning from RPC requests on given service
 
static void * nm_rpc_service_get_ref (nm_rpc_service_t p_service)
 get a user reference given upon service registration
 
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
 
static void nm_rpc_req_set_priority (nm_rpc_req_t p_req, nm_prio_t priority)
 set priority of the rpc send request
 
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.
 
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.
 
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 multiple body chunk.
 
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 wait for completion (but not both at the same time)
 
static void nm_rpc_req_wait (nm_rpc_req_t p_req)
 wait for a send request completion
 
static void nm_rpc_req_wait_all (nm_rpc_req_t *p_reqs, int n)
 wait for completion of a vector of send requests
 
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
 
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.
 
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
 
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 nm_rpc_service_t nm_rpc_get_service (nm_rpc_token_t p_token)
 get the service on which the given request has arrived
 
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
 
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_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
 
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_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 is no guarantee that data is available when this function completes.
 
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 as above, using nm_data instead of raw pointer
 
static void nm_rpc_token_delay (struct nm_rpc_token_s *p_token)
 delay the unpacking of received body data.
 
void nm_rpc_token_complete (struct nm_rpc_token_s *p_token)
 complete a delayed RPC request