Re: [sr-dev] [kamailio/kamailio] cfg_rpc: extending the functionality of cfg.get command (#1321)

2018-01-23 Thread Daniel-Constantin Mierla
The issue with `n = rpc->scan(c, "S*S", &group, &var);` was due to a bug in 
`ctl` module, using `kamcmd` revealed that. Using `kamctl` with `jsonrpcs` 
module was not affected. The bug is fixed now in master and it will be 
backported.

Besides using the `*` specifier for optional params, your patch in this PR was 
adjusted so that the `cfg.get` for a group returns a structure with field names 
and values. All are in master now.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1321#issuecomment-359851175___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] cfg_rpc: extending the functionality of cfg.get command (#1321)

2018-01-23 Thread Daniel-Constantin Mierla
Closed #1321.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1321#event-1437725237___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] cfg_rpc: extending the functionality of cfg.get command (#1321)

2017-12-22 Thread hdikme
I have tested it with the version 5.0.1 using kamctl rpc ... and the result 
hasn't changed.
n = rpc->scan(c, "S*S", &group, &var);
n equals to -1 in case of using only the group name. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1321#issuecomment-353596580___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] cfg_rpc: extending the functionality of cfg.get command (#1321)

2017-12-15 Thread Daniel-Constantin Mierla
Btw, kamcmd is not a replacement for kamctl.

kamcmd is only a binrpc client application that connects to ctl module of 
kamailio.

kamcli might replace kamcmd, but no timeline for that. kamctl is still very 
active maintained and enhanced with each release.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1321#issuecomment-351980619___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] cfg_rpc: extending the functionality of cfg.get command (#1321)

2017-12-15 Thread Daniel-Constantin Mierla
Are you testing with master branch (or 5.x)? `kamctl rpc ...` works there.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1321#issuecomment-351977054___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] cfg_rpc: extending the functionality of cfg.get command (#1321)

2017-12-15 Thread hdikme
Yes, I use kamcmd as I think this is the new one and this should replace kamctl 
someday in the future. I tried with kamctl rpc, but it just prints out the help 
page of kamctl. It seems kamctl does not know rpc as a parameter. Maybe you can 
provide me a more detailed description how to test this with kamctl? Or maybe 
it's even faster you test it yourself using kamctl?
 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1321#issuecomment-351973327___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] cfg_rpc: extending the functionality of cfg.get command (#1321)

2017-12-08 Thread Daniel-Constantin Mierla
What do you use to send the rpc commands - `kamcmd`? If yes, can you try also 
with `kamctl rpc cfg.get ...`? I want to see if it is some issue in `ctl` 
module. For kamctl you need jsonrpcs module to be loaded.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1321#issuecomment-350205903___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] cfg_rpc: extending the functionality of cfg.get command (#1321)

2017-12-08 Thread hdikme
@miconda - I have tested the code with the changes based on your review. First 
part is indeed more appropriate (S*S) but i have a problem with the value of n. 
If only one parameter (group name) is given , n is still assigned -1. Either 
was S*S or SS returns -1. What do you think?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1321#issuecomment-350204735___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] cfg_rpc: extending the functionality of cfg.get command (#1321)

2017-12-07 Thread Daniel-Constantin Mierla
@hdikme - planning to have the new patch soon? Just to evaluate if this needs 
to be in 5.1 or not which is going to be out in few days...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1321#issuecomment-350191889___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] cfg_rpc: extending the functionality of cfg.get command (#1321)

2017-11-24 Thread hdikme
hdikme commented on this pull request.



> + str group, var;
+   void*val;
+   unsigned intval_type;
+   int ret, n;
+   unsigned int*group_id;
+
+   n = rpc->scan(c, "SS", &group, &var);
+   /*  2: both group and variable name are present
+* -1: only group is present, print all variables in the group */
+   if(n<2) {
+   if (n == -1) {
+   var.s = NULL;
+   var.len = 0;
+   }
+   else return;
+   }

Thank you for the review, sure i'll send a new patch with the changes.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1321#discussion_r152974588___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] cfg_rpc: extending the functionality of cfg.get command (#1321)

2017-11-23 Thread Daniel-Constantin Mierla
miconda commented on this pull request.



> + str group, var;
+   void*val;
+   unsigned intval_type;
+   int ret, n;
+   unsigned int*group_id;
+
+   n = rpc->scan(c, "SS", &group, &var);
+   /*  2: both group and variable name are present
+* -1: only group is present, print all variables in the group */
+   if(n<2) {
+   if (n == -1) {
+   var.s = NULL;
+   var.len = 0;
+   }
+   else return;
+   }

I think that the right way is to read with optional specifier `*`:

```
n = rpc->scan(c, "S*S", &group, &var);
```

The n is two if both were read or 1 if only group is read.

When n is -1, there can be other errors.

Otherwise, the patch is useful, thanks!

Can you do a new patch based on what I suggested? It can be a follow up of this 
one, we can squash from the web when merging.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1321#pullrequestreview-78659969___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] [kamailio/kamailio] cfg_rpc: extending the functionality of cfg.get command (#1321)

2017-11-20 Thread hdikme
- rpc_get function can be also called with only entering the group name 
information.
Before it used to work only with group name and variable name and returning the 
value for a variable.
With the enhancement, it is also possible to retrieve all variable values 
belonging to a specific group.
e.g.: kamcmd cfg.get core.
Above given example will print the values of all variables of the configuration 
group "core".





 Pre-Submission Checklist



- [ ] Commit message has the format required by CONTRIBUTING guide
- [ ] Commits are split per component (core, individual modules, libs, utils, 
...)
- [ ] Each component has a single commit (if not, squash them into one commit)
- [ ] No commits to README files for modules (changes must be done to docbook 
files
in `doc/` subfolder, the README file is autogenerated)

 Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)

 Checklist:

- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description

rpc_get function can be also called with only entering the group name 
information.
Before it used to work only with group name and variable name and returning the 
value for a variable.
With the enhancement, it is also possible to retrieve all variable values 
belonging to a specific group.
e.g.: kamcmd cfg.get core.
Above given example will print the values of all variables of the configuration 
group "core".

You can view, comment on, or merge this pull request online at:

  https://github.com/kamailio/kamailio/pull/1321

-- Commit Summary --

  * cfg_rpc: extending the functionality of cfg.get command

-- File Changes --

M src/modules/cfg_rpc/cfg_rpc.c (112)
M src/modules/cfg_rpc/doc/rpc.xml (4)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/1321.patch
https://github.com/kamailio/kamailio/pull/1321.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1321
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev