}
struct jsonrpc_msg *
-jsonrpc_create_request(const char *method, struct json *params)
+jsonrpc_create_request(const char *method, struct json *params,
+ struct json **idp)
{
- return jsonrpc_create(JSONRPC_REQUEST, method, params, NULL, NULL,
- jsonrpc_create_id());
+ struct json *id = jsonrpc_create_id();
+ if (idp) {
+ *idp = json_clone(id);
+ }
+ return jsonrpc_create(JSONRPC_REQUEST, method, params, NULL, NULL, id);
}
struct jsonrpc_msg *
struct jsonrpc_msg *request;
params = json_array_create_empty();
- request = jsonrpc_create_request("echo", params);
+ request = jsonrpc_create_request("echo", params, NULL);
json_destroy(request->id);
request->id = json_string_create("echo");
jsonrpc_send(s->rpc, request);
};
struct jsonrpc_msg *jsonrpc_create_request(const char *method,
- struct json *params);
+ struct json *params,
+ struct json **idp);
struct jsonrpc_msg *jsonrpc_create_notify(const char *method,
struct json *params);
struct jsonrpc_msg *jsonrpc_create_reply(struct json *result,
struct jsonrpc_msg *request;
params = json_array_create_empty();
- request = jsonrpc_create_request("echo", params);
+ request = jsonrpc_create_request("echo", params, NULL);
json_destroy(request->id);
request->id = json_string_create("echo");
jsonrpc_send(s->rpc, request);
struct ovsdb_schema *schema;
int error;
- request = jsonrpc_create_request("get_schema", json_array_create_empty());
+ request = jsonrpc_create_request("get_schema", json_array_create_empty(),
+ NULL);
error = jsonrpc_transact_block(rpc, request, &reply);
if (error) {
ovs_fatal(error, "transaction failed");
transaction = parse_json(argv[2]);
rpc = open_jsonrpc(argv[1]);
- request = jsonrpc_create_request("transact", transaction);
+ request = jsonrpc_create_request("transact", transaction, NULL);
error = jsonrpc_transact_block(rpc, request, &reply);
if (error) {
ovs_fatal(error, "transaction failed");
json_object_put(monitor_requests, argv[2], monitor_request);
monitor = json_array_create_2(json_null_create(), monitor_requests);
- request = jsonrpc_create_request("monitor", monitor);
+ request = jsonrpc_create_request("monitor", monitor, NULL);
request_id = json_clone(request->id);
jsonrpc_send(rpc, request);
for (;;) {
method = argv[2];
params = parse_json(argv[3]);
- msg = jsonrpc_create_request(method, params);
+ msg = jsonrpc_create_request(method, params, NULL);
string = jsonrpc_msg_is_valid(msg);
if (string) {
ovs_fatal(0, "not a valid JSON-RPC request: %s", string);