Build on wheezy, and presumably precise
[invirt/third/libt4.git] / lock_client.h
1 // lock client interface.
2
3 #ifndef lock_client_h
4 #define lock_client_h
5
6 #ifdef __cplusplus
7
8 #include <string>
9 #include "lock_protocol.h"
10 #include "rpc.h"
11 #include <vector>
12
13 // Client interface to the lock server
14 class lock_client {
15  protected:
16   rpcc *cl;
17  public:
18   lock_client(std::string d);
19   virtual ~lock_client() {};
20   virtual lock_protocol::status acquire(lock_protocol::lockid_t);
21   virtual lock_protocol::status release(lock_protocol::lockid_t);
22   virtual lock_protocol::status stat(lock_protocol::lockid_t);
23 };
24
25 #endif
26
27 extern "C" {
28
29 struct _t4_lock_client;
30 typedef struct _t4_lock_client t4_lock_client;
31
32 typedef enum {
33     T4_OK,
34     T4_RETRY,
35     T4_RPCERR,
36     T4_NOENT,
37     T4_IOERR
38 } t4_xxstatus;
39
40 typedef int t4_status;
41
42 typedef unsigned long long t4_lockid_t;
43
44 t4_lock_client *t4_lock_client_new(const char *dst);
45 void t4_lock_client_delete(t4_lock_client *);
46 t4_status t4_lock_client_acquire(t4_lock_client *, t4_lockid_t);
47 t4_status t4_lock_client_release(t4_lock_client *, t4_lockid_t);
48 t4_status t4_lock_client_stat(t4_lock_client *, t4_lockid_t);
49
50 }
51
52 #endif