ovsdb: Add tests for transient ovsdb-server.
[sliver-openvswitch.git] / lib / unixctl.h
1 /*
2  * Copyright (c) 2008, 2009 Nicira Networks.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef UNIXCTL_H
18 #define UNIXCTL_H 1
19
20 /* Server for Unix domain socket control connection. */
21 struct unixctl_server;
22 int unixctl_server_create(const char *path, struct unixctl_server **);
23 void unixctl_server_run(struct unixctl_server *);
24 void unixctl_server_wait(struct unixctl_server *);
25 void unixctl_server_destroy(struct unixctl_server *);
26
27 /* Client for Unix domain socket control connection. */
28 struct unixctl_client;
29 int unixctl_client_create(const char *path, struct unixctl_client **);
30 void unixctl_client_destroy(struct unixctl_client *);
31 int unixctl_client_transact(struct unixctl_client *,
32                             const char *request,
33                             int *reply_code, char **reply_body);
34 const char *unixctl_client_target(const struct unixctl_client *);
35
36 /* Command registration. */
37 struct unixctl_conn;
38 typedef void unixctl_cb_func(struct unixctl_conn *,
39                              const char *args, void *aux);
40 void unixctl_command_register(const char *name,
41                               unixctl_cb_func *cb, void *aux);
42 void unixctl_command_reply(struct unixctl_conn *, int code,
43                            const char *body);
44
45 #endif /* unixctl.h */