Setting tag sliver-openvswitch-2.2.90-1
[sliver-openvswitch.git] / lib / unixctl.h
1 /*
2  * Copyright (c) 2008, 2009, 2011 Nicira, Inc.
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 #ifdef  __cplusplus
21 extern "C" {
22 #endif
23
24 /* Server for Unix domain socket control connection. */
25 struct unixctl_server;
26 int unixctl_server_create(const char *path, struct unixctl_server **);
27 void unixctl_server_run(struct unixctl_server *);
28 void unixctl_server_wait(struct unixctl_server *);
29 void unixctl_server_destroy(struct unixctl_server *);
30
31 /* Client for Unix domain socket control connection. */
32 struct jsonrpc;
33 int unixctl_client_create(const char *path, struct jsonrpc **client);
34 int unixctl_client_transact(struct jsonrpc *client,
35                             const char *command,
36                             int argc, char *argv[],
37                             char **result, char **error);
38
39 /* Command registration. */
40 struct unixctl_conn;
41 typedef void unixctl_cb_func(struct unixctl_conn *,
42                              int argc, const char *argv[], void *aux);
43 void unixctl_command_register(const char *name, const char *usage,
44                               int min_args, int max_args,
45                               unixctl_cb_func *cb, void *aux);
46 void unixctl_command_reply_error(struct unixctl_conn *, const char *error);
47 void unixctl_command_reply(struct unixctl_conn *, const char *body);
48
49 #ifdef  __cplusplus
50 }
51 #endif
52
53 #endif /* unixctl.h */