summaryrefslogtreecommitdiffstats
path: root/src/vlibmemory/api.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlibmemory/api.h')
-rw-r--r--src/vlibmemory/api.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/vlibmemory/api.h b/src/vlibmemory/api.h
index e86b88cdf9e..8d2b191fb81 100644
--- a/src/vlibmemory/api.h
+++ b/src/vlibmemory/api.h
@@ -61,6 +61,44 @@ vl_api_client_index_to_registration (u32 index)
return (vl_mem_api_client_index_to_registration (index));
}
+always_inline u32
+vl_api_registration_file_index (vl_api_registration_t * reg)
+{
+ return reg->clib_file_index;
+}
+
+always_inline clib_file_t *
+vl_api_registration_file (vl_api_registration_t * reg)
+{
+ return clib_file_get (&file_main, vl_api_registration_file_index (reg));
+}
+
+always_inline void
+vl_api_registration_del_file (vl_api_registration_t * reg)
+{
+ clib_file_t *cf = vl_api_registration_file (reg);
+ if (cf)
+ clib_file_del (&file_main, cf);
+}
+
+always_inline clib_error_t *
+vl_api_send_fd_msg (vl_api_registration_t * reg, int fd_to_send)
+{
+ clib_file_t *cf = vl_api_registration_file (reg);
+ if (cf)
+ return vl_sock_api_send_fd_msg (cf->file_descriptor, fd_to_send);
+ return 0;
+}
+
+always_inline clib_error_t *
+vl_api_recv_fd_msg (vl_api_registration_t * reg, int *fd_to_recv, u32 wait)
+{
+ clib_file_t *cf = vl_api_registration_file (reg);
+ if (cf)
+ return vl_sock_api_recv_fd_msg (cf->file_descriptor, fd_to_recv, wait);
+ return 0;
+}
+
/*
* vl_api_clnt process data used by transports (socket api in particular)
*/