X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Funixctl.h;h=ce43893c6a7d3305573d560ba9590d493397de02;hb=c5cf10598f8c9f4428291e9df3ecd72a05fb1ccf;hp=18748aa766e54aa9020eccd29a6bf1bb087c254a;hpb=a14bc59fb8f27db193d74662dc9c5cb8237177ef;p=sliver-openvswitch.git diff --git a/lib/unixctl.h b/lib/unixctl.h index 18748aa76..ce43893c6 100644 --- a/lib/unixctl.h +++ b/lib/unixctl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009 Nicira Networks. + * Copyright (c) 2008, 2009, 2011 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,10 @@ #ifndef UNIXCTL_H #define UNIXCTL_H 1 +#ifdef __cplusplus +extern "C" { +#endif + /* Server for Unix domain socket control connection. */ struct unixctl_server; int unixctl_server_create(const char *path, struct unixctl_server **); @@ -25,20 +29,25 @@ void unixctl_server_wait(struct unixctl_server *); void unixctl_server_destroy(struct unixctl_server *); /* Client for Unix domain socket control connection. */ -struct unixctl_client; -int unixctl_client_create(const char *path, struct unixctl_client **); -void unixctl_client_destroy(struct unixctl_client *); -int unixctl_client_transact(struct unixctl_client *, - const char *request, - int *reply_code, char **reply_body); -const char *unixctl_client_target(const struct unixctl_client *); +struct jsonrpc; +int unixctl_client_create(const char *path, struct jsonrpc **client); +int unixctl_client_transact(struct jsonrpc *client, + const char *command, + int argc, char *argv[], + char **result, char **error); /* Command registration. */ struct unixctl_conn; -void unixctl_command_register(const char *name, - void (*cb)(struct unixctl_conn *, - const char *args)); -void unixctl_command_reply(struct unixctl_conn *, int code, - const char *body); +typedef void unixctl_cb_func(struct unixctl_conn *, + int argc, const char *argv[], void *aux); +void unixctl_command_register(const char *name, const char *usage, + int min_args, int max_args, + unixctl_cb_func *cb, void *aux); +void unixctl_command_reply_error(struct unixctl_conn *, const char *error); +void unixctl_command_reply(struct unixctl_conn *, const char *body); + +#ifdef __cplusplus +} +#endif #endif /* unixctl.h */