16#ifndef NM_RPC_PRIVATE_H
17#define NM_RPC_PRIVATE_H
96 assert((
void*)&p_reqs[0]->request == (
void*)p_reqs[0]);
99 for(i = 0; i < n; i++)
101 if(p_reqs[i] != NULL)
108 return p_service->
ref;
154 NM_FATAL(
"# nm_rpc: rc = %d in nm_sr_recv_peek()\n", rc);
nm_status_t nm_cond_status_t
status with synchronization (wait/signal)
@ NM_ESUCCESS
successful operation
static void nm_datav_uncommit(struct nm_datav_s *p_datav)
'uncommit' a datav: explicitely declare that nm_data pointing to this datav has been destroyed.
static nm_len_t nm_datav_size(struct nm_datav_s *p_datav)
get the size (number of bytes) of data contained in the datav
static void nm_datav_add_chunk_data(struct nm_datav_s *p_datav, const struct nm_data_s *p_data)
add a chunk of data to datav; given p_data content is copied.
static nm_len_t nm_data_size(const struct nm_data_s *p_data)
returns the amount of data contained in the descriptor
void(* nm_rpc_handler_t)(nm_rpc_token_t p_token)
a RPC handler called upon request invocation
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.
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
void(* nm_rpc_finalizer_t)(nm_rpc_token_t p_token)
a RPC finalizer, called when all data has been received
static nm_gate_t nm_sr_request_get_gate(nm_sr_request_t *p_request)
static nm_tag_t nm_sr_request_get_tag(nm_sr_request_t *p_request)
Retrieve the tag from a sendrecv request.
static void nm_sr_request_wait_all(nm_sr_request_t **p_requests, int n)
wait for completion of an array of requests
nm_tag_t tag
the user-supplied tag
static void nm_data_contiguous_build(struct nm_data_s *p_data, void *ptr, nm_len_t len)
static void nm_data_datav_build(struct nm_data_s *p_datav_data, struct nm_datav_s *p_datav)
frontend to build a nm_data from a datav
Basic primitives to display info & warnings.
#define NM_FATAL(format,...)
static void nm_rpc_req_set_priority(nm_rpc_req_t p_req, nm_prio_t priority)
static nm_rpc_service_t nm_rpc_get_service(struct nm_rpc_token_s *p_token)
static void nm_rpc_recv_header(nm_rpc_token_t p_token, void *hptr, nm_len_t hlen)
void nm_rpc_req_delete(nm_rpc_req_t p_rpc_req)
static void * nm_rpc_service_get_ref(struct nm_rpc_service_s *p_service)
PUK_LIST_DECLARE_TYPE(nm_rpc_token)
static void nm_rpc_token_set_ref(struct nm_rpc_token_s *p_token, void *ref)
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)
static void nm_rpc_req_wait(nm_rpc_req_t p_req)
static void nm_rpc_irecv_body(nm_rpc_token_t p_token, void *ptr, nm_len_t len)
PUK_LIST_CREATE_FUNCS(nm_rpc_token)
static nm_tag_t nm_rpc_get_tag(struct nm_rpc_token_s *p_token)
static void * nm_rpc_token_get_ref(struct nm_rpc_token_s *p_token)
static void nm_rpc_recv_header_data(nm_rpc_token_t p_token, struct nm_data_s *p_header)
static void nm_rpc_irecv_body_data(struct nm_rpc_token_s *p_token, struct nm_data_s *p_body)
static void nm_rpc_req_wait_all(nm_rpc_req_t *p_reqs, int n)
static nm_gate_t nm_rpc_get_source(struct nm_rpc_token_s *p_token)
static void nm_rpc_token_delay(struct nm_rpc_token_s *p_token)
static int nm_sr_swait(nm_session_t p_session, nm_sr_request_t *p_request)
Wait for the completion of a non blocking send request.
static void nm_sr_recv_offset(nm_session_t p_session, nm_sr_request_t *p_request, nm_len_t offset)
set offset of data to receive; data before offset will be discarded
static int nm_sr_recv_peek_offset(nm_session_t p_session, nm_sr_request_t *p_request, const struct nm_data_s *p_data, nm_len_t peek_offset, nm_len_t peek_len)
peek for already received (unexpected) data, with offset and explicit len
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
encapsulate a dynamic vector of nm_data
Connection to another process.
struct nm_datav_s headerv
vector of user-supplied chunks of headers
nm_sr_request_t request
the sendrecv request, actually allocated here
nm_rpc_req_notifier_t p_notifier
notification function to call uppon req completion
struct nm_datav_s bodyv
vector of user-supplied chunks of body
nm_len_t extra_hlen
size added to default header size
void * p_notifier_ref
user-supplied parameter for the notifier
struct nm_rpc_service_s * p_service
descriptor for a registered RPC service
nm_tag_t tag
tag(s) to listen to for this service
nm_session_t p_session
session used to send/recv requests
nm_tag_t tag_mask
tag mask to apply to above tag
int running
whether the service is currently running
nm_rpc_finalizer_t p_finalizer
user-supplied function, called upon data body arrival
nm_rpc_handler_t p_handler
user-supplied function, called upon header arrival
struct nm_rpc_token_list_s token_list
tokens given to rpc handlers
nm_spinlock_t token_list_lock
lock for the above list
void * ref
user-supplied ref for the service
void * ref
user ref for the token
nm_sr_request_t request
the sr request used for the full rpc_body_data
struct nm_rpc_service_s * p_service
service this token belongs to
int delayed
if set to 1, unpack data later
PUK_LIST_LINK(nm_rpc_token)
struct nm_datav_s headerv
internal defintion of the sendrecv request
nm_session_t p_session
session this request belongs to