-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef _JSONRPC_H | ||
#define _JSONRPC_H | ||
|
||
#include "json.h" | ||
#include "s8.h" | ||
|
||
struct jsonrpc_request { | ||
struct json_value id; | ||
struct s8 method; | ||
struct json_object *params; | ||
}; | ||
|
||
struct jsonrpc_response { | ||
struct json_value id; | ||
bool ok; | ||
union { | ||
struct json_value result; | ||
struct jsonrpc_error error; | ||
} value; | ||
}; | ||
|
||
struct jsonrpc_error { | ||
int code; | ||
struct s8 message; | ||
struct json_value data; | ||
}; | ||
|
||
struct jsonrpc_request jsonrpc_request_create(struct s8 method, struct json_object *params); | ||
struct jsonrpc_response jsonrpc_parse_response(const uint8_t *buf, uint64_t size); | ||
struct s8 jsonrpc_request_to_string(const struct jsonprc_request *request); | ||
|
||
#endif |