]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ankh/include/client-c.h
Inital import
[l4.git] / l4 / pkg / ankh / include / client-c.h
1 #pragma once
2
3 #include <l4/sys/compiler.h> // __BEGIN_DECLS
4 #include <l4/sys/types.h>    // l4_cap_idx_t
5 #include <l4/shmc/shmc.h>    // l4shmc*()
6 #include <l4/ankh/session.h> // AnkhSessionDescriptor
7 #include <l4/shmc/ringbuf.h>
8
9 __BEGIN_DECLS
10
11 /*
12  * Initialize Ankh client library.
13  *
14  * Call this before everything else.
15  */
16 L4_CV void l4ankh_init(void) L4_NOTHROW;
17
18 /*
19  * Open SHM connection using shm name and buffer size
20  */
21 L4_CV int l4ankh_open(char *shm_name, int bufsize) L4_NOTHROW;
22
23 /*
24  * Get the connection's info area.
25  */
26 L4_CV struct AnkhSessionDescriptor *l4ankh_get_info(void) L4_NOTHROW;
27
28 /*************************
29  * Send()
30  *************************/
31
32 /*
33  * Prepare to send data.
34  *
35  * Attaches to the underlying ringbuf's send signal.
36  * Call before sending any data.
37  */
38 L4_CV int l4ankh_prepare_send(l4_cap_idx_t owner) L4_NOTHROW;
39
40 /*
41  * Send packet giving buffer and size.
42  *
43  * \param data  buffer
44  * \param size  buffer size
45  * \param block block if buffer full
46  */
47 L4_CV int l4ankh_send(char *data, unsigned size, char block) L4_NOTHROW;
48
49
50 /*************************
51  * Receive
52  *************************/
53
54 /*
55  * Prepare packet reception.
56  *
57  * Attaches to the underlying ringbuf's recv signal.
58  * Call before receiving any data.
59  */
60 L4_CV int l4ankh_prepare_recv(l4_cap_idx_t owner) L4_NOTHROW;
61
62 // XXX: interface - send() has a block parameter, recv() has
63 //      two different versions -- FIX
64 /*
65  * Receive data, block if buffer empty.
66  */
67 L4_CV int l4ankh_recv_blocking(char *buffer, unsigned *size) L4_NOTHROW;
68
69 /*
70  * Receive data, return error if none available
71  */
72 L4_CV int l4ankh_recv_nonblocking(char *buffer, unsigned *size) L4_NOTHROW;
73
74 /*
75  * Get access to the underlying send buffer.
76  *
77  * This can be used to access the underlying buffer and perform
78  * more sophisticated operations that are needed only by special
79  * clients (L4Linux, ...).
80  */
81 L4_CV l4shmc_ringbuf_t *l4ankh_get_sendbuf(void) L4_NOTHROW;
82
83 /*
84  * Get access to the underlying recv buffer.
85  *
86  * This can be used to access the underlying buffer and perform
87  * more sophisticated operations that are needed only by special
88  * clients (L4Linux, ...).
89  */
90 L4_CV l4shmc_ringbuf_t *l4ankh_get_recvbuf(void) L4_NOTHROW;
91
92 __END_DECLS