Giter Club home page Giter Club logo

jsonrpc's People

Contributors

pijyoi avatar ycongal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsonrpc's Issues

Documentation of depency versions

Could the readme please list minimum versions for the depencies (jansson and - for the demo server - zeromq)? Or "version which it is known to work with", ie the version you used?

The cause of error messages from the compiler &c when versions don't match up aren't always immediately obvious ;)

From what I've seen,
jansson 2.3 is probably required and sufficient ("New in version 2.3: Any s representing a key may be suffixed with a ? to make the key optional." -- https://jansson.readthedocs.org/en/latest/apiref.html#parsing-and-validating-values)

libzmq 3.2.2 is probably (??) required and sufficient (API changes for 3.x and "All other 3.x versions up to 3.2.1 are only compatible with themselves" -- http://zeromq.org/area:faq)

Ubuntu's latest LTS doesn't have either, grumble :)

Feature request

I like your API, nice and clean. I tried to use it for one of my projects, however it is missing an important feature. Most of my projects are written with glib/gobject and it would be helpful to be able to pass an arbitrary pointer to some "user_data" which could be and object or a closure. Do you think this is something you could add to your API?

For instamce modify this type:

typedef int (*jsonrpc_method_prototype)(json_t *json_params, json_t **result);

as follows:

typedef int (*jsonrpc_method_prototype)(json_t *json_params, json_t **result, void *user_data);

and either modify existing jsonrpc_handler function or create a new one as follows:

char *jsonrpc_handler_full(const char *input, size_t input_len, struct jsonrpc_method_entry_t method_table[], void *user_data);

free(): invalid pointer: 0x08055f19 ***

I am trying to use your codes in my program. I extended your example to pass Json object instead of integer array as the params. however, when I do this, I can't use the Jasson functions (https://jansson.readthedocs.org/en/2.5/apiref.html#json_object_foreach) to extract the json object and give me this error. I checked the json message received and it is valid. So do you know what is wrong?

[DEBUG] Recv {"jsonrpc":"2.0","method":"measure","params":{"nodes":[{"node_id":"0","interfaces":[{"ifname":"eth0","ip_addr":"10.0.0.39","mac_addr":"00:0c:42:69:69:48"},{"ifname":"wlan0","ip_addr":"10.0.1.39","mac_addr":"00:0c:42:69:69:49"}]},{"node_id":"1","interfaces":[{"ifname":"eth0","ip_addr":"10.0.0.41","mac_addr":"00:0b:6b:0a:82:0a"},{"ifname":"wlan0","ip_addr":"10.0.1.41","mac_addr":"00:0b:6b:0a:82:0b"},{"ifname":"wlan1","ip_addr":"10.0.1.41","mac_addr":"00:0b:6b:0a:82:0c"}]}]},"id":0}
test****
*** glibc detected *** /myGitHub/manager.c: free(): invalid pointer: 0x08055f19 ***
======= Memory map: ========

b7c47000-b7c71000 r-xp 00000000 08:01 10227888 /lib/i386-linux-gnu/libm-2.15.so
b7c71000-b7c72000 r--p 00029000 08:01 10227888 /lib/i386-linux-gnu/libm-2.15.so
b7c72000-b7c73000 rw-p 0002a000 08:01 10227888 /lib/i386-linux-gnu/libm-2.15.so
b7c73000-b7c8f000 r-xp 00000000 08:01 10223878 /lib/i386-linux-gnu/libgcc_s.so.1
b7c8f000-b7c90000 r--p 0001b000 08:01 10223878 /lib/i386-linux-gnu/libgcc_s.so.1
b7c90000-b7c91000 rw-p 0001c000 08:01 10223878 /lib/i386-linux-gnu/libgcc_s.so.1
b7c91000-b7d69000 r-xp 00000000 08:01 3672745 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
b7d69000-b7d6a000 ---p 000d8000 08:01 3672745 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
b7d6a000-b7d6e000 r--p 000d8000 08:01 3672745 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
b7d6e000-b7d6f000 rw-p 000dc000 08:01 3672745 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
b7d6f000-b7d76000 rw-p 00000000 00:00 0
b7d76000-b7d7d000 r-xp 00000000 08:01 10227880 /lib/i386-linux-gnu/librt-2.15.so
b7d7d000-b7d7e000 r--p 00006000 08:01 10227880 /lib/i386-linux-gnu/librt-2.15.so
b7d7e000-b7d7f000 rw-p 00007000 08:01 10227880 /lib/i386-linux-gnu/librt-2.15.so
b7d7f000-b7d80000 rw-p 00000000 00:00 0
b7d80000-b7f23000 r-xp 00000000 08:01 10227866 /lib/i386-linux-gnu/libc-2.15.so
b7f23000-b7f25000 r--p 001a3000 08:01 10227866 /lib/i386-linux-gnu/libc-2.15.so
b7f25000-b7f26000 rw-p 001a5000 08:01 10227866 /lib/i386-linux-gnu/libc-2.15.so
b7f26000-b7f29000 rw-p 00000000 00:00 0
b7f29000-b7f32000 r-xp 00000000 08:01 4067507 /usr/local/lib/libfiretide.so.0.0.0
b7f32000-b7f33000 r--p 00008000 08:01 4067507 /usr/local/lib/libfiretide.so.0.0.0
b7f33000-b7f34000 rw-p 00009000 08:01 4067507 /usr/local/lib/libfiretide.so.0.0.0
b7f34000-b7f43000 r-xp 00000000 08:01 4079650 /usr/local/lib/libprotobuf-c.so.0.0.0
b7f43000-b7f44000 r--p 0000e000 08:01 4079650 /usr/local/lib/libprotobuf-c.so.0.0.0
b7f44000-b7f45000 rw-p 0000f000 08:01 4079650 /usr/local/lib/libprotobuf-c.so.0.0.0
b7f45000-b7f5c000 r-xp 00000000 08:01 10227884 /lib/i386-linux-gnu/libpthread-2.15.so
b7f5c000-b7f5d000 r--p 00016000 08:01 10227884 /lib/i386-linux-gnu/libpthread-2.15.so
b7f5d000-b7f5e000 rw-p 00017000 08:01 10227884 /lib/i386-linux-gnu/libpthread-2.15.so
b7f5e000-b7f60000 rw-p 00000000 00:00 0
b7f7d000-b7f7f000 rw-p 00000000 00:00 0
b7f7f000-b7f89000 r-xp 00000000 08:01 4063439 /usr/local/lib/libjansson.so.4.4.0
b7f89000-b7f8a000 r--p 00009000 08:01 4063439 /usr/local/lib/libjansson.so.4.4.0
b7f8a000-b7f8b000 rw-p 0000a000 08:01 4063439 /usr/local/lib/libjansson.so.4.4.0
b7f8b000-b7f8c000 rw-p 00000000 00:00 0
b7f8c000-b7fcc000 r-xp 00000000 08:01 4070753 /usr/local/lib/libzmq.so.3.0.0
b7fcc000-b7fcf000 r--p 0003f000 08:01 4070753 /usr/local/lib/libzmq.so.3.0.0
b7fcf000-b7fd0000 rw-p 00042000 08:01 4070753 /usr/local/lib/libzmq.so.3.0.0
b7fd0000-b7fd9000 r-xp 00000000 08:01 4085681 /usr/local/lib/libjson-c.so.2.0.1
b7fd9000-b7fda000 r--p 00008000 08:01 4085681 /usr/local/lib/libjson-c.so.2.0.1
b7fda000-b7fdb000 rw-p 00009000 08:01 4085681 /usr/local/lib/libjson-c.so.2.0.1
b7fdb000-b7fdd000 rw-p 00000000 00:00 0
b7fdd000-b7fde000 r-xp 00000000 00:00 0 [vdso]
b7fde000-b7ffe000 r-xp 00000000 08:01 10227890 /lib/i386-linux-gnu/ld-2.15.so
b7ffe000-b7fff000 r--p 0001f000 08:01 10227890 /lib/i386-linux-gnu/ld-2.15.so
b7fff000-b8000000 rw-p 00020000 08:01 10227890 /lib/i386-linux-gnu/ld-2.15.so
bffdf000-c0000000 rw-p 00000000 00:00 0 [stack]

Program received signal SIGABRT, Aborted.
0xb7fdd424 in __kernel_vsyscall ()
(gdb) bt
#0 0xb7fdd424 in __kernel_vsyscall ()
#1 0xb7dae1df in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2 0xb7db1825 in __GI_abort () at abort.c:91
#3 0xb7deb39a in __libc_message (do_abort=2, fmt=0xb7ee5aa8 "*** glibc detected *** %s: %s: 0x%s ***\n")

at ../sysdeps/unix/sysv/linux/libc_fatal.c:201

#4 0xb7df5ee2 in malloc_printerr (action=, str=, ptr=0x8055f19) at malloc.c:5018
#5 0xb7f837a0 in jsonp_free (ptr=0x8055f19) at memory.c:32
#6 0xb7f8176c in hashtable_close (hashtable=0x8055ef8) at hashtable.c:221
#7 0xb7f85bdb in json_delete_object (object=0x8055ef0) at value.c:58
#8 json_delete (json=0x8055ef0) at value.c:831
#9 0x0804b670 in json_decref (json=0x8055ef0) at /usr/local/include/jansson.h:107
#10 jsonrpc_handler (

input=0xb6b11114 "{\"jsonrpc\":\"2.0\",\"method\":\"measure\",\"params\":{\"nodes\":[{\"node_id\":\"0\",\"interfaces\":[{\"ifname\":\"eth0\",\"ip_addr\":\"10.0.0.39\",\"mac_addr\":\"00:0c:42:69:69:48\"},{\"ifname\":\"wlan0\",\"ip_addr\":\"10.0.1.39\",\"mac_"..., input_len=484, method_table=0x80521c0) at jsonrpc.c:263

#11 0x0804bb1b in service_request () at tcp_webserver.c:230
#12 0x0804a105 in main (argc=1, argv=0xbffff084) at ca_manager.c:212

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.