]> rtime.felk.cvut.cz Git - frescor/forb.git/blob - forb-internal.h
8ea4ecc825b09ff2ae94e47d8e0ddf6583ee5fcc
[frescor/forb.git] / forb-internal.h
1 /**
2  * @file   forb-internal.h
3  * @author Michal Sojka <sojkam1@fel.cvut.cz>
4  * 
5  * @brief  Declarationd necessary for IDL-generated code.
6  * 
7  */
8
9 #ifndef FORB_INTERNAL_H
10 #define FORB_INTERNAL_H
11
12 #include <forb/basic_types.h>
13 #include <forb/cdr.h>
14 #include <forb/forb.h>
15 #include <idl_native.h> /* Support of native types defined in
16                          * IDL. This header should be provided by an
17                          * application. */
18 #include <forb/uuid.h>
19 #include <ul_list.h>
20 #include <ul_gavlcust.h>
21 #include <forb/forb.h>
22
23
24 typedef struct forb_rt {
25 } forb_rt;
26
27 typedef struct forb  forb_t;
28 struct forb {
29         forb_server_id server_id;
30
31         fosa_mutex_t request_id_mutex;  /**< Mutex for request_id */
32         CORBA_long request_id;  /**< Value of next sent request_id */
33
34         fosa_mutex_t objkey_mutex; /**< Mutex for objkey and objects */
35         forb_object_key objkey; /**< Objkey value of next created object  */
36         gavl_cust_root_field_t objects; /**< Tree of objects registered with this FORB. */
37
38         //forb_rt rt;           /**< Routing table */
39         //gavl_cust_root_field_t types;
40
41         fosa_mutex_t request_mutex;
42         gavl_cust_root_field_t requests;
43
44         fosa_mutex_t port_mutex;
45         ul_list_head_t ports;
46
47         fosa_mutex_t peer_mutex;
48         gavl_cust_root_field_t peers;
49 };
50
51 void
52 forb_server_id_init(forb_server_id *serer);
53
54 static inline int forb_server_id_cmp(const forb_server_id *id1, const forb_server_id *id2)
55 {
56         return memcmp(id1, id2, sizeof(forb_server_id));
57 }
58
59 static inline char *
60 forb_server_id_to_string(char *dest, const forb_server_id *server_id, size_t n)
61 {
62         return forb_uuid_to_string(dest, (forb_uuid_t*)server_id->uuid, n);
63 }
64
65 static inline forb_server_id * 
66 forb_server_id_from_string(forb_server_id *server_id, const char *string)
67 {
68         return (forb_server_id *)forb_uuid_from_string((forb_uuid_t*)&server_id->uuid, string);
69 }
70
71 #endif