ovsdb: Refactor jsonrpc-server to make the concept of a session public.
[cascardo/ovs.git] / ovsdb / server.h
1 /* Copyright (c) 2011 Nicira Networks
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 #ifndef SERVER_H
17 #define SERVER_H 1
18
19 #include "hmap.h"
20 #include "list.h"
21
22 /* Abstract representation of an OVSDB client connection, not tied to any
23  * particular network protocol.  Protocol implementations
24  * (e.g. jsonrpc-server.c) embed this in a larger data structure.  */
25 struct ovsdb_session {
26     struct ovsdb *db;
27     struct list completions;    /* Completed triggers. */
28 };
29
30 void ovsdb_session_init(struct ovsdb_session *, struct ovsdb *);
31 void ovsdb_session_destroy(struct ovsdb_session *);
32
33 /* Abstract representation of an OVSDB server not tied to any particular
34  * network protocol.  Protocol implementations (e.g. jsonrpc-server.c) embed
35  * this in a larger data structure.  */
36 struct ovsdb_server {
37     struct ovsdb *db;
38 };
39
40 void ovsdb_server_init(struct ovsdb_server *, struct ovsdb *);
41 void ovsdb_server_destroy(struct ovsdb_server *);
42
43 #endif /* ovsdb/server.h */