| 1 |
/* |
| 2 |
* Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team |
| 3 |
* Rights to this code are as documented in doc/pod/license.pod. |
| 4 |
* |
| 5 |
* JSON-RPC for Ermyth |
| 6 |
* |
| 7 |
* $Id: rpc.h,v 1.2 2007-08-28 17:08:12 pippijn Exp $ |
| 8 |
*/ |
| 9 |
|
| 10 |
#ifndef JSONRPC_H |
| 11 |
#define JSONRPC_H |
| 12 |
|
| 13 |
/* |
| 14 |
* JSON-RPC implementation in C++ |
| 15 |
* |
| 16 |
* See the rpctest example for reference. |
| 17 |
*/ |
| 18 |
|
| 19 |
#include <stddef.h> |
| 20 |
|
| 21 |
#include "json/json.h" |
| 22 |
|
| 23 |
namespace json |
| 24 |
{ |
| 25 |
struct jsonrpc_event |
| 26 |
{ |
| 27 |
long id; |
| 28 |
char *type; |
| 29 |
time_t tm; |
| 30 |
Value data; |
| 31 |
}; |
| 32 |
|
| 33 |
typedef void (*jsonrpc_method) (void *userdata, Value &request, Value &response); |
| 34 |
extern void jsonrpc_add_method (char const * const name, jsonrpc_method method); |
| 35 |
extern void jsonrpc_service (void *userdata, Value &request, Value &response); |
| 36 |
extern void jsonrpc_process (void *userdata, char *response, char const *request, size_t response_len); |
| 37 |
} |
| 38 |
|
| 39 |
#endif |