Changeset 5625
Change dynamic strings to only malloc the actual string data
Comitted by:
mjagdis
Date:
Feb 10 2010 * 19:08 (about 1 year ago)
Affected files:
callweaver/trunk/apps/app_changrab.c (diff)
callweaver/trunk/apps/app_devstate.c (diff)
callweaver/trunk/apps/app_groupcount.c (diff)
callweaver/trunk/apps/app_meetme.c (diff)
callweaver/trunk/apps/app_muxmon.c (diff)
callweaver/trunk/apps/app_queue.c (diff)
callweaver/trunk/apps/app_valetparking.c (diff)
callweaver/trunk/apps/app_voicemail.c (diff)
callweaver/trunk/apps/icd/icd_caller.c (diff)
callweaver/trunk/apps/icd/icd_caller_list.c (diff)
callweaver/trunk/apps/icd/icd_command.c (diff)
callweaver/trunk/apps/icd/icd_distributor.c (diff)
callweaver/trunk/apps/icd/icd_distributor_list.c (diff)
callweaver/trunk/apps/icd/icd_list.c (diff)
callweaver/trunk/apps/icd/icd_listeners.c (diff)
callweaver/trunk/apps/icd/icd_member.c (diff)
callweaver/trunk/apps/icd/icd_member_list.c (diff)
callweaver/trunk/apps/icd/icd_metalist.c (diff)
callweaver/trunk/apps/icd/icd_mod_agent_priority_groups.c (diff)
callweaver/trunk/apps/icd/icd_plugable_fn_list.c (diff)
callweaver/trunk/apps/icd/icd_queue.c (diff)
callweaver/trunk/apps/nconference/cli.c (diff)
callweaver/trunk/cdr/cdr_csv.c (diff)
callweaver/trunk/cdr/cdr_mysql.c (diff)
callweaver/trunk/channels/capi/chan_capi.c (diff)
callweaver/trunk/channels/chan_agent.c (diff)
callweaver/trunk/channels/chan_alsa.c (diff)
callweaver/trunk/channels/chan_bluetooth.c (diff)
callweaver/trunk/channels/chan_bluetooth.h (diff)
callweaver/trunk/channels/chan_local.c (diff)
callweaver/trunk/channels/chan_mgcp.c (diff)
callweaver/trunk/channels/chan_sip.c (diff)
callweaver/trunk/channels/chan_unicall.c (diff)
callweaver/trunk/channels/chan_woomera.c (diff)
callweaver/trunk/channels/chan_zap.c (diff)
callweaver/trunk/channels/fax/chan_fax.c (diff)
callweaver/trunk/channels/iax2/chan_iax2.c (diff)
callweaver/trunk/channels/misdn/chan_misdn.c (diff)
callweaver/trunk/channels/sccp/sccp_cli.c (diff)
callweaver/trunk/channels/visdn/chan_visdn.c (diff)
callweaver/trunk/channels/visdn/huntgroup.c (diff)
callweaver/trunk/channels/visdn/intf.c (diff)
callweaver/trunk/corelib/callweaver.c (diff)
callweaver/trunk/corelib/callweaver_mm.c (diff)
callweaver/trunk/corelib/cdr.c (diff)
callweaver/trunk/corelib/channel.c (diff)
callweaver/trunk/corelib/cli.c (diff)
callweaver/trunk/corelib/config.c (diff)
callweaver/trunk/corelib/console.c (diff)
callweaver/trunk/corelib/crypto.c (diff)
callweaver/trunk/corelib/db.c (diff)
callweaver/trunk/corelib/dynstr.c (diff)
callweaver/trunk/corelib/features.c (diff)
callweaver/trunk/corelib/file.c (diff)
callweaver/trunk/corelib/frame.c (diff)
callweaver/trunk/corelib/function.c (diff)
callweaver/trunk/corelib/image.c (diff)
callweaver/trunk/corelib/loader.c (diff)
callweaver/trunk/corelib/logger.c (diff)
callweaver/trunk/corelib/manager.c (diff)
callweaver/trunk/corelib/pbx.c (diff)
callweaver/trunk/corelib/rtp.c (diff)
callweaver/trunk/corelib/stun.c (diff)
callweaver/trunk/corelib/translate.c (diff)
callweaver/trunk/corelib/udptl.c (diff)
callweaver/trunk/include/callweaver/channel.h (diff)
callweaver/trunk/include/callweaver/cli.h (diff)
callweaver/trunk/include/callweaver/dynstr.h (diff)
callweaver/trunk/include/callweaver/icd/icd_caller.h (diff)
callweaver/trunk/include/callweaver/icd/icd_caller_list.h (diff)
callweaver/trunk/include/callweaver/icd/icd_caller_private.h (diff)
callweaver/trunk/include/callweaver/icd/icd_command.h (diff)
callweaver/trunk/include/callweaver/icd/icd_distributor.h (diff)
callweaver/trunk/include/callweaver/icd/icd_distributor_list.h (diff)
callweaver/trunk/include/callweaver/icd/icd_distributor_private.h (diff)
callweaver/trunk/include/callweaver/icd/icd_list.h (diff)
callweaver/trunk/include/callweaver/icd/icd_list_private.h (diff)
callweaver/trunk/include/callweaver/icd/icd_listeners.h (diff)
callweaver/trunk/include/callweaver/icd/icd_member.h (diff)
callweaver/trunk/include/callweaver/icd/icd_member_list.h (diff)
callweaver/trunk/include/callweaver/icd/icd_metalist.h (diff)
callweaver/trunk/include/callweaver/icd/icd_plugable_fn_list.h (diff)
callweaver/trunk/include/callweaver/icd/icd_queue.h (diff)
callweaver/trunk/include/callweaver/manager.h (diff)
callweaver/trunk/include/callweaver/stun.h (diff)
callweaver/trunk/pbx/pbx_ael.c (diff)
callweaver/trunk/pbx/pbx_config.c (diff)
callweaver/trunk/pbx/pbx_dundi.c (diff)
callweaver/trunk/res/include/res_odbc.h (diff)
callweaver/trunk/res/res_config_mysql.c (diff)
callweaver/trunk/res/res_indications.c (diff)
callweaver/trunk/res/res_jabber.c (diff)
callweaver/trunk/res/res_monitor.c (diff)
callweaver/trunk/res/res_musiconhold.c (diff)
callweaver/trunk/res/res_odbc.c (diff)
callweaver/trunk/res/res_ogi.c (diff)
callweaver/trunk/res/res_osp.c (diff)
callweaver/trunk/res/res_sqlite.c (diff)
callweaver/trunk/apps/app_changrab.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | |
| 165 | static int changrab_cli(struct cw_dynstr **ds_p, int argc, char *argv[]) { | |
| 165 | static int changrab_cli(struct cw_dynstr *ds_p, int argc, char *argv[]) { | |
| 166 | 166 | char *chan_name_1, *chan_name_2 = NULL, *context,*exten,*flags=NULL; |
| 167 | 167 | char *pria = NULL; |
| 168 | 168 | struct cw_channel *chan, *xferchan_1, *xferchan_2; |
| --- | --- | |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | |
| 352 | static int originate_cli(struct cw_dynstr **ds_p, int argc, char *argv[]) { | |
| 352 | static int originate_cli(struct cw_dynstr *ds_p, int argc, char *argv[]) { | |
| 353 | 353 | pthread_t tid; |
| 354 | 354 | char *chan_name_1,*context,*exten,*tech,*data,*callerid; |
| 355 | 355 | int pri=0,to=60000; |
| --- | --- | |
| 415 | 415 | |
| 416 | 416 | |
| 417 | 417 | |
| 418 | static void complete_exten_at_context(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 418 | static void complete_exten_at_context(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 419 | 419 | { |
| 420 | 420 | struct cw_context *c; |
| 421 | 421 | struct cw_exten *e; |
| --- | --- | |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | |
| 514 | static void complete_cg(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 514 | static void complete_cg(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 515 | 515 | { |
| 516 | 516 | |
| 517 | 517 | if (lastarg == 1) |
| --- | --- | |
| 520 | 520 | complete_exten_at_context(ds_p, argv, lastarg, lastarg_len); |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | static void complete_org(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 523 | static void complete_org(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 524 | 524 | { |
| 525 | 525 | if (lastarg >= 2) |
| 526 | 526 | complete_exten_at_context(ds_p, argv, lastarg, lastarg_len); |
callweaver/trunk/apps/app_devstate.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 41 | 41 | "Usage: DevState device state\n" |
| 42 | 42 | " Generate a device state change event given the input parameters.\n"; |
| 43 | 43 | |
| 44 | static int devstate_cli(struct cw_dynstr **ds_p, int argc, char *argv[]); | |
| 44 | static int devstate_cli(struct cw_dynstr *ds_p, int argc, char *argv[]); | |
| 45 | 45 | static struct cw_clicmd cli_dev_state = { |
| 46 | 46 | .cmda = { "devstate", NULL }, |
| 47 | 47 | .handler = devstate_cli, |
| --- | --- | |
| 50 | 50 | }; |
| 51 | 51 | |
| 52 | 52 | |
| 53 | static int devstate_cli(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 53 | static int devstate_cli(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 54 | 54 | { |
| 55 | 55 | if ((argc != 3) && (argc != 4) && (argc != 5)) |
| 56 | 56 | return RESULT_SHOWUSAGE; |
callweaver/trunk/apps/app_groupcount.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 246 | 246 | |
| 247 | 247 | #define FORMAT_STRING "%-25s %-20s %-20s\n" |
| 248 | 248 | |
| 249 | static int group_show_channels(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 249 | static int group_show_channels(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 250 | 250 | { |
| 251 | 251 | regex_t regexbuf; |
| 252 | 252 | struct cw_group_info *gi = NULL; |
callweaver/trunk/apps/app_meetme.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 514 | 514 | return cnf; |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | static int confs_show(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 517 | static int confs_show(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 518 | 518 | { |
| 519 | 519 | CW_UNUSED(argc); |
| 520 | 520 | CW_UNUSED(argv); |
| --- | --- | |
| 534 | 534 | .usage = show_confs_usage, |
| 535 | 535 | }; |
| 536 | 536 | |
| 537 | static int conf_cmd(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 537 | static int conf_cmd(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 538 | 538 | { |
| 539 | 539 | /* Process the command */ |
| 540 | 540 | char buf[1024] = ""; |
| --- | --- | |
| 685 | 685 | return 0; |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | static void complete_confcmd(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 688 | static void complete_confcmd(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 689 | 689 | { |
| 690 | 690 | static const char *cmds[] = {"lock", "unlock", "mute", "unmute", "kick", "list"}; |
| 691 | 691 | int x = 0; |
callweaver/trunk/apps/app_muxmon.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | |
| 433 | static int muxmon_cli(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 433 | static int muxmon_cli(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 434 | 434 | { |
| 435 | 435 | char *op; |
| 436 | 436 | char *chan_name = NULL; |
callweaver/trunk/apps/app_queue.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 3697 | 3697 | cw_mutex_unlock(&qlock); |
| 3698 | 3698 | } |
| 3699 | 3699 | |
| 3700 | static int __queues_show(int manager, struct cw_dynstr **ds_p, int argc, char **argv, int queue_show) | |
| 3700 | static int __queues_show(int manager, struct cw_dynstr *ds_p, int argc, char **argv, int queue_show) | |
| 3701 | 3701 | { |
| 3702 | 3702 | struct cw_call_queue *q; |
| 3703 | 3703 | struct queue_ent *qe; |
| --- | --- | |
| 3800 | 3800 | return RESULT_SUCCESS; |
| 3801 | 3801 | } |
| 3802 | 3802 | |
| 3803 | static int queues_show(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 3803 | static int queues_show(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 3804 | 3804 | { |
| 3805 | 3805 | return __queues_show(0, ds_p, argc, argv, 0); |
| 3806 | 3806 | } |
| 3807 | 3807 | |
| 3808 | static int queue_show(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 3808 | static int queue_show(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 3809 | 3809 | { |
| 3810 | 3810 | return __queues_show(0, ds_p, argc, argv, 1); |
| 3811 | 3811 | } |
| 3812 | 3812 | |
| 3813 | static void complete_queue(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 3813 | static void complete_queue(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 3814 | 3814 | { |
| 3815 | 3815 | struct cw_call_queue *q; |
| 3816 | 3816 | |
| --- | --- | |
| 3837 | 3837 | CW_UNUSED(req); |
| 3838 | 3838 | |
| 3839 | 3839 | if ((msg = cw_manager_response("Follows", NULL))) { |
| 3840 | __queues_show(1, &msg->data, 2, (char **)a, 0); | |
| 3841 | cw_dynstr_printf(&msg->data, "--END COMMAND--\r\n\r\n"); | |
| 3840 | __queues_show(1, &msg->ds, 2, (char **)a, 0); | |
| 3841 | cw_dynstr_printf(&msg->ds, "--END COMMAND--\r\n\r\n"); | |
| 3842 | 3842 | } |
| 3843 | 3843 | |
| 3844 | 3844 | return msg; |
| --- | --- | |
| 4099 | 4099 | return msg; |
| 4100 | 4100 | } |
| 4101 | 4101 | |
| 4102 | static int handle_add_queue_member(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 4102 | static int handle_add_queue_member(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 4103 | 4103 | { |
| 4104 | 4104 | char *queuename, *interface; |
| 4105 | 4105 | int penalty; |
| --- | --- | |
| 4157 | 4157 | return ret; |
| 4158 | 4158 | } |
| 4159 | 4159 | |
| 4160 | static void complete_add_queue_member(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 4160 | static void complete_add_queue_member(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 4161 | 4161 | { |
| 4162 | 4162 | int i; |
| 4163 | 4163 | |
| --- | --- | |
| 4186 | 4186 | } |
| 4187 | 4187 | } |
| 4188 | 4188 | |
| 4189 | static int handle_remove_queue_member(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 4189 | static int handle_remove_queue_member(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 4190 | 4190 | { |
| 4191 | 4191 | char *queuename, *interface; |
| 4192 | 4192 | |
| --- | --- | |
| 4221 | 4221 | } |
| 4222 | 4222 | } |
| 4223 | 4223 | |
| 4224 | static void complete_remove_queue_member(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 4224 | static void complete_remove_queue_member(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 4225 | 4225 | { |
| 4226 | 4226 | struct cw_call_queue *q; |
| 4227 | 4227 | struct member *m; |
callweaver/trunk/apps/app_valetparking.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 764 | 764 | } |
| 765 | 765 | |
| 766 | 766 | |
| 767 | static int handle_valetparkedcalls(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 767 | static int handle_valetparkedcalls(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 768 | 768 | { |
| 769 | 769 | struct valetparkeduser *cur; |
| 770 | 770 |
callweaver/trunk/apps/app_voicemail.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 5611 | 5611 | "Usage: show voicemail zones\n" |
| 5612 | 5612 | " Lists zone message formats\n"; |
| 5613 | 5613 | |
| 5614 | static int handle_show_voicemail_users(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 5614 | static int handle_show_voicemail_users(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 5615 | 5615 | { |
| 5616 | 5616 | struct cw_vm_user *vmu = users; |
| 5617 | 5617 | const char output_format[] = "%-10s %-5s %-25s %-10s %6s\n"; |
| --- | --- | |
| 5665 | 5665 | return RESULT_SUCCESS; |
| 5666 | 5666 | } |
| 5667 | 5667 | |
| 5668 | static int handle_show_voicemail_zones(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 5668 | static int handle_show_voicemail_zones(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 5669 | 5669 | { |
| 5670 | 5670 | static const char output_format[] = "%-15s %-20s %-45s\n"; |
| 5671 | 5671 | struct vm_zone *zone = zones; |
| --- | --- | |
| 5687 | 5687 | return RESULT_SUCCESS; |
| 5688 | 5688 | } |
| 5689 | 5689 | |
| 5690 | static void complete_show_voicemail_users(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 5690 | static void complete_show_voicemail_users(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 5691 | 5691 | { |
| 5692 | 5692 | struct cw_vm_user *vmu; |
| 5693 | 5693 | const char *context = ""; |
callweaver/trunk/apps/icd/icd_caller.c (unified diff)
| r5620 | r5625 | |
|---|---|---|
| 519 | 519 | icd_plugable__create_standard_fns(that->plugable_fns_list, data); |
| 520 | 520 | */ |
| 521 | 521 | |
| 522 | that->dump_fn = (icd_status (*)(icd_caller *, int, struct cw_dynstr **, const void *))icd_config__get_any_value(data, "dump", icd_caller__standard_dump); | |
| 522 | that->dump_fn = (icd_status (*)(icd_caller *, int, struct cw_dynstr *, const void *))icd_config__get_any_value(data, "dump", icd_caller__standard_dump); | |
| 523 | 523 | that->dump_fn_extra = icd_config__get_any_value(data, "dump.extra", NULL); |
| 524 | 524 | |
| 525 | 525 | snprintf(buf, sizeof(buf), "Memberships of Caller %s", icd_caller__get_name(that)); |
| --- | --- | |
| 1106 | 1106 | } |
| 1107 | 1107 | |
| 1108 | 1108 | /* Prints the contents of the caller structure to the given file descriptor. */ |
| 1109 | icd_status icd_caller__dump(icd_caller * that, int verbosity, struct cw_dynstr **ds_p) | |
| 1109 | icd_status icd_caller__dump(icd_caller * that, int verbosity, struct cw_dynstr *ds_p) | |
| 1110 | 1110 | { |
| 1111 | 1111 | assert(that != NULL); |
| 1112 | 1112 | assert(that->dump_fn != NULL); |
| --- | --- | |
| 1779 | 1779 | |
| 1780 | 1780 | /***** Callback Setters *****/ |
| 1781 | 1781 | /* The dump function is a virtual function. You set the function to execute here. */ |
| 1782 | icd_status icd_caller__set_dump_fn(icd_caller * that, icd_status(*dump_fn) (icd_caller *, int verbosity, struct cw_dynstr **ds_p, | |
| 1782 | icd_status icd_caller__set_dump_fn(icd_caller * that, icd_status(*dump_fn) (icd_caller *, int verbosity, struct cw_dynstr *ds_p, | |
| 1783 | 1783 | const void *extra), const void *extra) |
| 1784 | 1784 | { |
| 1785 | 1785 | assert(that != NULL); |
| --- | --- | |
| 2716 | 2716 | } |
| 2717 | 2717 | |
| 2718 | 2718 | /* Standard function for printing out a copy of the caller */ |
| 2719 | icd_status icd_caller__standard_dump(icd_caller * caller, int verbosity, struct cw_dynstr **ds_p, void *extra) | |
| 2719 | icd_status icd_caller__standard_dump(icd_caller * caller, int verbosity, struct cw_dynstr *ds_p, void *extra) | |
| 2720 | 2720 | { |
| 2721 | 2721 | //int skip_opening; |
| 2722 | 2722 | |
| --- | --- | |
| 2979 | 2979 | |
| 2980 | 2980 | void icd_caller__dump_debug(icd_caller * that) |
| 2981 | 2981 | { |
| 2982 | struct cw_dynstr *ds = NULL; | |
| 2982 | struct cw_dynstr ds = CW_DYNSTR_INIT; | |
| 2983 | 2983 | |
| 2984 | 2984 | icd_caller__dump_debug_fd(that, &ds, " == "); |
| 2985 | 2985 | cw_dynstr_free(&ds); |
| 2986 | 2986 | } |
| 2987 | 2987 | |
| 2988 | void icd_caller__dump_debug_fd(icd_caller * that, struct cw_dynstr **ds_p, const char *indent) | |
| 2988 | void icd_caller__dump_debug_fd(icd_caller * that, struct cw_dynstr *ds_p, const char *indent) | |
| 2989 | 2989 | { |
| 2990 | 2990 | const char *ptr; |
| 2991 | 2991 | //const char *action; |
callweaver/trunk/apps/icd/icd_caller_list.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /* Prints the contents of the caller structures to the given file descriptor. */ |
| 255 | icd_status icd_caller_list__dump(icd_caller_list * that, int verbosity, struct cw_dynstr **ds_p) | |
| 255 | icd_status icd_caller_list__dump(icd_caller_list * that, int verbosity, struct cw_dynstr *ds_p) | |
| 256 | 256 | { |
| 257 | 257 | assert(that != NULL); |
| 258 | 258 | assert(((icd_list *) that)->dump_fn != NULL); |
| --- | --- | |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | /* Standard caller list dump function */ |
| 416 | icd_status icd_caller_list__standard_dump(icd_list * list, int verbosity, struct cw_dynstr **ds_p, void *extra) | |
| 416 | icd_status icd_caller_list__standard_dump(icd_list * list, int verbosity, struct cw_dynstr *ds_p, void *extra) | |
| 417 | 417 | { |
| 418 | 418 | //static const int skipconst = 1; |
| 419 | 419 | //icd_caller_list *call_list; |
callweaver/trunk/apps/icd/icd_command.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 61 | 61 | */ |
| 62 | 62 | |
| 63 | 63 | static void_hash_table *COMMAND_HASH; |
| 64 | static icd_status icd_command_show_queue(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 65 | static icd_status icd_command_show_agent(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 66 | static icd_status icd_command_show_customer(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 67 | static icd_status icd_command_dump_queue(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 68 | static icd_status icd_command_dump_distributor(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 69 | static icd_status icd_command_dump_agent(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 70 | static icd_status icd_command_dump_customer(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 71 | static icd_status icd_command_load_queues(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 72 | static icd_status icd_command_load_agents(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 73 | static icd_status icd_command_load_conferences(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 74 | static icd_status icd_command_load_app_icd(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 64 | static icd_status icd_command_show_queue(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 65 | static icd_status icd_command_show_agent(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 66 | static icd_status icd_command_show_customer(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 67 | static icd_status icd_command_dump_queue(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 68 | static icd_status icd_command_dump_distributor(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 69 | static icd_status icd_command_dump_agent(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 70 | static icd_status icd_command_dump_customer(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 71 | static icd_status icd_command_load_queues(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 72 | static icd_status icd_command_load_agents(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 73 | static icd_status icd_command_load_conferences(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 74 | static icd_status icd_command_load_app_icd(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 75 | 75 | |
| 76 | 76 | typedef struct icd_command_node icd_command_node; |
| 77 | 77 | |
| 78 | 78 | struct icd_command_node { |
| 79 | int (*func) (struct cw_dynstr **, int, char **); | |
| 79 | int (*func) (struct cw_dynstr *, int, char **); | |
| 80 | 80 | char name[ICD_STRING_LEN]; |
| 81 | 81 | char short_help[ICD_STRING_LEN]; |
| 82 | 82 | char syntax_help[ICD_STRING_LEN]; |
| --- | --- | |
| 142 | 142 | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | static icd_command_node *create_command_node(int (*func) (struct cw_dynstr **, int, char **), const char *name, const char *short_help, const char *syntax_help, const char *long_help) | |
| 145 | static icd_command_node *create_command_node(int (*func) (struct cw_dynstr *, int, char **), const char *name, const char *short_help, const char *syntax_help, const char *long_help) | |
| 146 | 146 | { |
| 147 | 147 | icd_command_node *new; |
| 148 | 148 | |
| --- | --- | |
| 163 | 163 | ICD_FREE((*node)); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | static int cli_line(struct cw_dynstr **ds_p, const char *c, int y) | |
| 166 | static int cli_line(struct cw_dynstr *ds_p, const char *c, int y) | |
| 167 | 167 | { |
| 168 | 168 | int x = 0; |
| 169 | 169 | |
| --- | --- | |
| 174 | 174 | return ICD_SUCCESS; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | int icd_command_register(const char *name, int (*func) (struct cw_dynstr **, int, char **), const char *short_help, const char *syntax_help, const char *long_help) | |
| 177 | int icd_command_register(const char *name, int (*func) (struct cw_dynstr *, int, char **), const char *short_help, const char *syntax_help, const char *long_help) | |
| 178 | 178 | { |
| 179 | 179 | icd_command_node *insert = NULL; |
| 180 | 180 | |
| --- | --- | |
| 188 | 188 | return ICD_EGENERAL; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | static int (*icd_command_pointer(const char *name))(struct cw_dynstr **, int, char **) | |
| 191 | static int (*icd_command_pointer(const char *name))(struct cw_dynstr *, int, char **) | |
| 192 | 192 | { |
| 193 | 193 | icd_command_node *fetch = NULL; |
| 194 | 194 | |
| --- | --- | |
| 213 | 213 | vh_destroy(&COMMAND_HASH); |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | int icd_command_cli(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 216 | int icd_command_cli(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 217 | 217 | { |
| 218 | int (*func) (struct cw_dynstr **, int, char **); | |
| 218 | int (*func) (struct cw_dynstr *, int, char **); | |
| 219 | 219 | char **newargv; |
| 220 | 220 | int newargc; |
| 221 | 221 | int x = 0, y = 0; |
| --- | --- | |
| 251 | 251 | return ICD_SUCCESS; |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | static int icd_command_short_help(struct cw_dynstr **ds_p, icd_command_node * node) | |
| 254 | static int icd_command_short_help(struct cw_dynstr *ds_p, icd_command_node * node) | |
| 255 | 255 | { |
| 256 | 256 | cw_dynstr_printf(ds_p, "'%s'", node->short_help); |
| 257 | 257 | |
| 258 | 258 | return ICD_SUCCESS; |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | static int icd_command_syntax_help(struct cw_dynstr **ds_p, icd_command_node * node) | |
| 261 | static int icd_command_syntax_help(struct cw_dynstr *ds_p, icd_command_node * node) | |
| 262 | 262 | { |
| 263 | 263 | cw_dynstr_printf(ds_p, "Usage: %s %s", node->name, node->syntax_help); |
| 264 | 264 | |
| 265 | 265 | return ICD_SUCCESS; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | static int icd_command_long_help(struct cw_dynstr **ds_p, icd_command_node * node) | |
| 268 | static int icd_command_long_help(struct cw_dynstr *ds_p, icd_command_node * node) | |
| 269 | 269 | { |
| 270 | 270 | cw_dynstr_printf(ds_p, "%s", node->long_help); |
| 271 | 271 | |
| --- | --- | |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /* all our commands */ |
| 276 | int icd_command_list(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 276 | int icd_command_list(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 277 | 277 | { |
| 278 | 278 | icd_command_node *fetch; |
| 279 | 279 | vh_keylist *keys; |
| --- | --- | |
| 323 | 323 | return ICD_SUCCESS; |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | int icd_command_help(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 326 | int icd_command_help(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 327 | 327 | { |
| 328 | 328 | icd_command_list(ds_p, argc, argv); |
| 329 | 329 | cw_dynstr_printf(ds_p, "\nUsage 'icd <command> <arg1> .. <argn>\n"); |
| --- | --- | |
| 332 | 332 | return ICD_SUCCESS; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | int icd_command_bad(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 335 | int icd_command_bad(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 336 | 336 | { |
| 337 | 337 | int x; |
| 338 | 338 | |
| --- | --- | |
| 346 | 346 | return ICD_SUCCESS; |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | int icd_command_verbose(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 349 | int icd_command_verbose(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 350 | 350 | { |
| 351 | 351 | |
| 352 | 352 | if (argc == 2) { |
| --- | --- | |
| 365 | 365 | return ICD_SUCCESS; |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | int icd_command_debug(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 368 | int icd_command_debug(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 369 | 369 | { |
| 370 | 370 | |
| 371 | 371 | if (argc == 2) { |
| --- | --- | |
| 381 | 381 | return ICD_SUCCESS; |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | int icd_command_show(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 384 | int icd_command_show(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 385 | 385 | { |
| 386 | 386 | static const char *help[2] = { "help", "show" }; |
| 387 | 387 | |
| --- | --- | |
| 402 | 402 | return ICD_SUCCESS; |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | icd_status icd_command_show_queue(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 405 | icd_status icd_command_show_queue(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 406 | 406 | { |
| 407 | 407 | //QUEUE UNATTENDED CALLS ASSIGNED/THIS QUEUE/OTHER QUEUE |
| 408 | 408 | #define FMT_QUEUE_HEADING "%-18s %-8s %-14s %-15s %-10s %-18s\n" |
| --- | --- | |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /* Create a cli ui display of the agent */ |
| 480 | icd_status icd_command_show_agent(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 480 | icd_status icd_command_show_agent(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 481 | 481 | { |
| 482 | 482 | #define FMT_AGENT_HEADING "%-10s %-5s %-15s %-25s %-20s %20s %-10s %-5s\n" |
| 483 | 483 | #define FMT_AGENT_DATA1 "%-10s %-5d %-15s %-25s %-20s %-20s " |
| --- | --- | |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | /* Create a cli ui display of the agent */ |
| 575 | icd_status icd_command_show_customer(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 575 | icd_status icd_command_show_customer(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 576 | 576 | { |
| 577 | 577 | #define FMT_CUSTOMER_HEADING "%-10s %-5s %-20s %-25s %-20s %20s %-10s %-5s\n" |
| 578 | 578 | #define FMT_CUSTOMER_DATA1 "%-10s %-5d %-20s %-25s %-20s %-20s " |
| --- | --- | |
| 668 | 668 | |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | int icd_command_dump(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 671 | int icd_command_dump(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 672 | 672 | { |
| 673 | 673 | static const char *help[2] = { "help", "dump" }; |
| 674 | 674 | |
| --- | --- | |
| 696 | 696 | return ICD_SUCCESS; |
| 697 | 697 | } |
| 698 | 698 | |
| 699 | static icd_status icd_command_dump_queue(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 699 | static icd_status icd_command_dump_queue(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 700 | 700 | { |
| 701 | 701 | icd_fieldset_iterator *iter; |
| 702 | 702 | char *curr_key; |
| --- | --- | |
| 732 | 732 | return ICD_SUCCESS; |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | static icd_status icd_command_dump_distributor(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 735 | static icd_status icd_command_dump_distributor(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 736 | 736 | { |
| 737 | 737 | CW_UNUSED(ds_p); |
| 738 | 738 | CW_UNUSED(argc); |
| --- | --- | |
| 753 | 753 | return ICD_SUCCESS; |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | static icd_status icd_command_dump_customer(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 756 | static icd_status icd_command_dump_customer(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 757 | 757 | { |
| 758 | 758 | icd_fieldset_iterator *fs_iter; |
| 759 | 759 | char *curr_key; |
| --- | --- | |
| 808 | 808 | return ICD_SUCCESS; |
| 809 | 809 | } |
| 810 | 810 | |
| 811 | static icd_status icd_command_dump_agent(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 811 | static icd_status icd_command_dump_agent(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 812 | 812 | { |
| 813 | 813 | icd_fieldset_iterator *iter; |
| 814 | 814 | char *curr_key; |
| --- | --- | |
| 863 | 863 | return ICD_SUCCESS; |
| 864 | 864 | } |
| 865 | 865 | */ |
| 866 | int icd_command_load(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 866 | int icd_command_load(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 867 | 867 | { |
| 868 | 868 | static const char *help[2] = { "help", "load" }; |
| 869 | 869 | |
| --- | --- | |
| 886 | 886 | return ICD_SUCCESS; |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | icd_status icd_command_load_app_icd(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 889 | icd_status icd_command_load_app_icd(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 890 | 890 | { |
| 891 | 891 | CW_UNUSED(argc); |
| 892 | 892 | CW_UNUSED(argv); |
| --- | --- | |
| 904 | 904 | return ICD_SUCCESS; |
| 905 | 905 | } |
| 906 | 906 | |
| 907 | icd_status icd_command_load_conferences(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 907 | icd_status icd_command_load_conferences(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 908 | 908 | { |
| 909 | 909 | CW_UNUSED(argc); |
| 910 | 910 | CW_UNUSED(argv); |
| --- | --- | |
| 922 | 922 | return ICD_SUCCESS; |
| 923 | 923 | } |
| 924 | 924 | |
| 925 | icd_status icd_command_load_agents(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 925 | icd_status icd_command_load_agents(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 926 | 926 | { |
| 927 | 927 | CW_UNUSED(argc); |
| 928 | 928 | CW_UNUSED(argv); |
| --- | --- | |
| 940 | 940 | return ICD_SUCCESS; |
| 941 | 941 | } |
| 942 | 942 | |
| 943 | icd_status icd_command_load_queues(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 943 | icd_status icd_command_load_queues(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 944 | 944 | { |
| 945 | 945 | CW_UNUSED(argc); |
| 946 | 946 | CW_UNUSED(argv); |
| --- | --- | |
| 958 | 958 | return ICD_SUCCESS; |
| 959 | 959 | } |
| 960 | 960 | |
| 961 | int icd_command_ack (struct cw_dynstr **ds_p, int argc, char **argv) | |
| 961 | int icd_command_ack (struct cw_dynstr *ds_p, int argc, char **argv) | |
| 962 | 962 | { |
| 963 | 963 | char * agent_id; |
| 964 | 964 | icd_agent *agent = NULL; |
| --- | --- | |
| 1012 | 1012 | return -1; |
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | int icd_command_hang_up (struct cw_dynstr **ds_p, int argc, char **argv) | |
| 1015 | int icd_command_hang_up (struct cw_dynstr *ds_p, int argc, char **argv) | |
| 1016 | 1016 | { |
| 1017 | 1017 | icd_caller *agent = NULL; |
| 1018 | 1018 | char *agent_id; |
| --- | --- | |
| 1129 | 1129 | return NULL; |
| 1130 | 1130 | } |
| 1131 | 1131 | |
| 1132 | int icd_command_login (struct cw_dynstr **ds_p, int argc, char **argv) | |
| 1132 | int icd_command_login (struct cw_dynstr *ds_p, int argc, char **argv) | |
| 1133 | 1133 | { |
| 1134 | 1134 | pthread_t tid; |
| 1135 | 1135 | icd_caller *agent = NULL; |
| --- | --- | |
| 1224 | 1224 | return 0; |
| 1225 | 1225 | } |
| 1226 | 1226 | |
| 1227 | int icd_command_logout (struct cw_dynstr **ds_p, int argc, char **argv) | |
| 1227 | int icd_command_logout (struct cw_dynstr *ds_p, int argc, char **argv) | |
| 1228 | 1228 | { |
| 1229 | 1229 | icd_caller *agent = NULL; |
| 1230 | 1230 | const char *agent_id; |
| --- | --- | |
| 1314 | 1314 | } |
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | int icd_command_hangup_channel (struct cw_dynstr **ds_p, int argc, char **argv) | |
| 1317 | int icd_command_hangup_channel (struct cw_dynstr *ds_p, int argc, char **argv) | |
| 1318 | 1318 | { |
| 1319 | 1319 | struct cw_channel *chan; |
| 1320 | 1320 | |
| --- | --- | |
| 1356 | 1356 | |
| 1357 | 1357 | |
| 1358 | 1358 | |
| 1359 | int icd_command_playback_channel (struct cw_dynstr **ds_p, int argc, char **argv) | |
| 1359 | int icd_command_playback_channel (struct cw_dynstr *ds_p, int argc, char **argv) | |
| 1360 | 1360 | { |
| 1361 | 1361 | icd_agent * agent; |
| 1362 | 1362 | char * agent_id; |
| --- | --- | |
| 1500 | 1500 | argv[3] = /tmp/%D/%m/ fliename is: /tmp/29/59/callweaver123123423423454.WAV |
| 1501 | 1501 | */ |
| 1502 | 1502 | |
| 1503 | int icd_command_record(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 1503 | int icd_command_record(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 1504 | 1504 | { |
| 1505 | 1505 | icd_caller * customer; |
| 1506 | 1506 | char rec_directory_buf[200]; |
| --- | --- | |
| 1666 | 1666 | 515 argv[3] = nothing or R to remove from queue, if argv[2]=all remove from all queues |
| 1667 | 1667 | 516 */ |
| 1668 | 1668 | |
| 1669 | int icd_command_join_queue (struct cw_dynstr **ds_p, int argc, char **argv) | |
| 1669 | int icd_command_join_queue (struct cw_dynstr *ds_p, int argc, char **argv) | |
| 1670 | 1670 | { |
| 1671 | 1671 | icd_caller *agent = NULL; |
| 1672 | 1672 | char *agent_id; |
| --- | --- | |
| 1780 | 1780 | } |
| 1781 | 1781 | |
| 1782 | 1782 | |
| 1783 | int icd_command_control_playback(struct cw_dynstr **ds_p, int argc, char **argv) { | |
| 1783 | int icd_command_control_playback(struct cw_dynstr *ds_p, int argc, char **argv) { | |
| 1784 | 1784 | |
| 1785 | 1785 | icd_agent * agent; |
| 1786 | 1786 | icd_caller * associated_caller; |
| --- | --- | |
| 1876 | 1876 | } |
| 1877 | 1877 | |
| 1878 | 1878 | |
| 1879 | int icd_command_transfer (struct cw_dynstr **ds_p, int argc, char **argv) | |
| 1879 | int icd_command_transfer (struct cw_dynstr *ds_p, int argc, char **argv) | |
| 1880 | 1880 | { |
| 1881 | 1881 | icd_caller *customer; |
| 1882 | 1882 | struct cw_channel *chan = NULL; |
callweaver/trunk/apps/icd/icd_distributor.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | /* Print out a copy of the distributor. */ |
| 419 | icd_status icd_distributor__dump(icd_distributor *that, int verbosity, struct cw_dynstr **ds_p) { | |
| 419 | icd_status icd_distributor__dump(icd_distributor *that, int verbosity, struct cw_dynstr *ds_p) { | |
| 420 | 420 | assert(that != NULL); |
| 421 | 421 | assert(that->dump_fn != NULL); |
| 422 | 422 | |
| --- | --- | |
| 566 | 566 | return ICD_SUCCESS; |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | icd_status icd_distributor__set_dump_func(icd_distributor *that, icd_status (*dump_fn)(icd_distributor *, int verbosity, struct cw_dynstr **ds_p, void *extra), void *extra) { | |
| 569 | icd_status icd_distributor__set_dump_func(icd_distributor *that, icd_status (*dump_fn)(icd_distributor *, int verbosity, struct cw_dynstr *ds_p, void *extra), void *extra) { | |
| 570 | 570 | assert(that != NULL); |
| 571 | 571 | |
| 572 | 572 | that->dump_fn = dump_fn; |
| --- | --- | |
| 901 | 901 | } |
| 902 | 902 | |
| 903 | 903 | /* Standard dump function for distributor */ |
| 904 | icd_status icd_distributor__standard_dump(icd_distributor *dist, int verbosity, struct cw_dynstr **ds_p, void *extra) { | |
| 904 | icd_status icd_distributor__standard_dump(icd_distributor *dist, int verbosity, struct cw_dynstr *ds_p, void *extra) { | |
| 905 | 905 | static const char *indent = " "; |
| 906 | 906 | vh_keylist *keys; |
| 907 | 907 | |
| --- | --- | |
| 1074 | 1074 | (icd_status (*)(icd_distributor *, void *))icd_config__get_any_value(data, "link", icd_distributor__link_callers_via_pop), |
| 1075 | 1075 | (icd_status (*)(icd_distributor *, void *))icd_config__get_any_value(data, "link.extra", NULL)); |
| 1076 | 1076 | icd_distributor__set_dump_func(that, |
| 1077 | (icd_status (*)(icd_distributor *, int, struct cw_dynstr **, void *))icd_config__get_any_value(data, "dump", icd_distributor__standard_dump), | |
| 1078 | (icd_status (*)(icd_distributor *, int, struct cw_dynstr **, void *))icd_config__get_any_value(data, "dump.extra", NULL)); | |
| 1077 | (icd_status (*)(icd_distributor *, int, struct cw_dynstr *, void *))icd_config__get_any_value(data, "dump", icd_distributor__standard_dump), | |
| 1078 | (icd_status (*)(icd_distributor *, int, struct cw_dynstr *, void *))icd_config__get_any_value(data, "dump.extra", NULL)); | |
| 1079 | 1079 | return ICD_SUCCESS; |
| 1080 | 1080 | } |
| 1081 | 1081 |
callweaver/trunk/apps/icd/icd_distributor_list.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /* Print our a copy of the list */ |
| 90 | icd_status icd_distributor_list__dump(icd_distributor_list * that, struct cw_dynstr **ds_p) | |
| 90 | icd_status icd_distributor_list__dump(icd_distributor_list * that, struct cw_dynstr *ds_p) | |
| 91 | 91 | { |
| 92 | 92 | icd_status ret = ICD_SUCCESS; |
| 93 | 93 |
callweaver/trunk/apps/icd/icd_list.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 222 | 222 | that->name = icd_config__get_strdup(data, "name", ""); |
| 223 | 223 | that->size = icd_config__get_int_value(data, "size", 50); |
| 224 | 224 | /* Set the dump function */ |
| 225 | that->dump_fn = (icd_status (*)(icd_list *, int, struct cw_dynstr **, void *))icd_config__get_any_value(data, "dump", icd_list__standard_dump); | |
| 225 | that->dump_fn = (icd_status (*)(icd_list *, int, struct cw_dynstr *, void *))icd_config__get_any_value(data, "dump", icd_list__standard_dump); | |
| 226 | 226 | |
| 227 | 227 | /* Set sort order */ |
| 228 | 228 | ins_fn = (icd_list_node * (*)(icd_list * that, void *new_elem, void *extra)) |
| --- | --- | |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | /* Print out a copy of the list */ |
| 599 | icd_status icd_list__dump(icd_list * that, int verbosity, struct cw_dynstr **ds_p) | |
| 599 | icd_status icd_list__dump(icd_list * that, int verbosity, struct cw_dynstr *ds_p) | |
| 600 | 600 | { |
| 601 | 601 | assert(that != NULL); |
| 602 | 602 | assert(that->dump_fn != NULL); |
| --- | --- | |
| 733 | 733 | return ICD_SUCCESS; |
| 734 | 734 | } |
| 735 | 735 | |
| 736 | icd_status icd_list__set_dump_func(icd_list * that, icd_status(*dump_fn) (icd_list *, int verbosity, struct cw_dynstr **ds_p, | |
| 736 | icd_status icd_list__set_dump_func(icd_list * that, icd_status(*dump_fn) (icd_list *, int verbosity, struct cw_dynstr *ds_p, | |
| 737 | 737 | void *extra), void *extra) |
| 738 | 738 | { |
| 739 | 739 | assert(that != NULL); |
| --- | --- | |
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | /* Standard function for printing out a copy of the list */ |
| 1008 | icd_status icd_list__standard_dump(icd_list * list, int verbosity, struct cw_dynstr **ds_p, void *extra) | |
| 1008 | icd_status icd_list__standard_dump(icd_list * list, int verbosity, struct cw_dynstr *ds_p, void *extra) | |
| 1009 | 1009 | { |
| 1010 | 1010 | icd_list_iterator *iter; |
| 1011 | 1011 | void *element; |
callweaver/trunk/apps/icd/icd_listeners.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /* Print the contents of the listener collection. */ |
| 225 | icd_status icd_listeners__dump(icd_listeners * that, struct cw_dynstr **ds_p) | |
| 225 | icd_status icd_listeners__dump(icd_listeners * that, struct cw_dynstr *ds_p) | |
| 226 | 226 | { |
| 227 | 227 | CW_UNUSED(that); |
| 228 | 228 | CW_UNUSED(ds_p); |
callweaver/trunk/apps/icd/icd_member.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 68 | 68 | icd_fieldset *params; |
| 69 | 69 | icd_member_state state; |
| 70 | 70 | icd_plugable_fn *(*get_plugable_fn) (icd_caller * caller); |
| 71 | icd_status(*dump_fn) (icd_member * member, int verbosity, struct cw_dynstr **ds_p, void *extra); | |
| 71 | icd_status(*dump_fn) (icd_member * member, int verbosity, struct cw_dynstr *ds_p, void *extra); | |
| 72 | 72 | void *dump_fn_extra; |
| 73 | 73 | icd_listeners *listeners; |
| 74 | 74 | icd_memory *memory; |
| --- | --- | |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | /* Prints the contents of the member object to the given file descriptor. */ |
| 369 | icd_status icd_member__dump(icd_member * that, int verbosity, struct cw_dynstr **ds_p) | |
| 369 | icd_status icd_member__dump(icd_member * that, int verbosity, struct cw_dynstr *ds_p) | |
| 370 | 370 | { |
| 371 | 371 | assert(that != NULL); |
| 372 | 372 | assert(that->dump_fn != NULL); |
| --- | --- | |
| 624 | 624 | |
| 625 | 625 | /* Set the dump function for this list */ |
| 626 | 626 | icd_status icd__member__set_dump_func(icd_member * that, icd_status(*dump_fn) (icd_member * list, int verbosity, |
| 627 | struct cw_dynstr **ds_p, void *extra), void *extra) | |
| 627 | struct cw_dynstr *ds_p, void *extra), void *extra) | |
| 628 | 628 | { |
| 629 | 629 | assert(that != NULL); |
| 630 | 630 | |
| --- | --- | |
| 727 | 727 | /***** Predefined behaviours *****/ |
| 728 | 728 | |
| 729 | 729 | /* Standard member list dump function */ |
| 730 | icd_status icd_member__standard_dump(icd_member * that, int verbosity, struct cw_dynstr **ds_p, void *extra) | |
| 730 | icd_status icd_member__standard_dump(icd_member * that, int verbosity, struct cw_dynstr *ds_p, void *extra) | |
| 731 | 731 | { |
| 732 | 732 | /* TBD */ |
| 733 | 733 | CW_UNUSED(that); |
callweaver/trunk/apps/icd/icd_member_list.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | /* Prints the contents of the member structures to the given file descriptor. */ |
| 299 | icd_status icd_member_list__dump(icd_member_list * that, int verbosity, struct cw_dynstr **ds_p) | |
| 299 | icd_status icd_member_list__dump(icd_member_list * that, int verbosity, struct cw_dynstr *ds_p) | |
| 300 | 300 | { |
| 301 | 301 | assert(that != NULL); |
| 302 | 302 | assert(((icd_list *) that)->dump_fn != NULL); |
| --- | --- | |
| 379 | 379 | /**** Predefined Hooks ****/ |
| 380 | 380 | |
| 381 | 381 | /* Standard member list dump function */ |
| 382 | icd_status icd_member_list__standard_dump(icd_list * list, int verbosity, struct cw_dynstr **ds_p, void *extra) | |
| 382 | icd_status icd_member_list__standard_dump(icd_list * list, int verbosity, struct cw_dynstr *ds_p, void *extra) | |
| 383 | 383 | { |
| 384 | 384 | //static const int skipconst = 1; |
| 385 | 385 | icd_list_iterator *iter; |
callweaver/trunk/apps/icd/icd_metalist.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /* Prints the contents of the metalist to the given file descriptor. */ |
| 188 | icd_status icd_metalist__dump(icd_metalist * that, struct cw_dynstr **ds_p) | |
| 188 | icd_status icd_metalist__dump(icd_metalist * that, struct cw_dynstr *ds_p) | |
| 189 | 189 | { |
| 190 | 190 | icd_status ret = ICD_SUCCESS; |
| 191 | 191 |
callweaver/trunk/apps/icd/icd_mod_agent_priority_groups.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 65 | 65 | #include "callweaver/icd/icd_module_api.h" |
| 66 | 66 | |
| 67 | 67 | /* public apis */ |
| 68 | int icd_module_command_agtpri(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 68 | int icd_module_command_agtpri(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 69 | 69 | static icd_plugable_fn *icd_module_get_plugable_fns(icd_caller * that); |
| 70 | 70 | |
| 71 | 71 | /* Private implemenations */ |
| --- | --- | |
| 180 | 180 | return ICD_SUCCESS; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | int icd_module_command_agtpri(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 183 | int icd_module_command_agtpri(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 184 | 184 | { |
| 185 | 185 | static const char *help[2] = { "help", "agtpri" }; |
| 186 | 186 |
callweaver/trunk/apps/icd/icd_plugable_fn_list.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /* Prints the contents of the list to the given file descriptor. */ |
| 215 | icd_status icd_plugable_fn_list__dump(icd_plugable_fn_list * that, struct cw_dynstr **ds_p) | |
| 215 | icd_status icd_plugable_fn_list__dump(icd_plugable_fn_list * that, struct cw_dynstr *ds_p) | |
| 216 | 216 | { |
| 217 | 217 | icd_status ret = ICD_SUCCESS; |
| 218 | 218 |
callweaver/trunk/apps/icd/icd_queue.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 62 | 62 | icd_listeners *listeners; |
| 63 | 63 | icd_queue_state state; |
| 64 | 64 | int flag; /*accept calls, tagged iter mem q, match em from config untag mark for delete */ |
| 65 | icd_status(*dump_fn) (icd_queue *, int verbosity, struct cw_dynstr **ds_p, void *extra); | |
| 65 | icd_status(*dump_fn) (icd_queue *, int verbosity, struct cw_dynstr *ds_p, void *extra); | |
| 66 | 66 | void *dump_fn_extra; |
| 67 | 67 | icd_memory *memory; |
| 68 | 68 | cw_mutex_t lock; |
| --- | --- | |
| 239 | 239 | that->listeners = create_icd_listeners(); |
| 240 | 240 | |
| 241 | 241 | icd_queue__set_dump_func(that, |
| 242 | (icd_status (*)(icd_queue *, int, struct cw_dynstr **, void *))icd_config__get_any_value(config, "dump", icd_queue__standard_dump), | |
| 242 | (icd_status (*)(icd_queue *, int, struct cw_dynstr *, void *))icd_config__get_any_value(config, "dump", icd_queue__standard_dump), | |
| 243 | 243 | icd_config__get_any_value(config, "dump.extra", NULL)); |
| 244 | 244 | |
| 245 | 245 | that->state = ICD_QUEUE_STATE_INITIALIZED; |
| --- | --- | |
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | /* Create a machine parse able display of the queue */ |
| 642 | icd_status icd_queue__dump(icd_queue * that, int verbosity, struct cw_dynstr **ds_p) | |
| 642 | icd_status icd_queue__dump(icd_queue * that, int verbosity, struct cw_dynstr *ds_p) | |
| 643 | 643 | { |
| 644 | 644 | assert(that != NULL); |
| 645 | 645 | assert(that->dump_fn != NULL); |
| --- | --- | |
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | /* Standard dump function for distributor */ |
| 651 | icd_status icd_queue__standard_dump(icd_queue * that, int verbosity, struct cw_dynstr **ds_p, void *extra) | |
| 651 | icd_status icd_queue__standard_dump(icd_queue * that, int verbosity, struct cw_dynstr *ds_p, void *extra) | |
| 652 | 652 | { |
| 653 | 653 | static const char *indent = " "; |
| 654 | 654 | vh_keylist *keys; |
| --- | --- | |
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | /* Create a cli ui display of the queue */ |
| 692 | icd_status icd_queue__show(icd_queue * that, int verbosity, struct cw_dynstr **ds_p) | |
| 692 | icd_status icd_queue__show(icd_queue * that, int verbosity, struct cw_dynstr *ds_p) | |
| 693 | 693 | { |
| 694 | 694 | #define FMT_QUEUE_DATA "%-18s %-8d %-14d %-15d %-10d %-18d\n" |
| 695 | 695 | |
| --- | --- | |
| 928 | 928 | |
| 929 | 929 | } |
| 930 | 930 | |
| 931 | icd_status icd_queue__set_dump_func(icd_queue * that, icd_status(*dump_fn) (icd_queue *, int verbosity, struct cw_dynstr **ds_p, | |
| 931 | icd_status icd_queue__set_dump_func(icd_queue * that, icd_status(*dump_fn) (icd_queue *, int verbosity, struct cw_dynstr *ds_p, | |
| 932 | 932 | void *extra), void *extra) |
| 933 | 933 | { |
| 934 | 934 | assert(that != NULL); |
callweaver/trunk/apps/nconference/cli.c (unified diff)
| r5590 | r5625 | |
|---|---|---|
| 125 | 125 | * ***************************************************************/ |
| 126 | 126 | |
| 127 | 127 | |
| 128 | int nconference_admin_exec( struct cw_dynstr **ds_p, int argc, char *argv[] ); | |
| 129 | static void nconference_admin_complete(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len); | |
| 128 | int nconference_admin_exec( struct cw_dynstr *ds_p, int argc, char *argv[] ); | |
| 129 | static void nconference_admin_complete(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len); | |
| 130 | 130 | |
| 131 | 131 | static const char nconference_admin_usage[] = |
| 132 | 132 | "usage: NConference <command> <conference_name> <usernumber>\n" |
| --- | --- | |
| 142 | 142 | .generator = nconference_admin_complete, |
| 143 | 143 | } ; |
| 144 | 144 | |
| 145 | int nconference_admin_exec( struct cw_dynstr **ds_p, int argc, char *argv[] ) | |
| 145 | int nconference_admin_exec( struct cw_dynstr *ds_p, int argc, char *argv[] ) | |
| 146 | 146 | { |
| 147 | 147 | struct cw_conference *conf = NULL; |
| 148 | 148 | struct cw_conf_member *member = NULL; |
| --- | --- | |
| 284 | 284 | |
| 285 | 285 | |
| 286 | 286 | |
| 287 | static void nconference_admin_complete(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) { | |
| 287 | static void nconference_admin_complete(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) { | |
| 288 | 288 | static const char *cmds[] = {"lock", "unlock", "mute", "unmute", "kick", "list", "show"}; |
| 289 | 289 | int x = 0; |
| 290 | 290 | struct cw_conference *cnf = NULL; |
callweaver/trunk/cdr/cdr_csv.c (unified diff)
| r5622 | r5625 | |
|---|---|---|
| 67 | 67 | static int csvacct_offset; |
| 68 | 68 | |
| 69 | 69 | |
| 70 | static void append_string(struct cw_dynstr **ds_p, const char *s) | |
| 70 | static void append_string(struct cw_dynstr *ds_p, const char *s) | |
| 71 | 71 | { |
| 72 | 72 | cw_dynstr_printf(ds_p, "\""); |
| 73 | 73 | |
| --- | --- | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | |
| 87 | static void append_times(struct cw_dynstr **ds_p, const struct cw_cdr *cdr) | |
| 87 | static void append_times(struct cw_dynstr *ds_p, const struct cw_cdr *cdr) | |
| 88 | 88 | { |
| 89 | 89 | cw_dynstr_printf(ds_p, "%d,%d,", cdr->duration, cdr->billsec); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
| 93 | static void append_date(struct cw_dynstr **ds_p, const struct timeval tv) | |
| 93 | static void append_date(struct cw_dynstr *ds_p, const struct timeval tv) | |
| 94 | 94 | { |
| 95 | 95 | struct tm tm; |
| 96 | 96 | |
| 97 | 97 | if (!cw_tvzero(tv)) { |
| 98 | 98 | cw_dynstr_need(ds_p, MAX_DATE_LEN + sizeof(",") - 1); |
| 99 | 99 | localtime_r(&tv.tv_sec, &tm); |
| 100 | (*ds_p)->used += strftime((*ds_p)->data + (*ds_p)->used, (*ds_p)->size - (*ds_p)->used, DATE_FORMAT ",", &tm); | |
| 100 | ds_p->used += strftime(ds_p->data + ds_p->used, ds_p->size - ds_p->used, DATE_FORMAT ",", &tm); | |
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | |
| 105 | static void build_csv_record(struct cw_dynstr **ds_p, const struct cw_cdr *cdr) | |
| 105 | static void build_csv_record(struct cw_dynstr *ds_p, const struct cw_cdr *cdr) | |
| 106 | 106 | { |
| 107 | 107 | append_string(ds_p, cdr->accountcode); |
| 108 | 108 | append_string(ds_p, cdr->src); |
| --- | --- | |
| 127 | 127 | #endif |
| 128 | 128 | |
| 129 | 129 | /* Replace trailing comma with a newline */ |
| 130 | if ((*ds_p) && !(*ds_p)->error) | |
| 131 | (*ds_p)->data[(*ds_p)->used - 1] = '\n'; | |
| 130 | if (!ds_p->error) | |
| 131 | ds_p->data[ds_p->used - 1] = '\n'; | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
| --- | --- | |
| 162 | 162 | static int csv_log(struct cw_cdr *batch) |
| 163 | 163 | { |
| 164 | 164 | struct cw_cdr *cdrset, *cdr; |
| 165 | struct cw_dynstr *ds = NULL; | |
| 165 | struct cw_dynstr ds = CW_DYNSTR_INIT; | |
| 166 | 166 | |
| 167 | 167 | pthread_mutex_lock(&csv_lock); |
| 168 | 168 | |
| --- | --- | |
| 173 | 173 | while ((cdr = cdrset)) { |
| 174 | 174 | build_csv_record(&ds, cdr); |
| 175 | 175 | |
| 176 | if (ds && !ds->error) { | |
| 176 | if (!ds.error) { | |
| 177 | 177 | cdrset = cdrset->next; |
| 178 | 178 | |
| 179 | fwrite(ds->data, 1, ds->used, csvmaster_fd); | |
| 179 | fwrite(ds.data, 1, ds.used, csvmaster_fd); | |
| 180 | 180 | |
| 181 | 181 | if (!cw_strlen_zero(cdr->accountcode)) { |
| 182 | 182 | static char badacct = 0; |
| --- | --- | |
| 187 | 187 | if (!strchr(cdr->accountcode, '/') && (cdr->accountcode[0] != '.' || cdr->accountcode[1] != '.')) { |
| 188 | 188 | if (snprintf(csvacct_path + csvacct_offset, sizeof(csvacct_path) - csvacct_offset, "%s.csv", cdr->accountcode) < sizeof(csvacct_path) - csvacct_offset) { |
| 189 | 189 | if (!(err = ((d = open_cloexec(csvacct_path, O_WRONLY|O_APPEND|O_CREAT, 0666)) < 0))) { |
| 190 | err = (write(d, ds->data, ds->used) != ds->used); | |
| 190 | err = (write(d, ds.data, ds.used) != ds.used); | |
| 191 | 191 | err |= fsync(d); |
| 192 | 192 | err |= close(d); |
| 193 | 193 | } |
| --- | --- | |
| 207 | 207 | |
| 208 | 208 | cw_dynstr_reset(&ds); |
| 209 | 209 | } else { |
| 210 | if (ds) | |
| 211 | cw_dynstr_free(&ds); | |
| 210 | cw_dynstr_free(&ds); | |
| 212 | 211 | cw_log(CW_LOG_ERROR, "Out of memory!\n"); |
| 213 | 212 | sleep(1); |
| 214 | 213 | } |
| --- | --- | |
| 221 | 220 | |
| 222 | 221 | pthread_mutex_unlock(&csv_lock); |
| 223 | 222 | |
| 224 | if (ds) | |
| 225 | cw_dynstr_free(&ds); | |
| 223 | cw_dynstr_free(&ds); | |
| 226 | 224 | |
| 227 | 225 | return 0; |
| 228 | 226 | } |
callweaver/trunk/cdr/cdr_mysql.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 69 | 69 | "Usage: cdr mysql status\n" |
| 70 | 70 | " Shows current connection status for cdr_mysql\n"; |
| 71 | 71 | |
| 72 | static int handle_cdr_mysql_status(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 72 | static int handle_cdr_mysql_status(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 73 | 73 | { |
| 74 | 74 | CW_UNUSED(argc); |
| 75 | 75 | CW_UNUSED(argv); |
callweaver/trunk/channels/capi/chan_capi.c (unified diff)
| r5587 | r5625 | |
|---|---|---|
| 5062 | 5062 | /* |
| 5063 | 5063 | * do command capi show channels |
| 5064 | 5064 | */ |
| 5065 | static int pbxcli_capi_show_channels(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 5065 | static int pbxcli_capi_show_channels(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 5066 | 5066 | { |
| 5067 | 5067 | struct capi_pvt *i; |
| 5068 | 5068 | char iochar; |
| --- | --- | |
| 5118 | 5118 | /* |
| 5119 | 5119 | * do command capi info |
| 5120 | 5120 | */ |
| 5121 | static int pbxcli_capi_info(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 5121 | static int pbxcli_capi_info(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 5122 | 5122 | { |
| 5123 | 5123 | int i = 0; |
| 5124 | 5124 | |
| --- | --- | |
| 5138 | 5138 | /* |
| 5139 | 5139 | * enable debugging |
| 5140 | 5140 | */ |
| 5141 | static int pbxcli_capi_do_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 5141 | static int pbxcli_capi_do_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 5142 | 5142 | { |
| 5143 | 5143 | if (argc != 2) |
| 5144 | 5144 | return RESULT_SHOWUSAGE; |
| --- | --- | |
| 5152 | 5152 | /* |
| 5153 | 5153 | * disable debugging |
| 5154 | 5154 | */ |
| 5155 | static int pbxcli_capi_no_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 5155 | static int pbxcli_capi_no_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 5156 | 5156 | { |
| 5157 | 5157 | if (argc != 3) |
| 5158 | 5158 | return RESULT_SHOWUSAGE; |
callweaver/trunk/channels/chan_agent.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 1508 | 1508 | return ret; |
| 1509 | 1509 | } |
| 1510 | 1510 | |
| 1511 | static int agent_logoff_cmd(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 1511 | static int agent_logoff_cmd(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 1512 | 1512 | { |
| 1513 | 1513 | int ret; |
| 1514 | 1514 | char *agent; |
| --- | --- | |
| 1553 | 1553 | return msg; |
| 1554 | 1554 | } |
| 1555 | 1555 | |
| 1556 | static void complete_agent_logoff_cmd(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 1556 | static void complete_agent_logoff_cmd(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 1557 | 1557 | { |
| 1558 | 1558 | char name[CW_MAX_AGENT]; |
| 1559 | 1559 | struct agent_pvt *p; |
| --- | --- | |
| 1571 | 1571 | /** |
| 1572 | 1572 | * Show agents in cli. |
| 1573 | 1573 | */ |
| 1574 | static int agents_show(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 1574 | static int agents_show(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 1575 | 1575 | { |
| 1576 | 1576 | char username[CW_MAX_BUF]; |
| 1577 | 1577 | char location[CW_MAX_BUF] = ""; |
callweaver/trunk/channels/chan_alsa.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 2892 | 2892 | return tmp; |
| 2893 | 2893 | } |
| 2894 | 2894 | |
| 2895 | static int console_autoanswer(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2895 | static int console_autoanswer(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2896 | 2896 | { |
| 2897 | 2897 | int res = RESULT_SUCCESS;; |
| 2898 | 2898 | if ((argc != 1) && (argc != 2)) |
| --- | --- | |
| 2912 | 2912 | return res; |
| 2913 | 2913 | } |
| 2914 | 2914 | |
| 2915 | static void autoanswer_complete(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 2915 | static void autoanswer_complete(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 2916 | 2916 | { |
| 2917 | 2917 | if (!strncasecmp(argv[lastarg], "on", lastarg_len)) |
| 2918 | 2918 | cw_dynstr_printf(ds_p, "on\n"); |
| --- | --- | |
| 2927 | 2927 | " argument, displays the current on/off status of autoanswer.\n" |
| 2928 | 2928 | " The default value of autoanswer is in 'alsa.conf'.\n"; |
| 2929 | 2929 | |
| 2930 | static int console_answer(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2930 | static int console_answer(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2931 | 2931 | { |
| 2932 | 2932 | CW_UNUSED(argv); |
| 2933 | 2933 | |
| --- | --- | |
| 2958 | 2958 | "Usage: send text <message>\n" |
| 2959 | 2959 | " Sends a text message for display on the remote terminal.\n"; |
| 2960 | 2960 | |
| 2961 | static int console_sendtext(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2961 | static int console_sendtext(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2962 | 2962 | { |
| 2963 | 2963 | int tmparg = 2; |
| 2964 | 2964 | int res = RESULT_SUCCESS; |
| --- | --- | |
| 2999 | 2999 | "Usage: answer\n" |
| 3000 | 3000 | " Answers an incoming call on the console (ALSA) channel.\n"; |
| 3001 | 3001 | |
| 3002 | static int console_hangup(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3002 | static int console_hangup(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3003 | 3003 | { |
| 3004 | 3004 | int res = RESULT_SUCCESS; |
| 3005 | 3005 | |
| --- | --- | |
| 3030 | 3030 | " Hangs up any call currently placed on the console.\n"; |
| 3031 | 3031 | |
| 3032 | 3032 | |
| 3033 | static int console_dial(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3033 | static int console_dial(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3034 | 3034 | { |
| 3035 | 3035 | char tmp[256], *tmp2; |
| 3036 | 3036 | char *mye, *myc; |
callweaver/trunk/channels/chan_bluetooth.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 2566 | 2566 | |
| 2567 | 2567 | |
| 2568 | 2568 | static int |
| 2569 | blt_show_peers(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2569 | blt_show_peers(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2570 | 2570 | { |
| 2571 | 2571 | blt_dev_t * dev; |
| 2572 | 2572 | |
| --- | --- | |
| 2605 | 2605 | } |
| 2606 | 2606 | |
| 2607 | 2607 | static int |
| 2608 | blt_show_information(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2608 | blt_show_information(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2609 | 2609 | { |
| 2610 | 2610 | char b1[18]; |
| 2611 | 2611 | |
| --- | --- | |
| 2624 | 2624 | } |
| 2625 | 2625 | |
| 2626 | 2626 | static int |
| 2627 | blt_ag_sendcmd(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2627 | blt_ag_sendcmd(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2628 | 2628 | { |
| 2629 | 2629 | blt_dev_t * dev; |
| 2630 | 2630 | |
| --- | --- | |
| 2668 | 2668 | } |
| 2669 | 2669 | |
| 2670 | 2670 | static void |
| 2671 | complete_device(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len, int rpos, blt_role_t role) | |
| 2671 | complete_device(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len, int rpos, blt_role_t role) | |
| 2672 | 2672 | { |
| 2673 | 2673 | blt_dev_t * dev; |
| 2674 | 2674 | |
| --- | --- | |
| 2686 | 2686 | } |
| 2687 | 2687 | |
| 2688 | 2688 | static void |
| 2689 | complete_device_2_ag(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 2689 | complete_device_2_ag(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 2690 | 2690 | { |
| 2691 | 2691 | complete_device(ds_p, argv, lastarg, lastarg_len, 2, BLT_ROLE_AG); |
| 2692 | 2692 | } |
callweaver/trunk/channels/chan_bluetooth.h (unified diff)
| r5562 | r5625 | |
|---|---|---|
| 238 | 238 | static int blt_write(struct cw_channel *chan, struct cw_frame *f); |
| 239 | 239 | static int blt_indicate(struct cw_channel *chan, int cond); |
| 240 | 240 | |
| 241 | static int blt_show_information(struct cw_dynstr **, int, char**); | |
| 242 | static int blt_show_peers(struct cw_dynstr **, int, char **); | |
| 243 | static int blt_ag_sendcmd(struct cw_dynstr **, int, char **); | |
| 241 | static int blt_show_information(struct cw_dynstr *, int, char**); | |
| 242 | static int blt_show_peers(struct cw_dynstr *, int, char **); | |
| 243 | static int blt_ag_sendcmd(struct cw_dynstr *, int, char **); | |
| 244 | 244 | |
| 245 | 245 | static int atcmd_cclk_read(blt_dev_t *); |
| 246 | 246 | static int atcmd_cind_read(blt_dev_t *); |
| --- | --- | |
| 270 | 270 | static int ag_unsol_clip(blt_dev_t *, const char *); |
| 271 | 271 | |
| 272 | 272 | static int blt_parse_config(void); |
| 273 | static void complete_device_2_ag(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len); | |
| 273 | static void complete_device_2_ag(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len); | |
| 274 | 274 | |
| 275 | 275 | /*! Bluetooth: channel tech callback information */ |
| 276 | 276 | static const struct cw_channel_tech blt_tech = { |
callweaver/trunk/channels/chan_local.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | /*--- locals_show: CLI command "local show channels" */ |
| 591 | static int locals_show(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 591 | static int locals_show(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 592 | 592 | { |
| 593 | 593 | struct local_pvt *p; |
| 594 | 594 |
callweaver/trunk/channels/chan_mgcp.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 483 | 483 | int result, unsigned int ident, struct mgcp_request *resp); |
| 484 | 484 | static void dump_cmd_queues(struct mgcp_endpoint *p, struct mgcp_subchannel *sub); |
| 485 | 485 | static int mgcp_do_reload(void); |
| 486 | static int mgcp_reload(struct cw_dynstr **ds_p, int argc, char *argv[]); | |
| 486 | static int mgcp_reload(struct cw_dynstr *ds_p, int argc, char *argv[]); | |
| 487 | 487 | |
| 488 | 488 | static struct cw_channel *mgcp_request(const char *type, int format, void *data, int *cause); |
| 489 | 489 | static int mgcp_call(struct cw_channel *ast, const char *dest); |
| --- | --- | |
| 1080 | 1080 | return 0; |
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | static int mgcp_show_endpoints(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1083 | static int mgcp_show_endpoints(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1084 | 1084 | { |
| 1085 | 1085 | char iabuf[INET_ADDRSTRLEN]; |
| 1086 | 1086 | struct mgcp_gateway *g; |
| --- | --- | |
| 1124 | 1124 | .usage = show_endpoints_usage, |
| 1125 | 1125 | }; |
| 1126 | 1126 | |
| 1127 | static int mgcp_audit_endpoint(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1127 | static int mgcp_audit_endpoint(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1128 | 1128 | { |
| 1129 | 1129 | struct mgcp_gateway *g; |
| 1130 | 1130 | struct mgcp_endpoint *e; |
| --- | --- | |
| 3987 | 3987 | .set_rtp_peer = mgcp_set_rtp_peer, |
| 3988 | 3988 | }; |
| 3989 | 3989 | |
| 3990 | static int mgcp_do_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3990 | static int mgcp_do_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3991 | 3991 | { |
| 3992 | 3992 | CW_UNUSED(argv); |
| 3993 | 3993 | |
| --- | --- | |
| 3998 | 3998 | return RESULT_SUCCESS; |
| 3999 | 3999 | } |
| 4000 | 4000 | |
| 4001 | static int mgcp_no_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 4001 | static int mgcp_no_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 4002 | 4002 | { |
| 4003 | 4003 | CW_UNUSED(argv); |
| 4004 | 4004 | |
| --- | --- | |
| 4348 | 4348 | return 0; |
| 4349 | 4349 | } |
| 4350 | 4350 | |
| 4351 | static int mgcp_reload(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 4351 | static int mgcp_reload(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 4352 | 4352 | { |
| 4353 | 4353 | CW_UNUSED(ds_p); |
| 4354 | 4354 | CW_UNUSED(argc); |
callweaver/trunk/channels/chan_sip.c (unified diff)
| r5598 | r5625 | |
|---|---|---|
| 10110 | 10110 | #define FORMAT3 "%-25.25s %15d %-15.15s \n" |
| 10111 | 10111 | |
| 10112 | 10112 | struct sip_show_inuse_args { |
| 10113 | struct cw_dynstr **ds_p; | |
| 10113 | struct cw_dynstr *ds_p; | |
| 10114 | 10114 | int showall; |
| 10115 | 10115 | }; |
| 10116 | 10116 | |
| --- | --- | |
| 10142 | 10142 | |
| 10143 | 10143 | /*! \brief sip_show_inuse: CLI Command to show calls within limits set by |
| 10144 | 10144 | call_limit */ |
| 10145 | static int sip_show_inuse(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 10145 | static int sip_show_inuse(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 10146 | 10146 | { |
| 10147 | 10147 | struct sip_show_inuse_args args = { |
| 10148 | 10148 | .ds_p = ds_p, |
| --- | --- | |
| 10206 | 10206 | |
| 10207 | 10207 | |
| 10208 | 10208 | struct sip_show_users_args { |
| 10209 | struct cw_dynstr **ds_p; | |
| 10209 | struct cw_dynstr *ds_p; | |
| 10210 | 10210 | int havepattern; |
| 10211 | 10211 | regex_t regexbuf; |
| 10212 | 10212 | }; |
| --- | --- | |
| 10230 | 10230 | } |
| 10231 | 10231 | |
| 10232 | 10232 | /*! \brief sip_show_users: CLI Command 'SIP Show Users' */ |
| 10233 | static int sip_show_users(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 10233 | static int sip_show_users(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 10234 | 10234 | { |
| 10235 | 10235 | struct sip_show_users_args args = { |
| 10236 | 10236 | .ds_p = ds_p, |
| --- | --- | |
| 10273 | 10273 | #define FORMAT2 "%-25.25s %-15.15s %-3.3s %-3.3s %-3.3s %-8s %-12s %-7s\n" |
| 10274 | 10274 | |
| 10275 | 10275 | struct sip_show_peers_args { |
| 10276 | struct cw_dynstr **ds_p; | |
| 10276 | struct cw_dynstr *ds_p; | |
| 10277 | 10277 | regex_t regexbuf; |
| 10278 | 10278 | int havepattern; |
| 10279 | 10279 | int total_peers; |
| --- | --- | |
| 10312 | 10312 | } |
| 10313 | 10313 | |
| 10314 | 10314 | /*! \brief sip_show_peers: Execute sip show peers command */ |
| 10315 | static int sip_show_peers(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 10315 | static int sip_show_peers(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 10316 | 10316 | { |
| 10317 | 10317 | struct sip_show_peers_args args = { |
| 10318 | 10318 | .ds_p = ds_p, |
| --- | --- | |
| 10479 | 10479 | } |
| 10480 | 10480 | |
| 10481 | 10481 | /*! \brief sip_prune_realtime: Remove temporary realtime objects from memory (CLI) */ |
| 10482 | static int sip_prune_realtime(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 10482 | static int sip_prune_realtime(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 10483 | 10483 | { |
| 10484 | 10484 | struct sip_prune_realtime_args args = { |
| 10485 | 10485 | .name = NULL, |
| --- | --- | |
| 10596 | 10596 | } |
| 10597 | 10597 | |
| 10598 | 10598 | /*! \brief print_codec_to_cli: Print codec list from preference to CLI/manager */ |
| 10599 | static void print_codec_to_cli(struct cw_dynstr **ds_p, struct cw_codec_pref *pref) | |
| 10599 | static void print_codec_to_cli(struct cw_dynstr *ds_p, struct cw_codec_pref *pref) | |
| 10600 | 10600 | { |
| 10601 | 10601 | int x, codec; |
| 10602 | 10602 | |
| --- | --- | |
| 10628 | 10628 | |
| 10629 | 10629 | /*! \brief sip_show_domains: CLI command to list local domains */ |
| 10630 | 10630 | #define FORMAT "%-40.40s %-20.20s %-16.16s\n" |
| 10631 | static int sip_show_domains(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 10631 | static int sip_show_domains(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 10632 | 10632 | { |
| 10633 | 10633 | struct domain *d; |
| 10634 | 10634 | |
| --- | --- | |
| 10660 | 10660 | "Variables: \n" |
| 10661 | 10661 | " Peer: <name> The peer name you want to check.\n"; |
| 10662 | 10662 | |
| 10663 | static int sip_show_peer(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 10663 | static int sip_show_peer(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 10664 | 10664 | { |
| 10665 | 10665 | char callgroup[256], pickupgroup[256]; |
| 10666 | 10666 | char cbuf[256]; |
| --- | --- | |
| 10868 | 10868 | |
| 10869 | 10869 | |
| 10870 | 10870 | /*! \brief sip_show_user: Show one user in detail */ |
| 10871 | static int sip_show_user(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 10871 | static int sip_show_user(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 10872 | 10872 | { |
| 10873 | 10873 | char callgroup[256], pickupgroup[256]; |
| 10874 | 10874 | char cbuf[256]; |
| --- | --- | |
| 10937 | 10937 | } |
| 10938 | 10938 | |
| 10939 | 10939 | /*! \brief sip_show_registry: Show SIP Registry (registrations with other SIP proxies */ |
| 10940 | static int sip_show_registry(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 10940 | static int sip_show_registry(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 10941 | 10941 | { |
| 10942 | 10942 | #define FORMAT2 "%-30.30s %-12.12s %8.8s %-20.20s\n" |
| 10943 | 10943 | #define FORMAT "%-30.30s %-12.12s %8d %-20.20s\n" |
| --- | --- | |
| 10966 | 10966 | } |
| 10967 | 10967 | |
| 10968 | 10968 | /*! \brief sip_show_settings: List global settings for the SIP channel */ |
| 10969 | static int sip_show_settings(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 10969 | static int sip_show_settings(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 10970 | 10970 | { |
| 10971 | 10971 | char tmp[BUFSIZ]; |
| 10972 | 10972 | int realtimepeers = 0; |
| --- | --- | |
| 11091 | 11091 | } |
| 11092 | 11092 | |
| 11093 | 11093 | /* Forward declaration */ |
| 11094 | static int __sip_show_channels(struct cw_dynstr **ds_p, int argc, char *argv[], int subscriptions); | |
| 11094 | static int __sip_show_channels(struct cw_dynstr *ds_p, int argc, char *argv[], int subscriptions); | |
| 11095 | 11095 | |
| 11096 | 11096 | /*! \brief sip_show_channels: Show active SIP channels */ |
| 11097 | static int sip_show_channels(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 11097 | static int sip_show_channels(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 11098 | 11098 | { |
| 11099 | 11099 | return __sip_show_channels(ds_p, argc, argv, 0); |
| 11100 | 11100 | } |
| 11101 | 11101 | |
| 11102 | 11102 | /*! \brief sip_show_subscriptions: Show active SIP subscriptions */ |
| 11103 | static int sip_show_subscriptions(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 11103 | static int sip_show_subscriptions(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 11104 | 11104 | { |
| 11105 | 11105 | return __sip_show_channels(ds_p, argc, argv, 1); |
| 11106 | 11106 | } |
| --- | --- | |
| 11108 | 11108 | |
| 11109 | 11109 | struct __sip_show_channels_args { |
| 11110 | 11110 | int subscriptions; |
| 11111 | struct cw_dynstr **ds_p; | |
| 11111 | struct cw_dynstr *ds_p; | |
| 11112 | 11112 | int numchans; |
| 11113 | 11113 | }; |
| 11114 | 11114 | |
| --- | --- | |
| 11153 | 11153 | return 0; |
| 11154 | 11154 | } |
| 11155 | 11155 | |
| 11156 | static int __sip_show_channels(struct cw_dynstr **ds_p, int argc, char *argv[], int subscriptions) | |
| 11156 | static int __sip_show_channels(struct cw_dynstr *ds_p, int argc, char *argv[], int subscriptions) | |
| 11157 | 11157 | { |
| 11158 | 11158 | struct __sip_show_channels_args args = { |
| 11159 | 11159 | .subscriptions = subscriptions, |
| --- | --- | |
| 11186 | 11186 | |
| 11187 | 11187 | |
| 11188 | 11188 | struct complete_sipch_args { |
| 11189 | struct cw_dynstr **ds_p; | |
| 11189 | struct cw_dynstr *ds_p; | |
| 11190 | 11190 | const char *prefix; |
| 11191 | 11191 | int prefix_len; |
| 11192 | 11192 | }; |
| --- | --- | |
| 11203 | 11203 | } |
| 11204 | 11204 | |
| 11205 | 11205 | /*! \brief complete_sipch: Support routine for 'sip show channel' CLI */ |
| 11206 | static void complete_sipch(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 11206 | static void complete_sipch(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 11207 | 11207 | { |
| 11208 | 11208 | struct complete_sipch_args args = { |
| 11209 | 11209 | .ds_p = ds_p, |
| --- | --- | |
| 11216 | 11216 | |
| 11217 | 11217 | |
| 11218 | 11218 | struct complete_sip_peer_args { |
| 11219 | struct cw_dynstr **ds_p; | |
| 11219 | struct cw_dynstr *ds_p; | |
| 11220 | 11220 | char *word; |
| 11221 | 11221 | int word_len; |
| 11222 | 11222 | int flags2; |
| --- | --- | |
| 11236 | 11236 | } |
| 11237 | 11237 | |
| 11238 | 11238 | /*! \brief complete_sip_peer: Do completion on peer name */ |
| 11239 | static void complete_sip_peer(struct cw_dynstr **ds_p, char *word, int word_len, int flags2) | |
| 11239 | static void complete_sip_peer(struct cw_dynstr *ds_p, char *word, int word_len, int flags2) | |
| 11240 | 11240 | { |
| 11241 | 11241 | struct complete_sip_peer_args args = { |
| 11242 | 11242 | .ds_p = ds_p, |
| --- | --- | |
| 11249 | 11249 | } |
| 11250 | 11250 | |
| 11251 | 11251 | /*! \brief complete_sip_show_peer: Support routine for 'sip show peer' CLI */ |
| 11252 | static void complete_sip_show_peer(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 11252 | static void complete_sip_show_peer(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 11253 | 11253 | { |
| 11254 | 11254 | if (lastarg == 3) |
| 11255 | 11255 | complete_sip_peer(ds_p, argv[3], lastarg_len, 0); |
| --- | --- | |
| 11257 | 11257 | |
| 11258 | 11258 | |
| 11259 | 11259 | /*! \brief complete_sip_debug_peer: Support routine for 'sip debug peer' CLI */ |
| 11260 | static void complete_sip_debug_peer(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 11260 | static void complete_sip_debug_peer(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 11261 | 11261 | { |
| 11262 | 11262 | if (lastarg == 3) |
| 11263 | 11263 | complete_sip_peer(ds_p, argv[3], lastarg_len, 0); |
| --- | --- | |
| 11265 | 11265 | |
| 11266 | 11266 | |
| 11267 | 11267 | struct complete_sip_user_args { |
| 11268 | struct cw_dynstr **ds_p; | |
| 11268 | struct cw_dynstr *ds_p; | |
| 11269 | 11269 | char *word; |
| 11270 | 11270 | int word_len; |
| 11271 | 11271 | int flags2; |
| --- | --- | |
| 11285 | 11285 | } |
| 11286 | 11286 | |
| 11287 | 11287 | /*! \brief complete_sip_user: Do completion on user name */ |
| 11288 | static void complete_sip_user(struct cw_dynstr **ds_p, char *word, int word_len, int flags2) | |
| 11288 | static void complete_sip_user(struct cw_dynstr *ds_p, char *word, int word_len, int flags2) | |
| 11289 | 11289 | { |
| 11290 | 11290 | struct complete_sip_user_args args = { |
| 11291 | 11291 | .ds_p = ds_p, |
| --- | --- | |
| 11299 | 11299 | |
| 11300 | 11300 | |
| 11301 | 11301 | /*! \brief complete_sip_show_user: Support routine for 'sip show user' CLI */ |
| 11302 | static void complete_sip_show_user(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 11302 | static void complete_sip_show_user(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 11303 | 11303 | { |
| 11304 | 11304 | if (lastarg == 3) |
| 11305 | 11305 | complete_sip_user(ds_p, argv[3], lastarg_len, 0); |
| --- | --- | |
| 11307 | 11307 | |
| 11308 | 11308 | |
| 11309 | 11309 | /*! \brief complete_sipnotify: Support routine for 'sip notify' CLI */ |
| 11310 | static void complete_sipnotify(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 11310 | static void complete_sipnotify(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 11311 | 11311 | { |
| 11312 | 11312 | if (lastarg == 2) |
| 11313 | 11313 | { |
| --- | --- | |
| 11329 | 11329 | } |
| 11330 | 11330 | |
| 11331 | 11331 | /*! \brief complete_sip_prune_realtime_peer: Support routine for 'sip prune realtime peer' CLI */ |
| 11332 | static void complete_sip_prune_realtime_peer(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 11332 | static void complete_sip_prune_realtime_peer(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 11333 | 11333 | { |
| 11334 | 11334 | if (lastarg == 4) |
| 11335 | 11335 | complete_sip_peer(ds_p, argv[4], lastarg_len, SIP_PAGE2_RTCACHEFRIENDS); |
| 11336 | 11336 | } |
| 11337 | 11337 | |
| 11338 | 11338 | /*! \brief complete_sip_prune_realtime_user: Support routine for 'sip prune realtime user' CLI */ |
| 11339 | static void complete_sip_prune_realtime_user(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 11339 | static void complete_sip_prune_realtime_user(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 11340 | 11340 | { |
| 11341 | 11341 | if (lastarg == 4) |
| 11342 | 11342 | complete_sip_user(ds_p, argv[4], lastarg_len, SIP_PAGE2_RTCACHEFRIENDS); |
| --- | --- | |
| 11344 | 11344 | |
| 11345 | 11345 | |
| 11346 | 11346 | struct sip_show_channel_args { |
| 11347 | struct cw_dynstr **ds_p; | |
| 11347 | struct cw_dynstr *ds_p; | |
| 11348 | 11348 | int found; |
| 11349 | 11349 | const char *prefix; |
| 11350 | 11350 | size_t prefix_len; |
| --- | --- | |
| 11420 | 11420 | } |
| 11421 | 11421 | |
| 11422 | 11422 | /*! \brief sip_show_channel: Show details of one call */ |
| 11423 | static int sip_show_channel(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 11423 | static int sip_show_channel(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 11424 | 11424 | { |
| 11425 | 11425 | struct sip_show_channel_args args = { |
| 11426 | 11426 | .ds_p = ds_p, |
| --- | --- | |
| 11443 | 11443 | |
| 11444 | 11444 | |
| 11445 | 11445 | struct sip_show_history_args { |
| 11446 | struct cw_dynstr **ds_p; | |
| 11446 | struct cw_dynstr *ds_p; | |
| 11447 | 11447 | int found; |
| 11448 | 11448 | const char *prefix; |
| 11449 | 11449 | size_t prefix_len; |
| --- | --- | |
| 11474 | 11474 | } |
| 11475 | 11475 | |
| 11476 | 11476 | /*! \brief sip_show_history: Show history details of one call */ |
| 11477 | static int sip_show_history(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 11477 | static int sip_show_history(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 11478 | 11478 | { |
| 11479 | 11479 | struct sip_show_history_args args = { |
| 11480 | 11480 | .ds_p = ds_p, |
| --- | --- | |
| 11642 | 11642 | } |
| 11643 | 11643 | |
| 11644 | 11644 | /*! \brief sip_do_debug: Enable SIP Debugging in CLI */ |
| 11645 | static int sip_do_debug_ip(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 11645 | static int sip_do_debug_ip(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 11646 | 11646 | { |
| 11647 | 11647 | struct hostent *hp; |
| 11648 | 11648 | struct cw_hostent ahp; |
| --- | --- | |
| 11674 | 11674 | } |
| 11675 | 11675 | |
| 11676 | 11676 | /*! \brief sip_do_debug_peer: Turn on SIP debugging with peer mask */ |
| 11677 | static int sip_do_debug_peer(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 11677 | static int sip_do_debug_peer(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 11678 | 11678 | { |
| 11679 | 11679 | struct sip_peer *peer; |
| 11680 | 11680 | char iabuf[INET_ADDRSTRLEN]; |
| --- | --- | |
| 11701 | 11701 | } |
| 11702 | 11702 | |
| 11703 | 11703 | /*! \brief sip_do_debug: Turn on SIP debugging (CLI command) */ |
| 11704 | static int sip_do_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 11704 | static int sip_do_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 11705 | 11705 | { |
| 11706 | 11706 | int oldsipdebug = sipdebug & SIP_DEBUG_CONSOLE; |
| 11707 | 11707 | if (argc != 2) |
| --- | --- | |
| 11724 | 11724 | } |
| 11725 | 11725 | |
| 11726 | 11726 | /*! \brief sip_notify: Send SIP notify to peer */ |
| 11727 | static int sip_notify(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 11727 | static int sip_notify(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 11728 | 11728 | { |
| 11729 | 11729 | struct cw_variable *varlist; |
| 11730 | 11730 | int i; |
| --- | --- | |
| 11790 | 11790 | return RESULT_SUCCESS; |
| 11791 | 11791 | } |
| 11792 | 11792 | /*! \brief sip_do_history: Enable SIP History logging (CLI) */ |
| 11793 | static int sip_do_history(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 11793 | static int sip_do_history(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 11794 | 11794 | { |
| 11795 | 11795 | CW_UNUSED(argv); |
| 11796 | 11796 | |
| --- | --- | |
| 11803 | 11803 | } |
| 11804 | 11804 | |
| 11805 | 11805 | /*! \brief sip_no_history: Disable SIP History logging (CLI) */ |
| 11806 | static int sip_no_history(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 11806 | static int sip_no_history(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 11807 | 11807 | { |
| 11808 | 11808 | CW_UNUSED(argv); |
| 11809 | 11809 | |
| --- | --- | |
| 11816 | 11816 | } |
| 11817 | 11817 | |
| 11818 | 11818 | /*! \brief sip_no_debug: Disable SIP Debugging in CLI */ |
| 11819 | static int sip_no_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 11819 | static int sip_no_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 11820 | 11820 | { |
| 11821 | 11821 | CW_UNUSED(argv); |
| 11822 | 11822 | |
| --- | --- | |
| 17813 | 17813 | } |
| 17814 | 17814 | |
| 17815 | 17815 | /*! \brief sip_reload: Force reload of module from cli */ |
| 17816 | static int sip_reload(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 17816 | static int sip_reload(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 17817 | 17817 | { |
| 17818 | 17818 | CW_UNUSED(ds_p); |
| 17819 | 17819 | CW_UNUSED(argc); |
callweaver/trunk/channels/chan_unicall.c (unified diff)
| r5562 | r5625 | |
|---|---|---|
| 3885 | 3885 | return group; |
| 3886 | 3886 | } |
| 3887 | 3887 | |
| 3888 | static void complete_span(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 3888 | static void complete_span(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 3889 | 3889 | { |
| 3890 | 3890 | int span; |
| 3891 | 3891 | |
| --- | --- | |
| 3893 | 3893 | cw_dynstr_printf(ds_p, "%d\n", span); |
| 3894 | 3894 | } |
| 3895 | 3895 | |
| 3896 | static int handle_uc_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3896 | static int handle_uc_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3897 | 3897 | { |
| 3898 | 3898 | int chan; |
| 3899 | 3899 | unicall_pvt_t *tmp = NULL; |
| --- | --- | |
| 3932 | 3932 | return RESULT_SUCCESS; |
| 3933 | 3933 | } |
| 3934 | 3934 | |
| 3935 | static int handle_uc_no_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3935 | static int handle_uc_no_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3936 | 3936 | { |
| 3937 | 3937 | int chan; |
| 3938 | 3938 | unicall_pvt_t *tmp; |
| --- | --- | |
| 3995 | 3995 | .usage = uc_no_debug_help, |
| 3996 | 3996 | }; |
| 3997 | 3997 | |
| 3998 | static int unicall_destroy_channel(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 3998 | static int unicall_destroy_channel(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 3999 | 3999 | { |
| 4000 | 4000 | unicall_pvt_t *tmp; |
| 4001 | 4001 | unicall_pvt_t *prev; |
| --- | --- | |
| 4019 | 4019 | return RESULT_FAILURE; |
| 4020 | 4020 | } |
| 4021 | 4021 | |
| 4022 | static int unicall_show_channels(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 4022 | static int unicall_show_channels(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 4023 | 4023 | { |
| 4024 | 4024 | #define FORMAT1 "%7s %-10.10s %-15.15s %-10.10s %-10.10s %-20.20s\n" |
| 4025 | 4025 | #define FORMAT2 "%7s %-10.10s %-15.15s %-10.10s %-10.10s %-20.20s\n" |
| --- | --- | |
| 4056 | 4056 | #undef FORMAT2 |
| 4057 | 4057 | } |
| 4058 | 4058 | |
| 4059 | static int unicall_show_channel(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 4059 | static int unicall_show_channel(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 4060 | 4060 | { |
| 4061 | 4061 | unicall_pvt_t *tmp = NULL; |
| 4062 | 4062 | int channel; |
callweaver/trunk/channels/chan_woomera.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 200 | 200 | static int connect_woomera(int *new_socket, woomera_profile *profile, int flags); |
| 201 | 201 | static int init_woomera(void); |
| 202 | 202 | static struct cw_channel *woomera_new(const char *type, int format, void *data, int *cause); |
| 203 | static int woomera_cli(struct cw_dynstr **ds_p, int argc, char *argv[]); | |
| 203 | static int woomera_cli(struct cw_dynstr *ds_p, int argc, char *argv[]); | |
| 204 | 204 | static void tech_destroy(private_object *tech_pvt); |
| 205 | 205 | static struct cw_channel *woomera_new(const char *type, int format, void *data, int *cause); |
| 206 | 206 | static int tech_create_read_socket(private_object *tech_pvt); |
| --- | --- | |
| 1874 | 1874 | } |
| 1875 | 1875 | |
| 1876 | 1876 | |
| 1877 | static int woomera_cli(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1877 | static int woomera_cli(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1878 | 1878 | { |
| 1879 | 1879 | if (argc > 1) { |
| 1880 | 1880 | if (!strcmp(argv[1], "debug")) { |
callweaver/trunk/channels/chan_zap.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 8962 | 8962 | return 0; |
| 8963 | 8963 | } |
| 8964 | 8964 | |
| 8965 | static void complete_span_helper(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len, int rpos) | |
| 8965 | static void complete_span_helper(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len, int rpos) | |
| 8966 | 8966 | { |
| 8967 | 8967 | int span = 1; |
| 8968 | 8968 | |
| --- | --- | |
| 8974 | 8974 | } |
| 8975 | 8975 | } |
| 8976 | 8976 | |
| 8977 | static void complete_span_4(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 8977 | static void complete_span_4(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 8978 | 8978 | { |
| 8979 | 8979 | complete_span_helper(ds_p, argv, lastarg, lastarg_len, 3); |
| 8980 | 8980 | } |
| 8981 | 8981 | |
| 8982 | static void complete_span_5(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 8982 | static void complete_span_5(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 8983 | 8983 | { |
| 8984 | 8984 | complete_span_helper(ds_p, argv, lastarg, lastarg_len, 4); |
| 8985 | 8985 | } |
| 8986 | 8986 | |
| 8987 | static int handle_pri_set_debug_file(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 8987 | static int handle_pri_set_debug_file(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 8988 | 8988 | { |
| 8989 | 8989 | int myfd; |
| 8990 | 8990 | |
| --- | --- | |
| 9024 | 9024 | return RESULT_SUCCESS; |
| 9025 | 9025 | } |
| 9026 | 9026 | |
| 9027 | static int handle_pri_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 9027 | static int handle_pri_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 9028 | 9028 | { |
| 9029 | 9029 | int span; |
| 9030 | 9030 | int x; |
| --- | --- | |
| 9050 | 9050 | |
| 9051 | 9051 | |
| 9052 | 9052 | |
| 9053 | static int handle_pri_no_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 9053 | static int handle_pri_no_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 9054 | 9054 | { |
| 9055 | 9055 | int span; |
| 9056 | 9056 | int x; |
| --- | --- | |
| 9073 | 9073 | return RESULT_SUCCESS; |
| 9074 | 9074 | } |
| 9075 | 9075 | |
| 9076 | static int handle_pri_really_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 9076 | static int handle_pri_really_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 9077 | 9077 | { |
| 9078 | 9078 | int span; |
| 9079 | 9079 | int x; |
| --- | --- | |
| 9117 | 9117 | s[len - 1] = '\0'; |
| 9118 | 9118 | } |
| 9119 | 9119 | |
| 9120 | static int handle_pri_show_span(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 9120 | static int handle_pri_show_span(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 9121 | 9121 | { |
| 9122 | 9122 | int span; |
| 9123 | 9123 | int x; |
| --- | --- | |
| 9156 | 9156 | return RESULT_SUCCESS; |
| 9157 | 9157 | } |
| 9158 | 9158 | |
| 9159 | static int handle_pri_show_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 9159 | static int handle_pri_show_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 9160 | 9160 | { |
| 9161 | 9161 | int x; |
| 9162 | 9162 | int span; |
| --- | --- | |
| 9249 | 9249 | |
| 9250 | 9250 | #endif /* ZAPATA_PRI */ |
| 9251 | 9251 | |
| 9252 | static int dahdi_destroy_channel(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 9252 | static int dahdi_destroy_channel(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 9253 | 9253 | { |
| 9254 | 9254 | int channel = 0; |
| 9255 | 9255 | struct dahdi_pvt *tmp = NULL; |
| --- | --- | |
| 9274 | 9274 | return RESULT_FAILURE; |
| 9275 | 9275 | } |
| 9276 | 9276 | |
| 9277 | static int dahdi_show_channels(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 9277 | static int dahdi_show_channels(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 9278 | 9278 | { |
| 9279 | 9279 | #define FORMAT "%7s %-16.16s %-15.15s %-10.10s %-20.20s\n" |
| 9280 | 9280 | #define FORMAT2 "%7s %-16.16s %-15.15s %-10.10s %-20.20s\n" |
| --- | --- | |
| 9337 | 9337 | #undef FORMAT2 |
| 9338 | 9338 | } |
| 9339 | 9339 | |
| 9340 | static int dahdi_show_channel(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 9340 | static int dahdi_show_channel(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 9341 | 9341 | { |
| 9342 | 9342 | int channel; |
| 9343 | 9343 | struct dahdi_pvt *tmp = NULL; |
| --- | --- | |
| 9484 | 9484 | "Usage: dahdi show cadences\n" |
| 9485 | 9485 | " Shows all cadences currently defined\n"; |
| 9486 | 9486 | |
| 9487 | static int handle_dahdi_show_cadences(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 9487 | static int handle_dahdi_show_cadences(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 9488 | 9488 | { |
| 9489 | 9489 | int i, j; |
| 9490 | 9490 | |
| --- | --- | |
| 9515 | 9515 | } |
| 9516 | 9516 | |
| 9517 | 9517 | /* Based on irqmiss.c */ |
| 9518 | static int dahdi_show_status(struct cw_dynstr **ds_p, int argc, char *argv[]) { | |
| 9518 | static int dahdi_show_status(struct cw_dynstr *ds_p, int argc, char *argv[]) { | |
| 9519 | 9519 | #define FORMAT "%-40.40s %-10.10s %-10d %-10d %-10d\n" |
| 9520 | 9520 | #define FORMAT2 "%-40.40s %-10.10s %-10.10s %-10.10s %-10.10s\n" |
| 9521 | 9521 |
callweaver/trunk/channels/fax/chan_fax.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 1068 | 1068 | */ |
| 1069 | 1069 | |
| 1070 | 1070 | /*! Show the status of all configured fax modems */ |
| 1071 | static int chan_fax_status(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1071 | static int chan_fax_status(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1072 | 1072 | { |
| 1073 | 1073 | int x; |
| 1074 | 1074 | |
| --- | --- | |
| 1087 | 1087 | |
| 1088 | 1088 | |
| 1089 | 1089 | /*! Show or set the verbosity level */ |
| 1090 | static int chan_fax_vblevel(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1090 | static int chan_fax_vblevel(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1091 | 1091 | { |
| 1092 | 1092 | if (argc > 2) |
| 1093 | 1093 | cfg_vblevel = atoi(argv[2]); |
callweaver/trunk/channels/iax2/chan_iax2.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 290 | 290 | static int global_rtautoclear = 120; |
| 291 | 291 | |
| 292 | 292 | static int reload_config(void); |
| 293 | static int iax2_reload(struct cw_dynstr **ds_p, int argc, char *argv[]); | |
| 293 | static int iax2_reload(struct cw_dynstr *ds_p, int argc, char *argv[]); | |
| 294 | 294 | |
| 295 | 295 | |
| 296 | 296 | struct iax2_user { |
| --- | --- | |
| 644 | 644 | static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in *sin); |
| 645 | 645 | |
| 646 | 646 | static void destroy_peer(struct iax2_peer *peer); |
| 647 | static int cw_cli_netstats(struct cw_dynstr **ds_p, int limit_fmt); | |
| 647 | static int cw_cli_netstats(struct cw_dynstr *ds_p, int limit_fmt); | |
| 648 | 648 | |
| 649 | 649 | #ifdef __CW_DEBUG_MALLOC |
| 650 | 650 | static void FREE(void *ptr) |
| --- | --- | |
| 1476 | 1476 | return 0; |
| 1477 | 1477 | } |
| 1478 | 1478 | |
| 1479 | static int iax2_prune_realtime(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1479 | static int iax2_prune_realtime(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1480 | 1480 | { |
| 1481 | 1481 | struct iax2_peer *peer; |
| 1482 | 1482 | |
| --- | --- | |
| 1500 | 1500 | return RESULT_SUCCESS; |
| 1501 | 1501 | } |
| 1502 | 1502 | |
| 1503 | static int iax2_test_losspct(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1503 | static int iax2_test_losspct(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1504 | 1504 | { |
| 1505 | 1505 | CW_UNUSED(ds_p); |
| 1506 | 1506 | |
| --- | --- | |
| 1513 | 1513 | } |
| 1514 | 1514 | |
| 1515 | 1515 | #ifdef IAXTESTS |
| 1516 | static int iax2_test_late(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1516 | static int iax2_test_late(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1517 | 1517 | { |
| 1518 | 1518 | if (argc != 4) |
| 1519 | 1519 | return RESULT_SHOWUSAGE; |
| --- | --- | |
| 1523 | 1523 | return RESULT_SUCCESS; |
| 1524 | 1524 | } |
| 1525 | 1525 | |
| 1526 | static int iax2_test_resync(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1526 | static int iax2_test_resync(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1527 | 1527 | { |
| 1528 | 1528 | if (argc != 4) |
| 1529 | 1529 | return RESULT_SHOWUSAGE; |
| --- | --- | |
| 1536 | 1536 | #endif /* IAXTESTS */ |
| 1537 | 1537 | |
| 1538 | 1538 | /*--- iax2_show_peer: Show one peer in detail ---*/ |
| 1539 | static int iax2_show_peer(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1539 | static int iax2_show_peer(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1540 | 1540 | { |
| 1541 | 1541 | char status[30]; |
| 1542 | 1542 | char cbuf[256]; |
| --- | --- | |
| 1605 | 1605 | return RESULT_SUCCESS; |
| 1606 | 1606 | } |
| 1607 | 1607 | |
| 1608 | static void complete_iax2_show_peer(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 1608 | static void complete_iax2_show_peer(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 1609 | 1609 | { |
| 1610 | 1610 | struct iax2_peer *p; |
| 1611 | 1611 | |
| --- | --- | |
| 1622 | 1622 | } |
| 1623 | 1623 | } |
| 1624 | 1624 | |
| 1625 | static int iax2_show_stats(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1625 | static int iax2_show_stats(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1626 | 1626 | { |
| 1627 | 1627 | struct iax_frame *cur; |
| 1628 | 1628 | int cnt = 0, dead=0, final=0; |
| --- | --- | |
| 1648 | 1648 | return RESULT_SUCCESS; |
| 1649 | 1649 | } |
| 1650 | 1650 | |
| 1651 | static int iax2_show_cache(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1651 | static int iax2_show_cache(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1652 | 1652 | { |
| 1653 | 1653 | struct iax2_dpcache *dp; |
| 1654 | 1654 | char tmp[1024], *pc; |
| --- | --- | |
| 3473 | 3473 | return res; |
| 3474 | 3474 | } |
| 3475 | 3475 | |
| 3476 | static int iax2_show_users(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3476 | static int iax2_show_users(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3477 | 3477 | { |
| 3478 | 3478 | regex_t regexbuf; |
| 3479 | 3479 | int havepattern = 0; |
| --- | --- | |
| 3534 | 3534 | #undef FORMAT2 |
| 3535 | 3535 | } |
| 3536 | 3536 | |
| 3537 | static int __iax2_show_peers(int manager, struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3537 | static int __iax2_show_peers(int manager, struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3538 | 3538 | { |
| 3539 | 3539 | regex_t regexbuf; |
| 3540 | 3540 | int havepattern = 0; |
| --- | --- | |
| 3651 | 3651 | #undef FORMAT2 |
| 3652 | 3652 | } |
| 3653 | 3653 | |
| 3654 | static int iax2_show_peers(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3654 | static int iax2_show_peers(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3655 | 3655 | { |
| 3656 | 3656 | return __iax2_show_peers(0, ds_p, argc, argv); |
| 3657 | 3657 | } |
| --- | --- | |
| 3663 | 3663 | CW_UNUSED(req); |
| 3664 | 3664 | |
| 3665 | 3665 | if ((msg = cw_manager_response("Follows", NULL))) { |
| 3666 | msg->data->used -= 2; | |
| 3667 | cw_cli_netstats(&msg->data, 0); | |
| 3668 | cw_dynstr_printf(&msg->data, "--END COMMAND--\r\n\r\n"); | |
| 3666 | msg->ds.used -= 2; | |
| 3667 | cw_cli_netstats(&msg->ds, 0); | |
| 3668 | cw_dynstr_printf(&msg->ds, "--END COMMAND--\r\n\r\n"); | |
| 3669 | 3669 | } |
| 3670 | 3670 | |
| 3671 | 3671 | return msg; |
| --- | --- | |
| 3680 | 3680 | CW_UNUSED(req); |
| 3681 | 3681 | |
| 3682 | 3682 | if ((msg = cw_manager_response("Follows", NULL))) { |
| 3683 | msg->data->used -= 2; | |
| 3684 | __iax2_show_peers(1, &msg->data, 3, (char **)a); | |
| 3685 | cw_dynstr_printf(&msg->data, "--END COMMAND--\r\n\r\n"); | |
| 3683 | msg->ds.used -= 2; | |
| 3684 | __iax2_show_peers(1, &msg->ds, 3, (char **)a); | |
| 3685 | cw_dynstr_printf(&msg->ds, "--END COMMAND--\r\n\r\n"); | |
| 3686 | 3686 | } |
| 3687 | 3687 | |
| 3688 | 3688 | return msg; |
| --- | --- | |
| 3710 | 3710 | } |
| 3711 | 3711 | } |
| 3712 | 3712 | |
| 3713 | static int iax2_show_registry(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3713 | static int iax2_show_registry(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3714 | 3714 | { |
| 3715 | 3715 | #define FORMAT2 "%-20.20s %-10.10s %-20.20s %8.8s %s\n" |
| 3716 | 3716 | #define FORMAT "%-20.20s %-10.10s %-20.20s %8d %s\n" |
| --- | --- | |
| 3745 | 3745 | #undef FORMAT2 |
| 3746 | 3746 | } |
| 3747 | 3747 | |
| 3748 | static int iax2_show_channels(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3748 | static int iax2_show_channels(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3749 | 3749 | { |
| 3750 | 3750 | #define FORMAT2 "%-20.20s %-15.15s %-10.10s %-11.11s %-11.11s %-7.7s %-6.6s %s\n" |
| 3751 | 3751 | #define FORMAT "%-20.20s %-15.15s %-10.10s %5.5d/%5.5d %5.5d/%5.5d %-6.6d %-6.6d %s\n" |
| --- | --- | |
| 3809 | 3809 | #undef FORMATB |
| 3810 | 3810 | } |
| 3811 | 3811 | |
| 3812 | static int cw_cli_netstats(struct cw_dynstr **ds_p, int limit_fmt) | |
| 3812 | static int cw_cli_netstats(struct cw_dynstr *ds_p, int limit_fmt) | |
| 3813 | 3813 | { |
| 3814 | 3814 | int x; |
| 3815 | 3815 | int numchans = 0; |
| --- | --- | |
| 3869 | 3869 | return numchans; |
| 3870 | 3870 | } |
| 3871 | 3871 | |
| 3872 | static int iax2_show_netstats(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3872 | static int iax2_show_netstats(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3873 | 3873 | { |
| 3874 | 3874 | CW_UNUSED(argv); |
| 3875 | 3875 | |
| --- | --- | |
| 3885 | 3885 | return RESULT_SUCCESS; |
| 3886 | 3886 | } |
| 3887 | 3887 | |
| 3888 | static int iax2_do_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3888 | static int iax2_do_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3889 | 3889 | { |
| 3890 | 3890 | CW_UNUSED(argv); |
| 3891 | 3891 | |
| --- | --- | |
| 3896 | 3896 | return RESULT_SUCCESS; |
| 3897 | 3897 | } |
| 3898 | 3898 | |
| 3899 | static int iax2_do_trunk_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3899 | static int iax2_do_trunk_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3900 | 3900 | { |
| 3901 | 3901 | CW_UNUSED(argv); |
| 3902 | 3902 | |
| --- | --- | |
| 3907 | 3907 | return RESULT_SUCCESS; |
| 3908 | 3908 | } |
| 3909 | 3909 | |
| 3910 | static int iax2_no_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3910 | static int iax2_no_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3911 | 3911 | { |
| 3912 | 3912 | CW_UNUSED(argv); |
| 3913 | 3913 | |
| --- | --- | |
| 3918 | 3918 | return RESULT_SUCCESS; |
| 3919 | 3919 | } |
| 3920 | 3920 | |
| 3921 | static int iax2_no_trunk_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3921 | static int iax2_no_trunk_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3922 | 3922 | { |
| 3923 | 3923 | CW_UNUSED(argv); |
| 3924 | 3924 | |
| --- | --- | |
| 8185 | 8185 | return 0; |
| 8186 | 8186 | } |
| 8187 | 8187 | |
| 8188 | static int iax2_reload(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 8188 | static int iax2_reload(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 8189 | 8189 | { |
| 8190 | 8190 | CW_UNUSED(ds_p); |
| 8191 | 8191 | CW_UNUSED(argc); |
callweaver/trunk/channels/misdn/chan_misdn.c (unified diff)
| r5590 | r5625 | |
|---|---|---|
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | /*** CLI HANDLING ***/ |
| 565 | static int misdn_set_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 565 | static int misdn_set_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 566 | 566 | { |
| 567 | 567 | if (argc != 4 && argc != 5 && argc != 6 && argc != 7) |
| 568 | 568 | return RESULT_SHOWUSAGE; |
| --- | --- | |
| 619 | 619 | return 0; |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | static int misdn_set_crypt_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 622 | static int misdn_set_crypt_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 623 | 623 | { |
| 624 | 624 | if (argc != 5) return RESULT_SHOWUSAGE; |
| 625 | 625 | |
| --- | --- | |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | |
| 630 | static int misdn_port_block(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 630 | static int misdn_port_block(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 631 | 631 | { |
| 632 | 632 | int port; |
| 633 | 633 | |
| --- | --- | |
| 641 | 641 | return 0; |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | static int misdn_port_unblock(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 644 | static int misdn_port_unblock(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 645 | 645 | { |
| 646 | 646 | int port; |
| 647 | 647 | |
| --- | --- | |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | |
| 659 | static int misdn_restart_port (struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 659 | static int misdn_restart_port (struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 660 | 660 | { |
| 661 | 661 | int port; |
| 662 | 662 | |
| --- | --- | |
| 670 | 670 | return 0; |
| 671 | 671 | } |
| 672 | 672 | |
| 673 | static int misdn_port_up (struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 673 | static int misdn_port_up (struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 674 | 674 | { |
| 675 | 675 | int port; |
| 676 | 676 | |
| --- | --- | |
| 684 | 684 | return 0; |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | static int misdn_port_down (struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 687 | static int misdn_port_down (struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 688 | 688 | { |
| 689 | 689 | int port; |
| 690 | 690 | |
| --- | --- | |
| 698 | 698 | return 0; |
| 699 | 699 | } |
| 700 | 700 | |
| 701 | static inline void show_config_description (struct cw_dynstr **ds_p, enum misdn_cfg_elements elem) | |
| 701 | static inline void show_config_description (struct cw_dynstr *ds_p, enum misdn_cfg_elements elem) | |
| 702 | 702 | { |
| 703 | 703 | char section[BUFFERSIZE]; |
| 704 | 704 | char name[BUFFERSIZE]; |
| --- | --- | |
| 720 | 720 | cw_dynstr_printf(ds_p, "[%s] %s\n\t%s\n", section, name, desc); |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | static int misdn_show_config (struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 723 | static int misdn_show_config (struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 724 | 724 | { |
| 725 | 725 | char buffer[BUFFERSIZE]; |
| 726 | 726 | enum misdn_cfg_elements elem; |
| --- | --- | |
| 865 | 865 | } |
| 866 | 866 | } |
| 867 | 867 | |
| 868 | static int misdn_reload (struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 868 | static int misdn_reload (struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 869 | 869 | { |
| 870 | 870 | cw_dynstr_printf(ds_p, "Reloading mISDN Config\n"); |
| 871 | 871 | reload_config(); |
| 872 | 872 | return 0; |
| 873 | 873 | } |
| 874 | 874 | |
| 875 | static void print_bc_info (struct cw_dynstr **ds_p, struct chan_list* help, struct misdn_bchannel* bc) | |
| 875 | static void print_bc_info (struct cw_dynstr *ds_p, struct chan_list* help, struct misdn_bchannel* bc) | |
| 876 | 876 | { |
| 877 | 877 | struct cw_channel *cw=help->cw; |
| 878 | 878 | cw_dynstr_printf(ds_p, |
| --- | --- | |
| 933 | 933 | |
| 934 | 934 | } |
| 935 | 935 | |
| 936 | static int misdn_show_cls (struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 936 | static int misdn_show_cls (struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 937 | 937 | { |
| 938 | 938 | struct chan_list *help=cl_te; |
| 939 | 939 | |
| --- | --- | |
| 957 | 957 | return 0; |
| 958 | 958 | } |
| 959 | 959 | |
| 960 | static int misdn_show_cl (struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 960 | static int misdn_show_cl (struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 961 | 961 | { |
| 962 | 962 | struct chan_list *help=cl_te; |
| 963 | 963 | |
| --- | --- | |
| 983 | 983 | cw_mutex_t lock; |
| 984 | 984 | int MAXTICS=8; |
| 985 | 985 | |
| 986 | static int misdn_set_tics (struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 986 | static int misdn_set_tics (struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 987 | 987 | { |
| 988 | 988 | if (argc != 4) |
| 989 | 989 | return RESULT_SHOWUSAGE; |
| --- | --- | |
| 993 | 993 | return 0; |
| 994 | 994 | } |
| 995 | 995 | |
| 996 | static int misdn_show_stacks (struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 996 | static int misdn_show_stacks (struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 997 | 997 | { |
| 998 | 998 | int port; |
| 999 | 999 | |
| --- | --- | |
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | 1012 | |
| 1013 | static int misdn_show_ports_stats (struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1013 | static int misdn_show_ports_stats (struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1014 | 1014 | { |
| 1015 | 1015 | int port; |
| 1016 | 1016 | |
| --- | --- | |
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | 1029 | |
| 1030 | static int misdn_show_port (struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1030 | static int misdn_show_port (struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1031 | 1031 | { |
| 1032 | 1032 | int port; |
| 1033 | 1033 | |
| --- | --- | |
| 1046 | 1046 | return 0; |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | static int misdn_send_cd (struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1049 | static int misdn_send_cd (struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1050 | 1050 | { |
| 1051 | 1051 | char *channame; |
| 1052 | 1052 | char *nr; |
| --- | --- | |
| 1074 | 1074 | return 0; |
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | static int misdn_send_digit (struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1077 | static int misdn_send_digit (struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1078 | 1078 | { |
| 1079 | 1079 | char *channame; |
| 1080 | 1080 | char *msg; |
| --- | --- | |
| 1114 | 1114 | return 0; |
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | static int misdn_toggle_echocancel (struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1117 | static int misdn_toggle_echocancel (struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1118 | 1118 | { |
| 1119 | 1119 | char *channame; |
| 1120 | 1120 | |
| --- | --- | |
| 1147 | 1147 | return 0; |
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | static int misdn_send_display (struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1150 | static int misdn_send_display (struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1151 | 1151 | { |
| 1152 | 1152 | char *channame; |
| 1153 | 1153 | char *msg; |
| --- | --- | |
| 1175 | 1175 | return RESULT_SUCCESS ; |
| 1176 | 1176 | } |
| 1177 | 1177 | |
| 1178 | static void complete_ch(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 1178 | static void complete_ch(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 1179 | 1179 | { |
| 1180 | 1180 | if (lastarg == 3) |
| 1181 | 1181 | cw_complete_channel(ds_p, argv[3], lastarg_len); |
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | static void complete_debug_port(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 1184 | static void complete_debug_port(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 1185 | 1185 | { |
| 1186 | 1186 | switch (lastarg) { |
| 1187 | 1187 | case 4: |
| --- | --- | |
| 1197 | 1197 | } |
| 1198 | 1198 | } |
| 1199 | 1199 | |
| 1200 | static void complete_show_config(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 1200 | static void complete_show_config(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 1201 | 1201 | { |
| 1202 | 1202 | char buffer[BUFFERSIZE]; |
| 1203 | 1203 | enum misdn_cfg_elements elem; |
callweaver/trunk/channels/sccp/sccp_cli.c (unified diff)
| r5596 | r5625 | |
|---|---|---|
| 24 | 24 | |
| 25 | 25 | /* ------------------------------------------------------------ */ |
| 26 | 26 | |
| 27 | static int sccp_reset_restart(struct cw_dynstr **ds_p, int argc, char * argv[]) { | |
| 27 | static int sccp_reset_restart(struct cw_dynstr *ds_p, int argc, char * argv[]) { | |
| 28 | 28 | sccp_moo_t * r; |
| 29 | 29 | sccp_device_t * d; |
| 30 | 30 | |
| --- | --- | |
| 74 | 74 | return(buf); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | static int sccp_show_globals(struct cw_dynstr **ds_p, int argc, char * argv[]) | |
| 77 | static int sccp_show_globals(struct cw_dynstr *ds_p, int argc, char * argv[]) | |
| 78 | 78 | { |
| 79 | 79 | char pref_buf[128]; |
| 80 | 80 | char cap_buf[512]; |
| --- | --- | |
| 148 | 148 | |
| 149 | 149 | /* ------------------------------------------------------------ */ |
| 150 | 150 | |
| 151 | static int sccp_show_device(struct cw_dynstr **ds_p, int argc, char * argv[]) { | |
| 151 | static int sccp_show_device(struct cw_dynstr *ds_p, int argc, char * argv[]) { | |
| 152 | 152 | sccp_device_t * d; |
| 153 | 153 | sccp_speed_t * k; |
| 154 | 154 | sccp_line_t * l; |
| --- | --- | |
| 249 | 249 | |
| 250 | 250 | /* ------------------------------------------------------------ */ |
| 251 | 251 | |
| 252 | static int sccp_show_channels(struct cw_dynstr **ds_p, int argc, char * argv[]) | |
| 252 | static int sccp_show_channels(struct cw_dynstr *ds_p, int argc, char * argv[]) | |
| 253 | 253 | { |
| 254 | 254 | sccp_channel_t * c; |
| 255 | 255 | |
| --- | --- | |
| 286 | 286 | |
| 287 | 287 | /* ------------------------------------------------------------ */ |
| 288 | 288 | |
| 289 | static int sccp_show_devices(struct cw_dynstr **ds_p, int argc, char * argv[]) | |
| 289 | static int sccp_show_devices(struct cw_dynstr *ds_p, int argc, char * argv[]) | |
| 290 | 290 | { |
| 291 | 291 | char iabuf[INET_ADDRSTRLEN]; |
| 292 | 292 | sccp_device_t * d; |
| --- | --- | |
| 321 | 321 | .usage = "Usage: sccp show devices\n", |
| 322 | 322 | }; |
| 323 | 323 | |
| 324 | static int sccp_message_devices(struct cw_dynstr **ds_p, int argc, char * argv[]) | |
| 324 | static int sccp_message_devices(struct cw_dynstr *ds_p, int argc, char * argv[]) | |
| 325 | 325 | { |
| 326 | 326 | sccp_device_t * d; |
| 327 | 327 | int msgtimeout=10; |
| --- | --- | |
| 359 | 359 | |
| 360 | 360 | /* ------------------------------------------------------------ */ |
| 361 | 361 | |
| 362 | static int sccp_show_lines(struct cw_dynstr **ds_p, int argc, char * argv[]) | |
| 362 | static int sccp_show_lines(struct cw_dynstr *ds_p, int argc, char * argv[]) | |
| 363 | 363 | { |
| 364 | 364 | char cap_buf[512]; |
| 365 | 365 | sccp_line_t * l = NULL; |
| --- | --- | |
| 420 | 420 | |
| 421 | 421 | /* ------------------------------------------------------------ */ |
| 422 | 422 | |
| 423 | static int sccp_show_sessions(struct cw_dynstr **ds_p, int argc, char * argv[]) | |
| 423 | static int sccp_show_sessions(struct cw_dynstr *ds_p, int argc, char * argv[]) | |
| 424 | 424 | { |
| 425 | 425 | char iabuf[INET_ADDRSTRLEN]; |
| 426 | 426 | sccp_session_t * s = NULL; |
| --- | --- | |
| 466 | 466 | }; |
| 467 | 467 | |
| 468 | 468 | /* ------------------------------------------------------------ */ |
| 469 | static int sccp_system_message(struct cw_dynstr **ds_p, int argc, char * argv[]) { | |
| 469 | static int sccp_system_message(struct cw_dynstr *ds_p, int argc, char * argv[]) { | |
| 470 | 470 | int res; |
| 471 | 471 | int timeout = 0; |
| 472 | 472 | if ((argc < 3) || (argc > 5)) |
| --- | --- | |
| 523 | 523 | "Usage: SCCP no debug\n" |
| 524 | 524 | " Disables dumping of SCCP packets for debugging purposes\n"; |
| 525 | 525 | |
| 526 | static int sccp_do_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) { | |
| 526 | static int sccp_do_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) { | |
| 527 | 527 | int new_debug = 10; |
| 528 | 528 | |
| 529 | 529 | if ((argc < 2) || (argc > 3)) |
| --- | --- | |
| 548 | 548 | .usage = debug_usage, |
| 549 | 549 | }; |
| 550 | 550 | |
| 551 | static int sccp_no_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 551 | static int sccp_no_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 552 | 552 | { |
| 553 | 553 | CW_UNUSED(argv); |
| 554 | 554 | |
| --- | --- | |
| 567 | 567 | .usage = no_debug_usage, |
| 568 | 568 | }; |
| 569 | 569 | |
| 570 | static int sccp_do_reload(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 570 | static int sccp_do_reload(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 571 | 571 | { |
| 572 | 572 | CW_UNUSED(argc); |
| 573 | 573 | CW_UNUSED(argv); |
| --- | --- | |
| 591 | 591 | "Usage: SCCP show version\n" |
| 592 | 592 | " Show the SCCP channel version\n"; |
| 593 | 593 | |
| 594 | static int sccp_show_version(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 594 | static int sccp_show_version(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 595 | 595 | { |
| 596 | 596 | CW_UNUSED(argc); |
| 597 | 597 | CW_UNUSED(argv); |
callweaver/trunk/channels/visdn/chan_visdn.c (unified diff)
| r5562 | r5625 | |
|---|---|---|
| 4354 | 4354 | |
| 4355 | 4355 | /*---------------------------------------------------------------------------*/ |
| 4356 | 4356 | |
| 4357 | static int do_debug_visdn_generic(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 4357 | static int do_debug_visdn_generic(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 4358 | 4358 | { |
| 4359 | 4359 | cw_mutex_lock(&visdn.lock); |
| 4360 | 4360 | visdn.debug = TRUE; |
| --- | --- | |
| 4380 | 4380 | |
| 4381 | 4381 | /*---------------------------------------------------------------------------*/ |
| 4382 | 4382 | |
| 4383 | static int do_no_debug_visdn_generic(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 4383 | static int do_no_debug_visdn_generic(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 4384 | 4384 | { |
| 4385 | 4385 | cw_mutex_lock(&visdn.lock); |
| 4386 | 4386 | visdn.debug = FALSE; |
| --- | --- | |
| 4402 | 4402 | |
| 4403 | 4403 | /*---------------------------------------------------------------------------*/ |
| 4404 | 4404 | |
| 4405 | static int do_debug_visdn_q921(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 4405 | static int do_debug_visdn_q921(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 4406 | 4406 | { |
| 4407 | 4407 | // Enable debugging on new DLCs FIXME TODO |
| 4408 | 4408 | |
| --- | --- | |
| 4432 | 4432 | |
| 4433 | 4433 | /*---------------------------------------------------------------------------*/ |
| 4434 | 4434 | |
| 4435 | static int do_no_debug_visdn_q921(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 4435 | static int do_no_debug_visdn_q921(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 4436 | 4436 | { |
| 4437 | 4437 | // Disable debugging on new DLCs FIXME TODO |
| 4438 | 4438 | |
| --- | --- | |
| 4457 | 4457 | |
| 4458 | 4458 | /*---------------------------------------------------------------------------*/ |
| 4459 | 4459 | |
| 4460 | static int do_debug_visdn_q931(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 4460 | static int do_debug_visdn_q931(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 4461 | 4461 | { |
| 4462 | 4462 | cw_mutex_lock(&visdn.lock); |
| 4463 | 4463 | visdn.debug_q931 = TRUE; |
| --- | --- | |
| 4484 | 4484 | |
| 4485 | 4485 | /*---------------------------------------------------------------------------*/ |
| 4486 | 4486 | |
| 4487 | static int do_no_debug_visdn_q931(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 4487 | static int do_no_debug_visdn_q931(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 4488 | 4488 | { |
| 4489 | 4489 | cw_mutex_lock(&visdn.lock); |
| 4490 | 4490 | visdn.debug_q931 = FALSE; |
| --- | --- | |
| 4506 | 4506 | |
| 4507 | 4507 | /*---------------------------------------------------------------------------*/ |
| 4508 | 4508 | |
| 4509 | static int do_visdn_reload(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 4509 | static int do_visdn_reload(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 4510 | 4510 | { |
| 4511 | 4511 | visdn_reload_config(); |
| 4512 | 4512 | |
| --- | --- | |
| 4532 | 4532 | /*---------------------------------------------------------------------------*/ |
| 4533 | 4533 | |
| 4534 | 4534 | static void visdn_print_call_summary_entry( |
| 4535 | struct cw_dynstr **ds_p, | |
| 4535 | struct cw_dynstr *ds_p, | |
| 4536 | 4536 | struct q931_call *call) |
| 4537 | 4537 | { |
| 4538 | 4538 | char idstr[20]; |
| --- | --- | |
| 4560 | 4560 | } |
| 4561 | 4561 | |
| 4562 | 4562 | static int visdn_cli_print_call_list( |
| 4563 | struct cw_dynstr **ds_p, | |
| 4563 | struct cw_dynstr *ds_p, | |
| 4564 | 4564 | struct q931_interface *filter_intf) |
| 4565 | 4565 | { |
| 4566 | 4566 | int first_call; |
| --- | --- | |
| 4599 | 4599 | } |
| 4600 | 4600 | |
| 4601 | 4601 | static void visdn_cli_print_call_timer_info( |
| 4602 | struct cw_dynstr **ds_p, struct q931_timer *timer, | |
| 4602 | struct cw_dynstr *ds_p, struct q931_timer *timer, | |
| 4603 | 4603 | const char *name) |
| 4604 | 4604 | { |
| 4605 | 4605 | if (timer->pending) { |
| --- | --- | |
| 4608 | 4608 | } |
| 4609 | 4609 | } |
| 4610 | 4610 | |
| 4611 | static void visdn_cli_print_call(struct cw_dynstr **ds_p, struct q931_call *call) | |
| 4611 | static void visdn_cli_print_call(struct cw_dynstr *ds_p, struct q931_call *call) | |
| 4612 | 4612 | { |
| 4613 | 4613 | cw_dynstr_printf(ds_p, "--------- Call %s/%d.%s\n", |
| 4614 | 4614 | call->intf->name, |
| --- | --- | |
| 4735 | 4735 | return NULL; |
| 4736 | 4736 | } |
| 4737 | 4737 | |
| 4738 | static int do_show_visdn_calls(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 4738 | static int do_show_visdn_calls(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 4739 | 4739 | { |
| 4740 | 4740 | if (argc < 4) { |
| 4741 | 4741 | visdn_cli_print_call_list(fd, NULL); |
callweaver/trunk/channels/visdn/huntgroup.c (unified diff)
| r5560 | r5625 | |
|---|---|---|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | static void do_show_visdn_huntgroups_details( |
| 299 | struct cw_dynstr **ds_p, struct visdn_huntgroup *hg) | |
| 299 | struct cw_dynstr *ds_p, struct visdn_huntgroup *hg) | |
| 300 | 300 | { |
| 301 | 301 | struct visdn_huntgroup_member *hgm; |
| 302 | 302 | |
| --- | --- | |
| 311 | 311 | cw_dynstr_printf(ds_p, "\n"); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | static int do_show_visdn_huntgroups(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 314 | static int do_show_visdn_huntgroups(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 315 | 315 | { |
| 316 | 316 | cw_mutex_lock(&visdn.lock); |
| 317 | 317 |
callweaver/trunk/channels/visdn/intf.c (unified diff)
| r5560 | r5625 | |
|---|---|---|
| 764 | 764 | return "*UNKNOWN*"; |
| 765 | 765 | } |
| 766 | 766 | |
| 767 | static void visdn_print_intf_details(struct cw_dynstr **ds_p, struct visdn_intf *intf) | |
| 767 | static void visdn_print_intf_details(struct cw_dynstr *ds_p, struct visdn_intf *intf) | |
| 768 | 768 | { |
| 769 | 769 | struct visdn_ic *ic = intf->current_ic; |
| 770 | 770 | |
| --- | --- | |
| 979 | 979 | return visdn_intf_complete(line, word, pos, state); |
| 980 | 980 | } |
| 981 | 981 | |
| 982 | static int do_show_visdn_interfaces(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 982 | static int do_show_visdn_interfaces(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 983 | 983 | { |
| 984 | 984 | cw_mutex_lock(&visdn.lock); |
| 985 | 985 |
callweaver/trunk/corelib/callweaver.c (unified diff)
| r5623 | r5625 | |
|---|---|---|
| 623 | 623 | int timeout; |
| 624 | 624 | }; |
| 625 | 625 | |
| 626 | static void shutdown_restart(struct cw_dynstr **ds_p, int doit, int graceful, int timeout); | |
| 626 | static void shutdown_restart(struct cw_dynstr *ds_p, int doit, int graceful, int timeout); | |
| 627 | 627 | |
| 628 | 628 | static void *quit_when_idle(void *data) |
| 629 | 629 | { |
| --- | --- | |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | |
| 684 | static void shutdown_restart(struct cw_dynstr **ds_p, int doit, int graceful, int timeout) | |
| 684 | static void shutdown_restart(struct cw_dynstr *ds_p, int doit, int graceful, int timeout) | |
| 685 | 685 | { |
| 686 | 686 | static cw_mutex_t lock = CW_MUTEX_INIT_VALUE; |
| 687 | 687 | static struct shutdown_state state = { |
| --- | --- | |
| 821 | 821 | " call operations.\n"; |
| 822 | 822 | |
| 823 | 823 | |
| 824 | static int handle_shutdown_now(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 824 | static int handle_shutdown_now(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 825 | 825 | { |
| 826 | 826 | CW_UNUSED(argv); |
| 827 | 827 | |
| --- | --- | |
| 833 | 833 | return RESULT_SUCCESS; |
| 834 | 834 | } |
| 835 | 835 | |
| 836 | static int handle_shutdown_gracefully(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 836 | static int handle_shutdown_gracefully(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 837 | 837 | { |
| 838 | 838 | int timeout = -1; |
| 839 | 839 | |
| --- | --- | |
| 848 | 848 | return RESULT_SUCCESS; |
| 849 | 849 | } |
| 850 | 850 | |
| 851 | static int handle_shutdown_when_convenient(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 851 | static int handle_shutdown_when_convenient(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 852 | 852 | { |
| 853 | 853 | int timeout = -1; |
| 854 | 854 | |
| --- | --- | |
| 863 | 863 | return RESULT_SUCCESS; |
| 864 | 864 | } |
| 865 | 865 | |
| 866 | static int handle_restart_now(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 866 | static int handle_restart_now(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 867 | 867 | { |
| 868 | 868 | CW_UNUSED(argv); |
| 869 | 869 | |
| --- | --- | |
| 875 | 875 | return RESULT_SUCCESS; |
| 876 | 876 | } |
| 877 | 877 | |
| 878 | static int handle_restart_gracefully(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 878 | static int handle_restart_gracefully(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 879 | 879 | { |
| 880 | 880 | int timeout = -1; |
| 881 | 881 | |
| --- | --- | |
| 890 | 890 | return RESULT_SUCCESS; |
| 891 | 891 | } |
| 892 | 892 | |
| 893 | static int handle_restart_when_convenient(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 893 | static int handle_restart_when_convenient(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 894 | 894 | { |
| 895 | 895 | int timeout = -1; |
| 896 | 896 | |
| --- | --- | |
| 905 | 905 | return RESULT_SUCCESS; |
| 906 | 906 | } |
| 907 | 907 | |
| 908 | static int handle_shutdown_restart_cancel(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 908 | static int handle_shutdown_restart_cancel(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 909 | 909 | { |
| 910 | 910 | CW_UNUSED(argv); |
| 911 | 911 | |
| --- | --- | |
| 917 | 917 | return RESULT_SUCCESS; |
| 918 | 918 | } |
| 919 | 919 | |
| 920 | static int handle_shutdown_restart_status(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 920 | static int handle_shutdown_restart_status(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 921 | 921 | { |
| 922 | 922 | CW_UNUSED(argv); |
| 923 | 923 | |
| --- | --- | |
| 928 | 928 | return RESULT_SUCCESS; |
| 929 | 929 | } |
| 930 | 930 | |
| 931 | static int core_dump(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 931 | static int core_dump(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 932 | 932 | { |
| 933 | struct cw_dynstr *ds = NULL; | |
| 933 | struct cw_dynstr ds = CW_DYNSTR_INIT; | |
| 934 | 934 | int res; |
| 935 | 935 | |
| 936 | 936 | CW_UNUSED(ds_p); |
| --- | --- | |
| 949 | 949 | "EOF\n", |
| 950 | 950 | _argv[0], cw_mainpid); |
| 951 | 951 | |
| 952 | if (ds) { | |
| 953 | if (!ds->error) { | |
| 954 | cw_safe_system(ds->data); | |
| 955 | res = RESULT_SUCCESS; | |
| 956 | } | |
| 957 | ||
| 958 | cw_dynstr_free(&ds); | |
| 952 | if (!ds.error) { | |
| 953 | cw_safe_system(ds.data); | |
| 954 | res = RESULT_SUCCESS; | |
| 959 | 955 | } |
| 960 | 956 | |
| 957 | cw_dynstr_free(&ds); | |
| 958 | ||
| 961 | 959 | if (unlikely(res != RESULT_SUCCESS)) |
| 962 | 960 | cw_log(CW_LOG_ERROR, "Out of memory!\n"); |
| 963 | 961 | } |
| --- | --- | |
| 966 | 964 | |
| 967 | 965 | } |
| 968 | 966 | |
| 969 | static int core_analyse(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 967 | static int core_analyse(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 970 | 968 | { |
| 971 | 969 | char buf[1024]; |
| 972 | struct cw_dynstr *cmd = NULL; | |
| 970 | struct cw_dynstr cmd = CW_DYNSTR_INIT; | |
| 973 | 971 | FILE *fd; |
| 974 | 972 | int i; |
| 975 | 973 | |
| --- | --- | |
| 995 | 993 | |
| 996 | 994 | i = RESULT_FAILURE; |
| 997 | 995 | |
| 998 | if (cmd) { | |
| 999 | if (!cmd->error) { | |
| 1000 | if ((fd = popen(cmd->data, "r"))) { | |
| 1001 | while ((i = fread(buf, 1, sizeof(buf), fd)) > 0) | |
| 1002 | cw_dynstr_printf(ds_p, "%.*s", i, buf); | |
| 1003 | pclose(fd); | |
| 1004 | } else | |
| 1005 | cw_dynstr_printf(ds_p, "popen: %s\n", strerror(errno)); | |
| 996 | if (!cmd.error) { | |
| 997 | if ((fd = popen(cmd.data, "r"))) { | |
| 998 | while ((i = fread(buf, 1, sizeof(buf), fd)) > 0) | |
| 999 | cw_dynstr_printf(ds_p, "%.*s", i, buf); | |
| 1000 | pclose(fd); | |
| 1001 | } else | |
| 1002 | cw_dynstr_printf(ds_p, "popen: %s\n", strerror(errno)); | |
| 1006 | 1003 | |
| 1007 | i = RESULT_SUCCESS; | |
| 1008 | } | |
| 1009 | ||
| 1010 | cw_dynstr_free(&cmd); | |
| 1004 | i = RESULT_SUCCESS; | |
| 1011 | 1005 | } |
| 1012 | 1006 | |
| 1007 | cw_dynstr_free(&cmd); | |
| 1008 | ||
| 1013 | 1009 | if (unlikely(i != RESULT_SUCCESS)) |
| 1014 | 1010 | cw_log(CW_LOG_ERROR, "Out of memory!\n"); |
| 1015 | 1011 | |
| --- | --- | |
| 1017 | 1013 | } |
| 1018 | 1014 | |
| 1019 | 1015 | |
| 1020 | static int handle_bang(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1016 | static int handle_bang(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1021 | 1017 | { |
| 1022 | 1018 | CW_UNUSED(ds_p); |
| 1023 | 1019 | CW_UNUSED(argc); |
callweaver/trunk/corelib/callweaver_mm.c (unified diff)
| r5560 | r5625 | |
|---|---|---|
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | static int handle_show_memory(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 309 | static int handle_show_memory(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 310 | 310 | { |
| 311 | 311 | char *fn = NULL; |
| 312 | 312 | int x; |
| --- | --- | |
| 369 | 369 | struct file_summary *next; |
| 370 | 370 | }; |
| 371 | 371 | |
| 372 | static int handle_show_memory_summary(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 372 | static int handle_show_memory_summary(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 373 | 373 | { |
| 374 | 374 | char *fn = NULL; |
| 375 | 375 | int x; |
callweaver/trunk/corelib/cdr.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 819 | 819 | static int cdrbe_print(struct cw_object *obj, void *data) |
| 820 | 820 | { |
| 821 | 821 | struct cw_cdrbe *cdrbe = container_of(obj, struct cw_cdrbe, obj); |
| 822 | struct cw_dynstr **ds_p = data; | |
| 822 | struct cw_dynstr *ds_p = data; | |
| 823 | 823 | |
| 824 | 824 | cw_dynstr_printf(ds_p, "CDR registered backend: %s\n", cdrbe->name); |
| 825 | 825 | return 0; |
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | |
| 829 | static int handle_cli_status(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 829 | static int handle_cli_status(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 830 | 830 | { |
| 831 | 831 | CW_UNUSED(argv); |
| 832 | 832 |
callweaver/trunk/corelib/channel.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 240 | 240 | #endif |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | static int show_channeltypes(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 243 | static int show_channeltypes(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 244 | 244 | { |
| 245 | 245 | #define FORMAT "%-10.10s %-30.30s %-12.12s %-12.12s %-12.12s\n" |
| 246 | 246 | struct chanlist *cl; |
| --- | --- | |
| 906 | 906 | |
| 907 | 907 | |
| 908 | 908 | struct complete_channel_args { |
| 909 | struct cw_dynstr **ds_p; | |
| 909 | struct cw_dynstr *ds_p; | |
| 910 | 910 | const char *prefix; |
| 911 | 911 | size_t prefix_len; |
| 912 | 912 | }; |
| --- | --- | |
| 928 | 928 | return 0; |
| 929 | 929 | } |
| 930 | 930 | |
| 931 | void cw_complete_channel(struct cw_dynstr **ds_p, const char *prefix, size_t prefix_len) | |
| 931 | void cw_complete_channel(struct cw_dynstr *ds_p, const char *prefix, size_t prefix_len) | |
| 932 | 932 | { |
| 933 | 933 | struct complete_channel_args args = { |
| 934 | 934 | .ds_p = ds_p, |
callweaver/trunk/corelib/cli.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 159 | 159 | " the next time the driver reads or writes from the channel\n"; |
| 160 | 160 | |
| 161 | 161 | |
| 162 | static int handle_set_verbose(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 162 | static int handle_set_verbose(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 163 | 163 | { |
| 164 | 164 | int val = 0; |
| 165 | 165 | int oldval = 0; |
| --- | --- | |
| 186 | 186 | return RESULT_SUCCESS; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | static int handle_set_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 189 | static int handle_set_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 190 | 190 | { |
| 191 | 191 | int val = 0; |
| 192 | 192 | int oldval = 0; |
| --- | --- | |
| 299 | 299 | return strlen(timestr) ? strdup(timestr) : NULL; |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | static int handle_showuptime(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 302 | static int handle_showuptime(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 303 | 303 | { |
| 304 | 304 | time_t curtime, tmptime; |
| 305 | 305 | char *timestr; |
| --- | --- | |
| 337 | 337 | return RESULT_SUCCESS; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | static int handle_version(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 340 | static int handle_version(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 341 | 341 | { |
| 342 | 342 | CW_UNUSED(argv); |
| 343 | 343 | |
| --- | --- | |
| 361 | 361 | #define VERBOSE_FORMAT_STRING2 "%-20.20s %-20.20s %-16.16s %-4.4s %-7.7s %-12.12s %-15.15s %8.8s %-11.11s %-20.20s\n" |
| 362 | 362 | |
| 363 | 363 | struct handle_chanlist_args { |
| 364 | struct cw_dynstr **ds_p; | |
| 364 | struct cw_dynstr *ds_p; | |
| 365 | 365 | int concise; |
| 366 | 366 | int verbose; |
| 367 | 367 | int numchans; |
| --- | --- | |
| 427 | 427 | return 0; |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | static int handle_chanlist(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 430 | static int handle_chanlist(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 431 | 431 | { |
| 432 | 432 | struct handle_chanlist_args args; |
| 433 | 433 | |
| --- | --- | |
| 487 | 487 | " Disables debugging on a specific channel.\n"; |
| 488 | 488 | |
| 489 | 489 | |
| 490 | static int handle_softhangup(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 490 | static int handle_softhangup(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 491 | 491 | { |
| 492 | 492 | struct cw_channel *c = NULL; |
| 493 | 493 | |
| --- | --- | |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | |
| 508 | static int handle_debuglevel(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 508 | static int handle_debuglevel(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 509 | 509 | { |
| 510 | 510 | const char *filename = "<any>"; |
| 511 | 511 | int newlevel; |
| --- | --- | |
| 528 | 528 | static int debugchan_one(struct cw_object *obj, void *data) |
| 529 | 529 | { |
| 530 | 530 | struct cw_channel *chan = container_of(obj, struct cw_channel, obj); |
| 531 | struct cw_dynstr **ds_p = data; | |
| 531 | struct cw_dynstr *ds_p = data; | |
| 532 | 532 | |
| 533 | 533 | cw_channel_lock(chan); |
| 534 | 534 | |
| --- | --- | |
| 543 | 543 | static int nodebugchan_one(struct cw_object *obj, void *data) |
| 544 | 544 | { |
| 545 | 545 | struct cw_channel *chan = container_of(obj, struct cw_channel, obj); |
| 546 | struct cw_dynstr **ds_p = data; | |
| 546 | struct cw_dynstr *ds_p = data; | |
| 547 | 547 | |
| 548 | 548 | cw_channel_lock(chan); |
| 549 | 549 | |
| --- | --- | |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | /* XXX todo: merge next two functions!!! */ |
| 559 | static int handle_debugchan(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 559 | static int handle_debugchan(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 560 | 560 | { |
| 561 | 561 | struct cw_channel *chan; |
| 562 | 562 | |
| --- | --- | |
| 580 | 580 | return RESULT_SUCCESS; |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | static int handle_nodebugchan(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 583 | static int handle_nodebugchan(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 584 | 584 | { |
| 585 | 585 | struct cw_channel *chan; |
| 586 | 586 | |
| --- | --- | |
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | |
| 608 | static int handle_showchan(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 608 | static int handle_showchan(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 609 | 609 | { |
| 610 | 610 | char buf[2048]; |
| 611 | 611 | char cdrtime[256]; |
| --- | --- | |
| 699 | 699 | return RESULT_SUCCESS; |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | static void complete_show_channels(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 702 | static void complete_show_channels(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 703 | 703 | { |
| 704 | 704 | static const char *choices[] = { "concise", "verbose" }; |
| 705 | 705 | int i; |
| --- | --- | |
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | |
| 716 | static void complete_ch_3(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 716 | static void complete_ch_3(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 717 | 717 | { |
| 718 | 718 | if (lastarg == 2) |
| 719 | 719 | cw_complete_channel(ds_p, argv[2], lastarg_len); |
| 720 | 720 | } |
| 721 | 721 | |
| 722 | static void complete_ch_4(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 722 | static void complete_ch_4(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 723 | 723 | { |
| 724 | 724 | if (lastarg == 3) |
| 725 | 725 | cw_complete_channel(ds_p, argv[3], lastarg_len); |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | |
| 729 | static int handle_help(struct cw_dynstr **ds_p, int argc, char *argv[]); | |
| 729 | static int handle_help(struct cw_dynstr *ds_p, int argc, char *argv[]); | |
| 730 | 730 | |
| 731 | 731 | static struct cw_clicmd builtins[] = { |
| 732 | 732 | { |
| --- | --- | |
| 843 | 843 | |
| 844 | 844 | struct help_workhorse_args { |
| 845 | 845 | char matchstr[80]; |
| 846 | struct cw_dynstr **ds_p; | |
| 846 | struct cw_dynstr *ds_p; | |
| 847 | 847 | int match; |
| 848 | 848 | }; |
| 849 | 849 | |
| --- | --- | |
| 861 | 861 | return 0; |
| 862 | 862 | } |
| 863 | 863 | |
| 864 | static int help_workhorse(struct cw_dynstr **ds_p, const char *match[]) | |
| 864 | static int help_workhorse(struct cw_dynstr *ds_p, const char *match[]) | |
| 865 | 865 | { |
| 866 | 866 | struct help_workhorse_args args = { |
| 867 | 867 | .match = 0, |
| --- | --- | |
| 878 | 878 | return 0; |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | static int handle_help(struct cw_dynstr **ds_p, int argc, char *argv[]) { | |
| 881 | static int handle_help(struct cw_dynstr *ds_p, int argc, char *argv[]) { | |
| 882 | 882 | struct cw_clicmd *clicmd; |
| 883 | 883 | int ret; |
| 884 | 884 | |
| --- | --- | |
| 970 | 970 | char matchstr[80]; |
| 971 | 971 | char *argv[CW_MAX_ARGS]; |
| 972 | 972 | char *word; |
| 973 | struct cw_dynstr **ds_p; | |
| 973 | struct cw_dynstr *ds_p; | |
| 974 | 974 | int lastarg; |
| 975 | 975 | int lastarg_len; |
| 976 | 976 | }; |
| --- | --- | |
| 997 | 997 | return 0; |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | void cw_cli_generator(struct cw_dynstr **ds_p, char *cmd) | |
| 1000 | void cw_cli_generator(struct cw_dynstr *ds_p, char *cmd) | |
| 1001 | 1001 | { |
| 1002 | 1002 | struct cli_generator_args args = { |
| 1003 | 1003 | .ds_p = ds_p, |
| --- | --- | |
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | 1019 | |
| 1020 | void cw_cli_command(struct cw_dynstr **ds_p, char *cmd) | |
| 1020 | void cw_cli_command(struct cw_dynstr *ds_p, char *cmd) | |
| 1021 | 1021 | { |
| 1022 | 1022 | char *argv[CW_MAX_ARGS]; |
| 1023 | 1023 | struct cw_clicmd *clicmd; |
callweaver/trunk/corelib/config.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 972 | 972 | static int config_engine_print(struct cw_object *obj, void *data) |
| 973 | 973 | { |
| 974 | 974 | struct cw_config_engine *eng = container_of(obj, struct cw_config_engine, obj); |
| 975 | struct cw_dynstr **ds_p = data; | |
| 975 | struct cw_dynstr *ds_p = data; | |
| 976 | 976 | struct cw_config_map *map; |
| 977 | 977 | |
| 978 | 978 | cw_dynstr_printf(ds_p, "Config Engine: %s\n", eng->name); |
| --- | --- | |
| 986 | 986 | return 0; |
| 987 | 987 | } |
| 988 | 988 | |
| 989 | static int config_command(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 989 | static int config_command(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 990 | 990 | { |
| 991 | 991 | CW_UNUSED(argc); |
| 992 | 992 | CW_UNUSED(argv); |
callweaver/trunk/corelib/console.c (unified diff)
| r5620 | r5625 | |
|---|---|---|
| 315 | 315 | static char *key, *val; |
| 316 | 316 | static int lkey, lval = -1; |
| 317 | 317 | static enum { MSG_UNKNOWN, MSG_EVENT, MSG_RESPONSE, MSG_FOLLOWS, MSG_VERSION, MSG_COMPLETION } msgtype; |
| 318 | struct cw_dynstr *ds = NULL; | |
| 318 | struct cw_dynstr ds = CW_DYNSTR_INIT; | |
| 319 | 319 | int ds_lines = 0; |
| 320 | 320 | int level, res, i; |
| 321 | 321 | |
| --- | --- | |
| 534 | 534 | } |
| 535 | 535 | } else { |
| 536 | 536 | if (msgtype == MSG_FOLLOWS) { |
| 537 | if (ds) { | |
| 538 | smart_page((nresp >= 0), ds, ds_lines); | |
| 539 | cw_dynstr_free(&ds); | |
| 540 | ds_lines = 0; | |
| 541 | } | |
| 537 | if (!ds.error) | |
| 538 | smart_page((nresp >= 0), &ds, ds_lines); | |
| 539 | cw_dynstr_free(&ds); | |
| 540 | ds_lines = 0; | |
| 542 | 541 | } |
| 543 | 542 | state = 0; |
| 544 | 543 | msgtype = MSG_UNKNOWN; |
callweaver/trunk/corelib/crypto.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 531 | 531 | cw_mutex_unlock(&keylock); |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | static int show_keys(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 534 | static int show_keys(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 535 | 535 | { |
| 536 | 536 | char sum[16 * 2 + 1]; |
| 537 | 537 | struct cw_key *key; |
| --- | --- | |
| 557 | 557 | return RESULT_SUCCESS; |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | static int init_keys(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 560 | static int init_keys(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 561 | 561 | { |
| 562 | 562 | char tmp[256] = ""; |
| 563 | 563 | struct cw_key *key; |
callweaver/trunk/corelib/db.c (unified diff)
| r5599 | r5625 | |
|---|---|---|
| 89 | 89 | static int get_callback(void *pArg, int argc, char **argv, char **columnNames); |
| 90 | 90 | static int tree_callback(void *pArg, int argc, char **argv, char **columnNames); |
| 91 | 91 | static int show_callback(void *pArg, int argc, char **argv, char **columnNames); |
| 92 | static int database_show(struct cw_dynstr **ds_p, int argc, char *argv[]); | |
| 93 | static int database_put(struct cw_dynstr **ds_p, int argc, char *argv[]); | |
| 94 | static int database_get(struct cw_dynstr **ds_p, int argc, char *argv[]); | |
| 95 | static int database_del(struct cw_dynstr **ds_p, int argc, char *argv[]); | |
| 96 | static int database_deltree(struct cw_dynstr **ds_p, int argc, char *argv[]); | |
| 92 | static int database_show(struct cw_dynstr *ds_p, int argc, char *argv[]); | |
| 93 | static int database_put(struct cw_dynstr *ds_p, int argc, char *argv[]); | |
| 94 | static int database_get(struct cw_dynstr *ds_p, int argc, char *argv[]); | |
| 95 | static int database_del(struct cw_dynstr *ds_p, int argc, char *argv[]); | |
| 96 | static int database_deltree(struct cw_dynstr *ds_p, int argc, char *argv[]); | |
| 97 | 97 | |
| 98 | 98 | |
| 99 | 99 | static int sanity_check(void) |
| --- | --- | |
| 517 | 517 | |
| 518 | 518 | static int show_callback(void *pArg, int argc, char **argv, char **columnNames) |
| 519 | 519 | { |
| 520 | struct cw_dynstr **ds_p = pArg; | |
| 520 | struct cw_dynstr *ds_p = pArg; | |
| 521 | 521 | |
| 522 | 522 | CW_UNUSED(argc); |
| 523 | 523 | CW_UNUSED(columnNames); |
| --- | --- | |
| 527 | 527 | return 0; |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | static int database_show(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 530 | static int database_show(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 531 | 531 | { |
| 532 | 532 | char *prefix, *family; |
| 533 | 533 | char *sql; |
| --- | --- | |
| 590 | 590 | |
| 591 | 591 | |
| 592 | 592 | |
| 593 | static int database_put(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 593 | static int database_put(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 594 | 594 | { |
| 595 | 595 | int res; |
| 596 | 596 | if (argc != 5) |
| --- | --- | |
| 604 | 604 | return RESULT_SUCCESS; |
| 605 | 605 | } |
| 606 | 606 | |
| 607 | static int database_get(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 607 | static int database_get(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 608 | 608 | { |
| 609 | 609 | int res; |
| 610 | 610 | char tmp[256]; |
| --- | --- | |
| 619 | 619 | return RESULT_SUCCESS; |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | static int database_del(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 622 | static int database_del(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 623 | 623 | { |
| 624 | 624 | int res; |
| 625 | 625 | if (argc != 4) |
| --- | --- | |
| 633 | 633 | return RESULT_SUCCESS; |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | static int database_deltree(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 636 | static int database_deltree(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 637 | 637 | { |
| 638 | 638 | int res; |
| 639 | 639 | if ((argc < 3) || (argc > 4)) |
callweaver/trunk/corelib/dynstr.c (unified diff)
| r5620 | r5625 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | * CallWeaver -- An open source telephony toolkit. |
| 3 | 3 | * |
| 4 | * Copyright (C) 2009, Eris Associates Limited, UK | |
| 4 | * Copyright (C) 2009 - 2010, Eris Associates Limited, UK | |
| 5 | 5 | * |
| 6 | 6 | * Mike Jagdis <mjagdis@eris-associates.co.uk> |
| 7 | 7 | * |
| --- | --- | |
| 29 | 29 | #include "callweaver/utils.h" |
| 30 | 30 | |
| 31 | 31 | |
| 32 | int cw_dynstr_grow(struct cw_dynstr **ds_p, size_t len) | |
| 32 | void cw_dynstr_grow(struct cw_dynstr *ds_p, size_t len) | |
| 33 | 33 | { |
| 34 | struct cw_dynstr *nds; | |
| 35 | size_t nsize = sizeof(**ds_p) + len; | |
| 34 | char *ndata; | |
| 36 | 35 | |
| 37 | if ((*ds_p) && (*ds_p)->chunk) | |
| 38 | nsize = (nsize | (*ds_p)->chunk) + 1; | |
| 36 | len = (len | ds_p->chunk) + 1; | |
| 39 | 37 | |
| 40 | if ((nds = realloc(*ds_p, nsize))) { | |
| 41 | nds->size = nsize - sizeof(**ds_p); | |
| 42 | if (!(*ds_p)) { | |
| 43 | nds->chunk = CW_DYNSTR_DEFAULT_CHUNK; | |
| 44 | nds->used = nds->error = 0; | |
| 45 | } | |
| 46 | *ds_p = nds; | |
| 47 | return 0; | |
| 48 | } | |
| 49 | ||
| 50 | if ((*ds_p)) | |
| 51 | (*ds_p)->error = 1; | |
| 52 | return 1; | |
| 38 | if ((ndata = realloc(ds_p->data, len))) { | |
| 39 | ds_p->size = len; | |
| 40 | ds_p->data = ndata; | |
| 41 | } else | |
| 42 | ds_p->error = 1; | |
| 53 | 43 | } |
| 54 | 44 | |
| 55 | 45 | |
| 56 | int cw_dynstr_vprintf(struct cw_dynstr **ds_p, const char *fmt, va_list ap) | |
| 46 | int cw_dynstr_vprintf(struct cw_dynstr *ds_p, const char *fmt, va_list ap) | |
| 57 | 47 | { |
| 58 | while (!(*ds_p) || !(*ds_p)->error) { | |
| 48 | while (!ds_p->error) { | |
| 59 | 49 | va_list aq; |
| 60 | 50 | char *data; |
| 61 | 51 | size_t size; |
| 62 | 52 | size_t used; |
| 63 | 53 | |
| 64 | data = NULL; | |
| 65 | size = 0; | |
| 66 | if (*ds_p) { | |
| 67 | data = (*ds_p)->data + (*ds_p)->used; | |
| 68 | size = (*ds_p)->size - (*ds_p)->used; | |
| 69 | } | |
| 54 | data = ds_p->data + ds_p->used; | |
| 55 | size = ds_p->size - ds_p->used; | |
| 70 | 56 | |
| 71 | 57 | va_copy(aq, ap); |
| 72 | 58 | used = vsnprintf(data, size, fmt, aq); |
| --- | --- | |
| 76 | 62 | * buffer isn't big enough. If we can even compile with such a beast at |
| 77 | 63 | * all we should have a compile time check for this. |
| 78 | 64 | */ |
| 79 | if (unlikely(used < 0)) | |
| 65 | if (unlikely((int)used == -1)) | |
| 80 | 66 | used = size + 255; |
| 81 | 67 | |
| 82 | if (*ds_p) { | |
| 83 | used += (*ds_p)->used; | |
| 68 | used += ds_p->used; | |
| 84 | 69 | |
| 85 | if (used < (*ds_p)->size) { | |
| 86 | (*ds_p)->used = used; | |
| 87 | break; | |
| 88 | } | |
| 70 | if (used < ds_p->size) { | |
| 71 | ds_p->used = used; | |
| 72 | break; | |
| 89 | 73 | } |
| 90 | 74 | |
| 91 | 75 | cw_dynstr_grow(ds_p, used + 1); |
| 92 | if (!(*ds_p)) | |
| 93 | break; | |
| 94 | 76 | } |
| 95 | 77 | |
| 96 | return !(*ds_p) || (*ds_p)->error; | |
| 78 | return ds_p->error; | |
| 97 | 79 | } |
| 98 | 80 | |
| 99 | int cw_dynstr_printf(struct cw_dynstr **ds_p, const char *fmt, ...) | |
| 81 | int cw_dynstr_printf(struct cw_dynstr *ds_p, const char *fmt, ...) | |
| 100 | 82 | { |
| 101 | 83 | va_list ap; |
| 102 | 84 | int ret; |
callweaver/trunk/corelib/features.c (unified diff)
| r5600 | r5625 | |
|---|---|---|
| 1902 | 1902 | return res; |
| 1903 | 1903 | } |
| 1904 | 1904 | |
| 1905 | static int handle_showfeatures(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1905 | static int handle_showfeatures(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1906 | 1906 | { |
| 1907 | 1907 | int i; |
| 1908 | 1908 | int fcount; |
| --- | --- | |
| 1963 | 1963 | .usage = showfeatures_help, |
| 1964 | 1964 | }; |
| 1965 | 1965 | |
| 1966 | static int handle_parkedcalls(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1966 | static int handle_parkedcalls(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1967 | 1967 | { |
| 1968 | 1968 | struct parkeduser *cur; |
| 1969 | 1969 | int numparked = 0; |
callweaver/trunk/corelib/file.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 1142 | 1142 | #define FORMAT2 "%-10s %-10s %-20s\n" |
| 1143 | 1143 | |
| 1144 | 1144 | struct show_file_formats_args { |
| 1145 | struct cw_dynstr **ds_p; | |
| 1145 | struct cw_dynstr *ds_p; | |
| 1146 | 1146 | int count; |
| 1147 | 1147 | }; |
| 1148 | 1148 | |
| --- | --- | |
| 1156 | 1156 | return 0; |
| 1157 | 1157 | } |
| 1158 | 1158 | |
| 1159 | static int show_file_formats(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1159 | static int show_file_formats(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1160 | 1160 | { |
| 1161 | 1161 | struct show_file_formats_args args = { ds_p, 0 }; |
| 1162 | 1162 |
callweaver/trunk/corelib/frame.c (unified diff)
| r5590 | r5625 | |
|---|---|---|
| 499 | 499 | return ret; |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | static int show_codecs(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 502 | static int show_codecs(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 503 | 503 | { |
| 504 | 504 | int i, found=0; |
| 505 | 505 | char hex[25]; |
| --- | --- | |
| 556 | 556 | "Usage: show [audio|video|image] codecs\n" |
| 557 | 557 | " Displays codec mapping\n"; |
| 558 | 558 | |
| 559 | static int show_codec_n(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 559 | static int show_codec_n(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 560 | 560 | { |
| 561 | 561 | int codec; |
| 562 | 562 | int i; |
callweaver/trunk/corelib/function.c (unified diff)
| r5562 | r5625 | |
|---|---|---|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | |
| 215 | static void complete_show_functions(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 215 | static void complete_show_functions(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 216 | 216 | { |
| 217 | 217 | if (lastarg == 2) { |
| 218 | 218 | if (!strncasecmp(argv[2], "like", lastarg_len)) |
| --- | --- | |
| 224 | 224 | |
| 225 | 225 | |
| 226 | 226 | struct funcs_print_args { |
| 227 | struct cw_dynstr **ds_p; | |
| 227 | struct cw_dynstr *ds_p; | |
| 228 | 228 | int like, describing, matches; |
| 229 | 229 | int argc; |
| 230 | 230 | char **argv; |
| --- | --- | |
| 258 | 258 | return 0; |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | static int handle_show_functions(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 261 | static int handle_show_functions(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 262 | 262 | { |
| 263 | 263 | struct funcs_print_args args = { |
| 264 | 264 | .ds_p = ds_p, |
| --- | --- | |
| 280 | 280 | return RESULT_SUCCESS; |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | static int handle_show_function(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 283 | static int handle_show_function(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 284 | 284 | { |
| 285 | 285 | struct cw_func *acf; |
| 286 | 286 | |
| --- | --- | |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | struct complete_show_func_args { |
| 306 | struct cw_dynstr **ds_p; | |
| 306 | struct cw_dynstr *ds_p; | |
| 307 | 307 | char *word; |
| 308 | 308 | int word_len; |
| 309 | 309 | }; |
| --- | --- | |
| 318 | 318 | |
| 319 | 319 | return 0; |
| 320 | 320 | } |
| 321 | static void complete_show_function(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 321 | static void complete_show_function(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 322 | 322 | { |
| 323 | 323 | struct complete_show_func_args args = { |
| 324 | 324 | .ds_p = ds_p, |
callweaver/trunk/corelib/image.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 178 | 178 | static int imager_print(struct cw_object *obj, void *data) |
| 179 | 179 | { |
| 180 | 180 | struct cw_imager *img = container_of(obj, struct cw_imager, obj); |
| 181 | struct cw_dynstr **ds_p = data; | |
| 181 | struct cw_dynstr *ds_p = data; | |
| 182 | 182 | |
| 183 | 183 | cw_dynstr_printf(ds_p, FORMAT2, img->name, img->exts, img->desc, cw_getformatname(img->format)); |
| 184 | 184 | return 0; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | static int show_image_formats(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 187 | static int show_image_formats(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 188 | 188 | { |
| 189 | 189 | CW_UNUSED(argv); |
| 190 | 190 |
callweaver/trunk/corelib/loader.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 175 | 175 | |
| 176 | 176 | |
| 177 | 177 | struct module_generator_args { |
| 178 | struct cw_dynstr **ds_p; | |
| 178 | struct cw_dynstr *ds_p; | |
| 179 | 179 | const char *name; |
| 180 | 180 | int name_len; |
| 181 | 181 | }; |
| --- | --- | |
| 191 | 191 | return 0; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | static void module_generator(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 194 | static void module_generator(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 195 | 195 | { |
| 196 | 196 | struct module_generator_args args = { |
| 197 | 197 | .ds_p = ds_p, |
| --- | --- | |
| 503 | 503 | |
| 504 | 504 | |
| 505 | 505 | struct handle_modlist_args { |
| 506 | struct cw_dynstr **ds_p; | |
| 506 | struct cw_dynstr *ds_p; | |
| 507 | 507 | int count; |
| 508 | 508 | const char *like; |
| 509 | 509 | }; |
| --- | --- | |
| 522 | 522 | return 0; |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | static int handle_modlist(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 525 | static int handle_modlist(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 526 | 526 | { |
| 527 | 527 | struct handle_modlist_args args = { |
| 528 | 528 | .ds_p = ds_p, |
| --- | --- | |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | |
| 550 | static int handle_load(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 550 | static int handle_load(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 551 | 551 | { |
| 552 | 552 | struct load_module_args args; |
| 553 | 553 | const char *path; |
| --- | --- | |
| 575 | 575 | |
| 576 | 576 | |
| 577 | 577 | struct complete_fn_args { |
| 578 | struct cw_dynstr **ds_p; | |
| 578 | struct cw_dynstr *ds_p; | |
| 579 | 579 | const char *word; |
| 580 | 580 | int word_len; |
| 581 | 581 | }; |
| --- | --- | |
| 592 | 592 | return 0; |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | static void complete_fn(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 595 | static void complete_fn(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 596 | 596 | { |
| 597 | 597 | struct complete_fn_args args; |
| 598 | 598 | char *p; |
| --- | --- | |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | |
| 621 | static int handle_reconfigure(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 621 | static int handle_reconfigure(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 622 | 622 | { |
| 623 | 623 | int x; |
| 624 | 624 | |
| --- | --- | |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | |
| 647 | static void reconfigure_module_generator(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 647 | static void reconfigure_module_generator(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 648 | 648 | { |
| 649 | 649 | static const char *core[] = { |
| 650 | 650 | "extconfig", |
| --- | --- | |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | |
| 668 | static int handle_unload(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 668 | static int handle_unload(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 669 | 669 | { |
| 670 | 670 | int x; |
| 671 | 671 | int hangup = 0; |
callweaver/trunk/corelib/logger.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 145 | 145 | /* The first key-value pair will always be "Event: Log" so we can ignore that here */ |
| 146 | 146 | for (i = 1; i < event->count; i++) { |
| 147 | 147 | if (event->map[(i << 1) + 1] - event->map[(i << 1) + 0] - 2 != sizeof("Message") - 1 |
| 148 | || memcmp(event->data->data + event->map[(i << 1)], "Message", sizeof("Message") - 1)) { | |
| 148 | || memcmp(event->ds.data + event->map[(i << 1)], "Message", sizeof("Message") - 1)) { | |
| 149 | 149 | for (j = 0; j < arraysize(keys); j++) { |
| 150 | 150 | if (event->map[(i << 1) + 1] - event->map[(i << 1)] - 2 == keys[j].l |
| 151 | && !strncmp(event->data->data + event->map[(i << 1)], keys[j].s, keys[j].l)) { | |
| 152 | iov[keys[j].i_iov].iov_base = event->data->data + event->map[(i << 1) + 1]; | |
| 151 | && !strncmp(event->ds.data + event->map[(i << 1)], keys[j].s, keys[j].l)) { | |
| 152 | iov[keys[j].i_iov].iov_base = event->ds.data + event->map[(i << 1) + 1]; | |
| 153 | 153 | iov[keys[j].i_iov].iov_len = event->map[(i << 1) + 2] - event->map[(i << 1) + 1] - 2; |
| 154 | 154 | break; |
| 155 | 155 | } |
| --- | --- | |
| 165 | 165 | level = atol(iov[1].iov_base); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | p = event->data->data + event->map[(i << 1) + 1] + 2; | |
| 168 | p = event->ds.data + event->map[(i << 1) + 1] + 2; | |
| 169 | 169 | j = event->map[(i << 1) + 2] - event->map[(i << 1) + 1] - 2 - (sizeof("--END MESSAGE--\r\n") - 1); |
| 170 | 170 | while (j > 0) { |
| 171 | 171 | n = strcspn(p, "\r\n"); |
| --- | --- | |
| 483 | 483 | return -1; |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | static int handle_logger_reload(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 486 | static int handle_logger_reload(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 487 | 487 | { |
| 488 | 488 | CW_UNUSED(argc); |
| 489 | 489 | CW_UNUSED(argv); |
| --- | --- | |
| 495 | 495 | return RESULT_SUCCESS; |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | static int handle_logger_rotate(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 498 | static int handle_logger_rotate(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 499 | 499 | { |
| 500 | 500 | CW_UNUSED(argc); |
| 501 | 501 | CW_UNUSED(argv); |
| --- | --- | |
| 510 | 510 | |
| 511 | 511 | /*--- handle_logger_show_channels: CLI command to show logging system |
| 512 | 512 | configuration */ |
| 513 | static int handle_logger_show_channels(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 513 | static int handle_logger_show_channels(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 514 | 514 | { |
| 515 | 515 | #define FORMATL "%-35.35s %-8.8s" |
| 516 | 516 | struct logchannel *chan; |
callweaver/trunk/corelib/manager.c (unified diff)
| r5620 | r5625 | |
|---|---|---|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
| 154 | static int printf_authority(struct cw_dynstr **ds_p, int authority) | |
| 154 | static int printf_authority(struct cw_dynstr *ds_p, int authority) | |
| 155 | 155 | { |
| 156 | 156 | int i, used, sep = 0; |
| 157 | 157 | |
| --- | --- | |
| 222 | 222 | int q_w_next; |
| 223 | 223 | int ret = -1; |
| 224 | 224 | |
| 225 | if (*resp_p && (*resp_p)->data) { | |
| 226 | if (!(*resp_p)->data->error && (!req || !req->actionid || !cw_manager_msg(resp_p, 1, cw_msg_tuple("ActionID", "%s", req->actionid)))) { | |
| 225 | if (*resp_p) { | |
| 226 | if (!(*resp_p)->ds.error && (!req || !req->actionid || !cw_manager_msg(resp_p, 1, cw_msg_tuple("ActionID", "%s", req->actionid)))) { | |
| 227 | 227 | pthread_cleanup_push((void (*)(void *))pthread_mutex_unlock, &sess->lock); |
| 228 | 228 | pthread_mutex_lock(&sess->lock); |
| 229 | 229 | |
| --- | --- | |
| 309 | 309 | |
| 310 | 310 | |
| 311 | 311 | struct complete_show_manact_args { |
| 312 | struct cw_dynstr **ds_p; | |
| 312 | struct cw_dynstr *ds_p; | |
| 313 | 313 | char *word; |
| 314 | 314 | int word_len; |
| 315 | 315 | }; |
| --- | --- | |
| 325 | 325 | return 0; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | static void complete_show_manact(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 328 | static void complete_show_manact(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 329 | 329 | { |
| 330 | 330 | struct complete_show_manact_args args = { |
| 331 | 331 | .ds_p = ds_p, |
| --- | --- | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | |
| 340 | static int handle_show_manact(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 340 | static int handle_show_manact(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 341 | 341 | { |
| 342 | 342 | struct cw_object *it; |
| 343 | 343 | struct manager_action *act; |
| --- | --- | |
| 366 | 366 | " Prints a listing of all the available CallWeaver manager interface commands.\n"; |
| 367 | 367 | |
| 368 | 368 | |
| 369 | static void complete_show_manacts(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 369 | static void complete_show_manacts(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 370 | 370 | { |
| 371 | 371 | if (lastarg == 3) { |
| 372 | 372 | if (!strncasecmp(argv[3], "like", lastarg_len)) |
| --- | --- | |
| 378 | 378 | |
| 379 | 379 | |
| 380 | 380 | struct manacts_print_args { |
| 381 | struct cw_dynstr **ds_p; | |
| 381 | struct cw_dynstr *ds_p; | |
| 382 | 382 | int like, describing, matches; |
| 383 | 383 | int argc; |
| 384 | 384 | char **argv; |
| --- | --- | |
| 422 | 422 | return 0; |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | static int handle_show_manacts(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 425 | static int handle_show_manacts(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 426 | 426 | { |
| 427 | 427 | struct manacts_print_args args = { |
| 428 | 428 | .ds_p = ds_p, |
| --- | --- | |
| 456 | 456 | |
| 457 | 457 | |
| 458 | 458 | struct listener_print_args { |
| 459 | struct cw_dynstr **ds_p; | |
| 459 | struct cw_dynstr *ds_p; | |
| 460 | 460 | }; |
| 461 | 461 | |
| 462 | 462 | #define MANLISTEN_FORMAT "%-10s %s\n" |
| --- | --- | |
| 477 | 477 | return 0; |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | static int handle_show_listener(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 480 | static int handle_show_listener(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 481 | 481 | { |
| 482 | 482 | struct listener_print_args args = { |
| 483 | 483 | .ds_p = ds_p, |
| --- | --- | |
| 503 | 503 | |
| 504 | 504 | |
| 505 | 505 | struct mansess_print_args { |
| 506 | struct cw_dynstr **ds_p; | |
| 506 | struct cw_dynstr *ds_p; | |
| 507 | 507 | }; |
| 508 | 508 | |
| 509 | 509 | #define MANSESS_FORMAT1 "%-40s %-15s %-6s %-9s %-8s\n" |
| --- | --- | |
| 518 | 518 | return 0; |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | static int handle_show_mansess(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 521 | static int handle_show_mansess(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 522 | 522 | { |
| 523 | 523 | struct mansess_print_args args = { |
| 524 | 524 | .ds_p = ds_p, |
| --- | --- | |
| 1103 | 1103 | |
| 1104 | 1104 | if (cmd) { |
| 1105 | 1105 | if ((msg = cw_manager_response("Follows", NULL))) { |
| 1106 | msg->data->used -= 2; | |
| 1106 | msg->ds.used -= 2; | |
| 1107 | 1107 | |
| 1108 | cw_cli_command(&msg->data, cmd); | |
| 1109 | cw_dynstr_printf(&msg->data, "%s--END COMMAND--\r\n\r\n", (msg->data->data[msg->data->used - 1] != '\n' ? "\n" : "")); | |
| 1108 | cw_cli_command(&msg->ds, cmd); | |
| 1109 | cw_dynstr_printf(&msg->ds, "%s--END COMMAND--\r\n\r\n", (msg->ds.data[msg->ds.used - 1] != '\n' ? "\n" : "")); | |
| 1110 | 1110 | } |
| 1111 | 1111 | } else |
| 1112 | 1112 | msg = cw_manager_response("Error", NULL); |
| --- | --- | |
| 1128 | 1128 | |
| 1129 | 1129 | if (cmd) { |
| 1130 | 1130 | if ((msg = cw_manager_response("Completion", NULL))) { |
| 1131 | msg->data->used -= 2; | |
| 1131 | msg->ds.used -= 2; | |
| 1132 | 1132 | |
| 1133 | cw_cli_generator(&msg->data, cmd); | |
| 1134 | cw_dynstr_printf(&msg->data, "--END COMMAND--\r\n\r\n"); | |
| 1133 | cw_cli_generator(&msg->ds, cmd); | |
| 1134 | cw_dynstr_printf(&msg->ds, "--END COMMAND--\r\n\r\n"); | |
| 1135 | 1135 | } |
| 1136 | 1136 | } else |
| 1137 | 1137 | msg = cw_manager_response("Error", NULL); |
| --- | --- | |
| 1615 | 1615 | |
| 1616 | 1616 | int manager_session_ami(struct mansession *sess, const struct cw_manager_message *event) |
| 1617 | 1617 | { |
| 1618 | return cw_write_all(sess->fd, event->data->data, event->data->used); | |
| 1618 | return cw_write_all(sess->fd, event->ds.data, event->ds.used); | |
| 1619 | 1619 | } |
| 1620 | 1620 | |
| 1621 | 1621 | |
| --- | --- | |
| 1820 | 1820 | struct cw_manager_message *it = container_of(obj, struct cw_manager_message, obj); |
| 1821 | 1821 | |
| 1822 | 1822 | cw_object_destroy(it); |
| 1823 | if (it->data) | |
| 1824 | cw_dynstr_free(&it->data); | |
| 1823 | cw_dynstr_free(&it->ds); | |
| 1825 | 1824 | free(it); |
| 1826 | 1825 | } |
| 1827 | 1826 | |
| --- | --- | |
| 1838 | 1837 | *msg_p = msg; |
| 1839 | 1838 | |
| 1840 | 1839 | /* Drop the previous blank line termination marker */ |
| 1841 | msg->data->used -= 2; | |
| 1842 | o_len = msg->data->used; | |
| 1840 | msg->ds.used -= 2; | |
| 1841 | o_len = msg->ds.used; | |
| 1843 | 1842 | |
| 1844 | if (!cw_dynstr_vprintf(&msg->data, fmt, ap)) { | |
| 1843 | if (!cw_dynstr_vprintf(&msg->ds, fmt, ap)) { | |
| 1845 | 1844 | for (i = 0; i < count; i++) { |
| 1846 | 1845 | msg->map[((o_count + i) << 1) + 0] = map[(i << 1) + 0] + o_len; |
| 1847 | 1846 | msg->map[((o_count + i) << 1) + 1] = map[(i << 1) + 1] + o_len; |
| --- | --- | |
| 1867 | 1866 | struct cw_manager_message *msg; |
| 1868 | 1867 | |
| 1869 | 1868 | if ((msg = malloc(sizeof(struct cw_manager_message) + sizeof(msg->map[0]) * ((count << 1) + 1)))) { |
| 1870 | if (!initsize || (msg->data = cw_dynstr_alloc(initsize, chunk))) { | |
| 1871 | cw_object_init(msg, NULL, 1); | |
| 1872 | msg->obj.release = manager_msg_free; | |
| 1873 | msg->data = NULL; | |
| 1874 | ||
| 1875 | if (!cw_dynstr_vprintf(&msg->data, fmt, ap)) { | |
| 1876 | msg->count = count; | |
| 1877 | memcpy(msg->map , map, ((count << 1) + 1) * sizeof(msg->map[0])); | |
| 1878 | goto out; | |
| 1879 | } | |
| 1880 | } | |
| 1881 | ||
| 1882 | /* Out of memory to alloc or expand the dynstr but we can't log it here | |
| 1883 | * because logging it just generates another event that will ultimately | |
| 1884 | * come here and find it's out of memory and will log the fact causing | |
| 1885 | * another event to be generated that will... | |
| 1886 | */ | |
| 1887 | cw_object_put(msg); | |
| 1888 | msg = NULL; | |
| 1869 | cw_object_init(msg, NULL, 1); | |
| 1870 | msg->obj.release = manager_msg_free; | |
| 1871 | cw_dynstr_init(&msg->ds, initsize, chunk); | |
| 1872 | cw_dynstr_vprintf(&msg->ds, fmt, ap); | |
| 1873 | msg->count = count; | |
| 1874 | memcpy(msg->map , map, ((count << 1) + 1) * sizeof(msg->map[0])); | |
| 1889 | 1875 | } |
| 1890 | 1876 | |
| 1891 | out: | |
| 1892 | 1877 | return msg; |
| 1893 | 1878 | } |
| 1894 | 1879 | |
| --- | --- | |
| 1924 | 1909 | struct manager_event_args *args = data; |
| 1925 | 1910 | |
| 1926 | 1911 | if ((it->readperm & args->category) == args->category && (it->send_events & args->category) == args->category) { |
| 1927 | if (args->msg || (args->msg = make_msg(0, 0, args->count, args->map, args->fmt, args->ap))) { | |
| 1912 | if (args->msg || (args->msg = make_msg(0, 1, args->count, args->map, args->fmt, args->ap))) { | |
| 1928 | 1913 | struct cw_manager_message *msg = cw_object_dup(args->msg); |
| 1929 | 1914 | cw_manager_send(it, NULL, &msg); |
| 1930 | 1915 | } |
callweaver/trunk/corelib/pbx.c (unified diff)
| r5597 | r5625 | |
|---|---|---|
| 212 | 212 | static int switch_print(struct cw_object *obj, void *data) |
| 213 | 213 | { |
| 214 | 214 | struct cw_switch *sw = container_of(obj, struct cw_switch, obj); |
| 215 | struct cw_dynstr **ds_p = data; | |
| 215 | struct cw_dynstr *ds_p = data; | |
| 216 | 216 | |
| 217 | 217 | cw_dynstr_printf(ds_p, "%s: %s\n", sw->name, sw->description); |
| 218 | 218 | return 0; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | static int handle_show_switches(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 221 | static int handle_show_switches(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 222 | 222 | { |
| 223 | 223 | CW_UNUSED(argc); |
| 224 | 224 | CW_UNUSED(argv); |
| --- | --- | |
| 230 | 230 | |
| 231 | 231 | /*! \brief handle_show_globals: CLI support for listing global variables */ |
| 232 | 232 | struct handle_show_globals_args { |
| 233 | struct cw_dynstr **ds_p; | |
| 233 | struct cw_dynstr *ds_p; | |
| 234 | 234 | int count; |
| 235 | 235 | }; |
| 236 | 236 | |
| --- | --- | |
| 244 | 244 | return 0; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | static int handle_show_globals(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 247 | static int handle_show_globals(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 248 | 248 | { |
| 249 | 249 | struct handle_show_globals_args args = { |
| 250 | 250 | .ds_p = ds_p, |
| --- | --- | |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /*! \brief CLI support for setting global variables */ |
| 264 | static int handle_set_global(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 264 | static int handle_set_global(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 265 | 265 | { |
| 266 | 266 | if (argc != 4) |
| 267 | 267 | return RESULT_SHOWUSAGE; |
| --- | --- | |
| 2617 | 2617 | */ |
| 2618 | 2618 | |
| 2619 | 2619 | /*! \brief handle_show_hints: CLI support for listing registred dial plan hints */ |
| 2620 | static int handle_show_hints(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2620 | static int handle_show_hints(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2621 | 2621 | { |
| 2622 | 2622 | struct cw_hint *hint; |
| 2623 | 2623 | int num = 0; |
| --- | --- | |
| 2663 | 2663 | /* |
| 2664 | 2664 | * 'show dialplan' CLI command implementation functions ... |
| 2665 | 2665 | */ |
| 2666 | static void complete_show_dialplan_context(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 2666 | static void complete_show_dialplan_context(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 2667 | 2667 | { |
| 2668 | 2668 | struct cw_context *c; |
| 2669 | 2669 | |
| --- | --- | |
| 2694 | 2694 | int extension_existence; |
| 2695 | 2695 | }; |
| 2696 | 2696 | |
| 2697 | static int show_dialplan_helper(struct cw_dynstr **ds_p, char *context, char *exten, struct dialplan_counters *dpc, struct cw_include *rinclude, int includecount, char *includes[]) | |
| 2697 | static int show_dialplan_helper(struct cw_dynstr *ds_p, char *context, char *exten, struct dialplan_counters *dpc, struct cw_include *rinclude, int includecount, char *includes[]) | |
| 2698 | 2698 | { |
| 2699 | 2699 | struct cw_context *c; |
| 2700 | 2700 | int res=0, old_total_exten = dpc->total_exten; |
| --- | --- | |
| 2918 | 2918 | return res; |
| 2919 | 2919 | } |
| 2920 | 2920 | |
| 2921 | static int handle_show_dialplan(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2921 | static int handle_show_dialplan(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2922 | 2922 | { |
| 2923 | 2923 | char *exten = NULL, *context = NULL; |
| 2924 | 2924 | /* Variables used for different counters */ |
callweaver/trunk/corelib/rtp.c (unified diff)
| r5596 | r5625 | |
|---|---|---|
| 2209 | 2209 | return CW_BRIDGE_FAILED; |
| 2210 | 2210 | } |
| 2211 | 2211 | |
| 2212 | static int rtp_do_debug_ip(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2212 | static int rtp_do_debug_ip(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2213 | 2213 | { |
| 2214 | 2214 | struct hostent *hp; |
| 2215 | 2215 | struct cw_hostent ahp; |
| --- | --- | |
| 2240 | 2240 | return RESULT_SUCCESS; |
| 2241 | 2241 | } |
| 2242 | 2242 | |
| 2243 | static int rtp_do_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2243 | static int rtp_do_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2244 | 2244 | { |
| 2245 | 2245 | if (argc != 2) |
| 2246 | 2246 | { |
| --- | --- | |
| 2254 | 2254 | return RESULT_SUCCESS; |
| 2255 | 2255 | } |
| 2256 | 2256 | |
| 2257 | static int rtp_no_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2257 | static int rtp_no_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2258 | 2258 | { |
| 2259 | 2259 | CW_UNUSED(argv); |
| 2260 | 2260 |
callweaver/trunk/corelib/stun.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 443 | 443 | |
| 444 | 444 | /* ************************************************************************* */ |
| 445 | 445 | |
| 446 | int stun_do_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 446 | int stun_do_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 447 | 447 | { |
| 448 | 448 | CW_UNUSED(argv); |
| 449 | 449 | |
| --- | --- | |
| 455 | 455 | return RESULT_SUCCESS; |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | int stun_no_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 458 | int stun_no_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 459 | 459 | { |
| 460 | 460 | CW_UNUSED(argv); |
| 461 | 461 |
callweaver/trunk/corelib/translate.c (unified diff)
| r5590 | r5625 | |
|---|---|---|
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | |
| 889 | static void show_translation_generator(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 889 | static void show_translation_generator(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 890 | 890 | { |
| 891 | 891 | static const char *args[] = { |
| 892 | 892 | "recalc", "rel", "raw", "ns", "us", "ms" |
| --- | --- | |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | 901 | |
| 902 | static int show_translation(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 902 | static int show_translation(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 903 | 903 | { |
| 904 | 904 | static const char *scale[] = { "nano", "micro", "milli", "" }; |
| 905 | 905 | struct trans_state *tr; |
callweaver/trunk/corelib/udptl.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 698 | 698 | return CW_BRIDGE_FAILED; |
| 699 | 699 | } |
| 700 | 700 | |
| 701 | static int udptl_do_debug_ip(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 701 | static int udptl_do_debug_ip(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 702 | 702 | { |
| 703 | 703 | struct hostent *hp; |
| 704 | 704 | struct cw_hostent ahp; |
| --- | --- | |
| 732 | 732 | return RESULT_SUCCESS; |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | static int udptl_do_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 735 | static int udptl_do_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 736 | 736 | { |
| 737 | 737 | if (argc != 2) |
| 738 | 738 | { |
| --- | --- | |
| 746 | 746 | return RESULT_SUCCESS; |
| 747 | 747 | } |
| 748 | 748 | |
| 749 | static int udptl_no_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 749 | static int udptl_no_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 750 | 750 | { |
| 751 | 751 | CW_UNUSED(argv); |
| 752 | 752 | |
| --- | --- | |
| 758 | 758 | return RESULT_SUCCESS; |
| 759 | 759 | } |
| 760 | 760 | |
| 761 | static int udptl_reload(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 761 | static int udptl_reload(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 762 | 762 | { |
| 763 | 763 | CW_UNUSED(ds_p); |
| 764 | 764 | CW_UNUSED(argv); |
| --- | --- | |
| 770 | 770 | return RESULT_SUCCESS; |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | static int udptl_show_settings(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 773 | static int udptl_show_settings(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 774 | 774 | { |
| 775 | 775 | const char *error_correction_str; |
| 776 | 776 |
callweaver/trunk/include/callweaver/channel.h (unified diff)
| r5590 | r5625 | |
|---|---|---|
| 776 | 776 | #define cw_get_device_by_name_locked(chan) __cw_get_by_name_locked(&device_registry, chan) |
| 777 | 777 | #endif |
| 778 | 778 | |
| 779 | extern CW_API_PUBLIC void cw_complete_channel(struct cw_dynstr **ds_p, const char *prefix, size_t prefix_len); | |
| 779 | extern CW_API_PUBLIC void cw_complete_channel(struct cw_dynstr *ds_p, const char *prefix, size_t prefix_len); | |
| 780 | 780 | |
| 781 | 781 | /*! Get channel by name prefix (locks channel) */ |
| 782 | 782 | #ifdef DEBUG_MUTEX |
callweaver/trunk/include/callweaver/cli.h (unified diff)
| r5562 | r5625 | |
|---|---|---|
| 53 | 53 | /*! Null terminated list of the words of the command */ |
| 54 | 54 | const char *cmda[CW_MAX_CMD_LEN]; |
| 55 | 55 | /*! Handler for the command (fd for output, # of arguments, argument list). Returns RESULT_SHOWUSAGE for improper arguments */ |
| 56 | int (*handler)(struct cw_dynstr **ds_p, int argc, char *argv[]); | |
| 56 | int (*handler)(struct cw_dynstr *ds_p, int argc, char *argv[]); | |
| 57 | 57 | /*! Summary of the command (< 60 characters) */ |
| 58 | 58 | const char *summary; |
| 59 | 59 | /*! Detailed usage information */ |
| 60 | 60 | const char *usage; |
| 61 | 61 | /*! Generate a list of possible completions for a given word */ |
| 62 | void (*generator)(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len); | |
| 62 | void (*generator)(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len); | |
| 63 | 63 | }; |
| 64 | 64 | |
| 65 | 65 | |
| --- | --- | |
| 105 | 105 | * |
| 106 | 106 | * Returns 0 on succes, -1 on failure |
| 107 | 107 | */ |
| 108 | extern CW_API_PUBLIC void cw_cli_command(struct cw_dynstr **ds_p, char *cmd); | |
| 108 | extern CW_API_PUBLIC void cw_cli_command(struct cw_dynstr *ds_p, char *cmd); | |
| 109 | 109 | |
| 110 | 110 | /*! \brief Readline madness |
| 111 | 111 | * |
| --- | --- | |
| 113 | 113 | * |
| 114 | 114 | * Returns 0 on success, -1 on failure |
| 115 | 115 | */ |
| 116 | extern void cw_cli_generator(struct cw_dynstr **ds_p, char *cmd); | |
| 116 | extern void cw_cli_generator(struct cw_dynstr *ds_p, char *cmd); | |
| 117 | 117 | |
| 118 | 118 | extern void cw_cli_init(void); |
| 119 | 119 |
callweaver/trunk/include/callweaver/dynstr.h (unified diff)
| r5624 | r5625 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | * CallWeaver -- An open source telephony toolkit. |
| 3 | 3 | * |
| 4 | * Copyright (C) 2009, Eris Associates Limited, UK | |
| 4 | * Copyright (C) 2009 - 2010, Eris Associates Limited, UK | |
| 5 | 5 | * |
| 6 | 6 | * Mike Jagdis <mjagdis@eris-associates.co.uk> |
| 7 | 7 | * |
| --- | --- | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | struct cw_dynstr { |
| 34 | size_t size, chunk, used; | |
| 34 | size_t used, size, chunk; | |
| 35 | 35 | unsigned char error:1; |
| 36 | char data[0]; | |
| 36 | char *data; | |
| 37 | 37 | }; |
| 38 | 38 | |
| 39 | /* \brief Static initializer for a dynamic string. */ | |
| 40 | #define CW_DYNSTR_INIT { \ | |
| 41 | .used = 0, \ | |
| 42 | .size = 0, \ | |
| 43 | .chunk = CW_DYNSTR_DEFAULT_CHUNK, \ | |
| 44 | .error = 0, \ | |
| 45 | .data = NULL, \ | |
| 46 | } | |
| 39 | 47 | |
| 40 | /*! \brief Allocate a new dynamic string | |
| 48 | ||
| 49 | /*! \brief Initialize a new dynamic string. | |
| 41 | 50 | * |
| 51 | * \param ds_p dynamic string to initialize | |
| 42 | 52 | * \param len initial length |
| 43 | * \param chunk allocations are rounded up to a multiple of this if non zero | |
| 44 | * (this MUST be a power of 2) | |
| 53 | * \param chunk allocations are rounded up to a multiple of this | |
| 54 | * (this MUST be a power of 2 and non-zero) | |
| 45 | 55 | */ |
| 46 | static inline struct cw_dynstr *cw_dynstr_alloc(size_t len, size_t chunk) | |
| 56 | static inline void cw_dynstr_init(struct cw_dynstr *ds_p, size_t len, size_t chunk) | |
| 47 | 57 | { |
| 48 | struct cw_dynstr *ds; | |
| 58 | ds_p->used = 0; | |
| 59 | ds_p->size = 0; | |
| 60 | ds_p->chunk = chunk - 1; | |
| 61 | ds_p->error = 0; | |
| 62 | ds_p->data = NULL; | |
| 49 | 63 | |
| 50 | if ((ds = malloc(sizeof(*ds) + len))) { | |
| 51 | ds->size = len; | |
| 52 | ds->chunk = chunk - 1; | |
| 53 | ds->used = 0; | |
| 54 | ds->error = 0; | |
| 55 | } | |
| 56 | ||
| 57 | return ds; | |
| 64 | /* N.B. We don't set the error flag if this malloc fails because any | |
| 65 | * initial length is just a hint how much might be needed. If this | |
| 66 | * malloc doesn't happen we might still manage to malloc later when | |
| 67 | * the space is actually needed. | |
| 68 | */ | |
| 69 | if (len && (ds_p->data = malloc(len))) | |
| 70 | ds_p->size = len; | |
| 58 | 71 | } |
| 59 | 72 | |
| 60 | 73 | |
| 61 | static inline void cw_dynstr_reset(struct cw_dynstr **ds_p) | |
| 74 | /* \brief Reset a dynamic string to contain nothing but do NOT release | |
| 75 | * the memory associated with it. | |
| 76 | * | |
| 77 | * \param ds_p dynamic string to reset | |
| 78 | */ | |
| 79 | static inline void cw_dynstr_reset(struct cw_dynstr *ds_p) | |
| 62 | 80 | __attribute__ ((nonnull (1))); |
| 63 | 81 | |
| 64 | static inline void cw_dynstr_reset(struct cw_dynstr **ds_p) | |
| 82 | static inline void cw_dynstr_reset(struct cw_dynstr *ds_p) | |
| 65 | 83 | { |
| 66 | if (*ds_p) | |
| 67 | (*ds_p)->used = (*ds_p)->error = 0; | |
| 84 | ds_p->used = ds_p->error = 0; | |
| 68 | 85 | } |
| 69 | 86 | |
| 70 | 87 | |
| 71 | extern CW_API_PUBLIC int cw_dynstr_grow(struct cw_dynstr **ds_p, size_t len) | |
| 88 | /* \brief Grow the space allocated for a dynamic string to be at least the given size. | |
| 89 | * | |
| 90 | * \param ds_p dynamic string to reset | |
| 91 | * \param len minimum allocation required | |
| 92 | */ | |
| 93 | extern CW_API_PUBLIC void cw_dynstr_grow(struct cw_dynstr *ds_p, size_t len) | |
| 72 | 94 | __attribute__ ((nonnull (1))); |
| 73 | 95 | |
| 74 | 96 | |
| 75 | static inline int cw_dynstr_need(struct cw_dynstr **ds_p, size_t len) | |
| 97 | /* \brief Make sure a dynamic string has at least the given amount of free space | |
| 98 | * already allocated. | |
| 99 | * | |
| 100 | * \param ds_p dynamic string to reset | |
| 101 | * \param len minimum free space required | |
| 102 | */ | |
| 103 | static inline void cw_dynstr_need(struct cw_dynstr *ds_p, size_t len) | |
| 76 | 104 | __attribute__ ((nonnull (1))); |
| 77 | 105 | |
| 78 | static inline int cw_dynstr_need(struct cw_dynstr **ds_p, size_t len) | |
| 106 | static inline void cw_dynstr_need(struct cw_dynstr *ds_p, size_t len) | |
| 79 | 107 | { |
| 80 | if (*ds_p) | |
| 81 | len += (*ds_p)->used; | |
| 82 | if (!(*ds_p) || len > (*ds_p)->size) | |
| 108 | len += ds_p->used; | |
| 109 | if (len > ds_p->size) | |
| 83 | 110 | cw_dynstr_grow(ds_p, len); |
| 84 | return !(*ds_p) || (*ds_p)->error; | |
| 85 | 111 | } |
| 86 | 112 | |
| 87 | 113 | |
| 88 | static inline void cw_dynstr_free(struct cw_dynstr **ds_p) | |
| 114 | /* \brief Reset a dynamic string to contain nothing and release all memory | |
| 115 | * that has been allocated to it. | |
| 116 | * | |
| 117 | * \param ds_p dynamic string to free | |
| 118 | */ | |
| 119 | static inline void cw_dynstr_free(struct cw_dynstr *ds_p) | |
| 89 | 120 | __attribute__ ((nonnull (1))); |
| 90 | 121 | |
| 91 | static inline void cw_dynstr_free(struct cw_dynstr **ds_p) | |
| 122 | static inline void cw_dynstr_free(struct cw_dynstr *ds_p) | |
| 92 | 123 | { |
| 93 | if (*ds_p) { | |
| 94 | free(*ds_p); | |
| 95 | *ds_p = NULL; | |
| 124 | if (ds_p->data) { | |
| 125 | free(ds_p->data); | |
| 126 | ds_p->used = ds_p->size = ds_p->error = 0; | |
| 127 | ds_p->data = NULL; | |
| 96 | 128 | } |
| 97 | 129 | } |
| 98 | 130 | |
| 99 | 131 | |
| 100 | extern CW_API_PUBLIC int cw_dynstr_vprintf(struct cw_dynstr **ds_p, const char *fmt, va_list ap) | |
| 132 | extern CW_API_PUBLIC int cw_dynstr_vprintf(struct cw_dynstr *ds_p, const char *fmt, va_list ap) | |
| 101 | 133 | __attribute__ ((__nonnull__ (1,2))); |
| 102 | extern CW_API_PUBLIC int cw_dynstr_printf(struct cw_dynstr **ds_p, const char *fmt, ...) | |
| 134 | extern CW_API_PUBLIC int cw_dynstr_printf(struct cw_dynstr *ds_p, const char *fmt, ...) | |
| 103 | 135 | __attribute__ ((__nonnull__ (1,2), __format__ (printf, 2,3))); |
| 104 | 136 | |
| 105 | 137 | |
| --- | --- | |
| 150 | 182 | * so you get accurate line numbers for errors and warnings but then |
| 151 | 183 | * the compiled code will have references to non-existent functions. |
| 152 | 184 | */ |
| 153 | static __inline__ int cw_dynstr_tprintf(struct cw_dynstr **ds_p, size_t count, ...) | |
| 185 | static __inline__ int cw_dynstr_tprintf(struct cw_dynstr *ds_p, size_t count, ...) | |
| 154 | 186 | __attribute__ ((always_inline, const, unused, no_instrument_function, nonnull (1))); |
| 155 | static __inline__ int cw_dynstr_tprintf(struct cw_dynstr **ds_p __attribute__((unused)), size_t count __attribute__((unused)), ...) | |
| 187 | static __inline__ int cw_dynstr_tprintf(struct cw_dynstr *ds_p __attribute__((unused)), size_t count __attribute__((unused)), ...) | |
| 156 | 188 | { |
| 157 | 189 | return 0; |
| 158 | 190 | } |
| --- | --- | |
| 182 | 214 | |
| 183 | 215 | #else |
| 184 | 216 | |
| 185 | extern int cw_dynstr_tprintf(struct cw_dynstr **ds_p, size_t count, ...) | |
| 217 | extern int cw_dynstr_tprintf(struct cw_dynstr *ds_p, size_t count, ...) | |
| 186 | 218 | __attribute__ ((__nonnull__ (1))); |
| 187 | 219 | |
| 188 | 220 | extern char *cw_fmtval(const char *fmt, ...) |
callweaver/trunk/include/callweaver/icd/icd_caller.h (unified diff)
| r5562 | r5625 | |
|---|---|---|
| 148 | 148 | icd_member *icd_caller__get_member_for_distributor(icd_caller * that, icd_distributor * dist); |
| 149 | 149 | |
| 150 | 150 | /* Prints the contents of the caller structure to the given file descriptor. */ |
| 151 | icd_status icd_caller__dump(icd_caller * that, int verbosity, struct cw_dynstr **ds_p); | |
| 151 | icd_status icd_caller__dump(icd_caller * that, int verbosity, struct cw_dynstr *ds_p); | |
| 152 | 152 | |
| 153 | 153 | /* Start the caller thread. */ |
| 154 | 154 | icd_status icd_caller__start_caller_response(icd_caller * that); |
| --- | --- | |
| 363 | 363 | |
| 364 | 364 | /* Set the dump function for this caller */ |
| 365 | 365 | icd_status icd_caller__set_dump_fn(icd_caller * that, icd_status(*dump_fn) (icd_caller * caller, int verbosity, |
| 366 | struct cw_dynstr **ds_p, const void *extra), const void *extra); | |
| 366 | struct cw_dynstr *ds_p, const void *extra), const void *extra); | |
| 367 | 367 | |
| 368 | 368 | /***** Locking *****/ |
| 369 | 369 | |
| --- | --- | |
| 456 | 456 | icd_status icd_caller__standard_launch_caller(icd_caller * caller); |
| 457 | 457 | |
| 458 | 458 | /* Standard caller dump function */ |
| 459 | icd_status icd_caller__standard_dump(icd_caller * caller, int verbosity, struct cw_dynstr **ds_p, void *extra); | |
| 459 | icd_status icd_caller__standard_dump(icd_caller * caller, int verbosity, struct cw_dynstr *ds_p, void *extra); | |
| 460 | 460 | |
| 461 | 461 | /***** Comparison functions (" all "icd_caller *") *****/ |
| 462 | 462 | int icd_caller__cmp_call_start_time_order(icd_caller * caller1, icd_caller * caller2); |
| --- | --- | |
| 485 | 485 | void icd_caller__dump_debug(icd_caller * that); |
| 486 | 486 | icd_status icd_caller__join_callers(icd_caller * that, icd_caller * associate); |
| 487 | 487 | icd_caller *icd_caller__clone_if_necessary(icd_caller * that); |
| 488 | void icd_caller__dump_debug_fd(icd_caller * that, struct cw_dynstr **ds_p, const char *indent); | |
| 488 | void icd_caller__dump_debug_fd(icd_caller * that, struct cw_dynstr *ds_p, const char *indent); | |
| 489 | 489 | void icd_caller__invalidate(icd_caller * that); |
| 490 | 490 | icd_status icd_caller__fail_bridging(icd_caller * bridger); |
| 491 | 491 | void icd_caller__loop(icd_caller * that, int do_spawn); |
callweaver/trunk/include/callweaver/icd/icd_caller_list.h (unified diff)
| r5562 | r5625 | |
|---|---|---|
| 80 | 80 | int icd_caller_list__caller_position(icd_caller_list * that, icd_caller * target); |
| 81 | 81 | |
| 82 | 82 | /* Prints the contents of the caller structures to the given file descriptor. */ |
| 83 | icd_status icd_caller_list__dump(icd_caller_list * that, int verbosity, struct cw_dynstr **ds_p); | |
| 83 | icd_status icd_caller_list__dump(icd_caller_list * that, int verbosity, struct cw_dynstr *ds_p); | |
| 84 | 84 | |
| 85 | 85 | /* Retrieves a caller from the list when given an id. */ |
| 86 | 86 | icd_caller *icd_caller_list__fetch_caller(icd_caller_list * that, char *id); |
| --- | --- | |
| 141 | 141 | int icd_caller_list__dummy_notify(icd_event * event, void *extra); |
| 142 | 142 | |
| 143 | 143 | /* Standard caller list dump function */ |
| 144 | icd_status icd_caller_list__standard_dump(icd_list * list, int verbosity, struct cw_dynstr **ds_p, void *extra); | |
| 144 | icd_status icd_caller_list__standard_dump(icd_list * list, int verbosity, struct cw_dynstr *ds_p, void *extra); | |
| 145 | 145 | |
| 146 | 146 | #ifdef __cplusplus |
| 147 | 147 | } |
callweaver/trunk/include/callweaver/icd/icd_caller_private.h (unified diff)
| r5562 | r5625 | |
|---|---|---|
| 118 | 118 | icd_plugable_fn_list *plugable_fns_list; /*The List of plugable functions for each dist */ |
| 119 | 119 | |
| 120 | 120 | icd_listeners *listeners; |
| 121 | icd_status(*dump_fn) (icd_caller * caller, int verbosity, struct cw_dynstr **ds_p, const void *extra); | |
| 121 | icd_status(*dump_fn) (icd_caller * caller, int verbosity, struct cw_dynstr *ds_p, const void *extra); | |
| 122 | 122 | const void *dump_fn_extra; |
| 123 | 123 | |
| 124 | 124 | /* Threading and locking */ |
callweaver/trunk/include/callweaver/icd/icd_command.h (unified diff)
| r5590 | r5625 | |
|---|---|---|
| 34 | 34 | |
| 35 | 35 | void create_command_hash(void); |
| 36 | 36 | void destroy_command_hash(void); |
| 37 | int icd_command_register(const char *name, int (*func) (struct cw_dynstr **, int, char **), const char *short_help, const char *syntax_help, const char *long_help); | |
| 38 | int icd_command_cli(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 37 | int icd_command_register(const char *name, int (*func) (struct cw_dynstr *, int, char **), const char *short_help, const char *syntax_help, const char *long_help); | |
| 38 | int icd_command_cli(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 39 | 39 | |
| 40 | 40 | /* all our commands */ |
| 41 | int icd_command_help(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 42 | int icd_command_bad(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 43 | int icd_command_verbose(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 44 | int icd_command_debug(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 45 | int icd_command_show(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 46 | int icd_command_dump(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 47 | int icd_command_list(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 48 | int icd_command_load(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 49 | int icd_command_transfer(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 50 | int icd_command_ack(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 51 | int icd_command_login(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 52 | int icd_command_logout(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 53 | int icd_command_hang_up(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 54 | int icd_command_hangup_channel(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 55 | int icd_command_playback_channel(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 56 | int icd_command_record(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 57 | int icd_command_join_queue(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 58 | int icd_command_control_playback(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 41 | int icd_command_help(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 42 | int icd_command_bad(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 43 | int icd_command_verbose(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 44 | int icd_command_debug(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 45 | int icd_command_show(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 46 | int icd_command_dump(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 47 | int icd_command_list(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 48 | int icd_command_load(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 49 | int icd_command_transfer(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 50 | int icd_command_ack(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 51 | int icd_command_login(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 52 | int icd_command_logout(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 53 | int icd_command_hang_up(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 54 | int icd_command_hangup_channel(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 55 | int icd_command_playback_channel(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 56 | int icd_command_record(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 57 | int icd_command_join_queue(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 58 | int icd_command_control_playback(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 59 | 59 | void icd_manager_send_message( const char *format, ...); |
| 60 | 60 | |
| 61 | 61 |
callweaver/trunk/include/callweaver/icd/icd_distributor.h (unified diff)
| r5560 | r5625 | |
|---|---|---|
| 128 | 128 | icd_status icd_distributor__remove_customer(icd_distributor * that, icd_customer * target); |
| 129 | 129 | |
| 130 | 130 | /* Print out a copy of the distributor. */ |
| 131 | icd_status icd_distributor__dump(icd_distributor * that, int verbosity, struct cw_dynstr **ds_p); | |
| 131 | icd_status icd_distributor__dump(icd_distributor * that, int verbosity, struct cw_dynstr *ds_p); | |
| 132 | 132 | |
| 133 | 133 | /* Start the distributor thread. */ |
| 134 | 134 | icd_status icd_distributor__start_distributing(icd_distributor * that); |
| --- | --- | |
| 191 | 191 | void *extra), void *extra); |
| 192 | 192 | |
| 193 | 193 | icd_status icd_distributor__set_dump_func(icd_distributor * that, icd_status(*dump_fn) (icd_distributor *, |
| 194 | int verbosity, struct cw_dynstr **ds_p, void *extra), void *extra); | |
| 194 | int verbosity, struct cw_dynstr *ds_p, void *extra), void *extra); | |
| 195 | 195 | |
| 196 | 196 | /**** Listeners ****/ |
| 197 | 197 | |
| --- | --- | |
| 226 | 226 | icd_status icd_distributor__link_callers_via_ringall(icd_distributor *, void *); |
| 227 | 227 | |
| 228 | 228 | /* Standard distributor dump function */ |
| 229 | icd_status icd_distributor__standard_dump(icd_distributor * dist, int verbosity, struct cw_dynstr **ds_p, void *extra); | |
| 229 | icd_status icd_distributor__standard_dump(icd_distributor * dist, int verbosity, struct cw_dynstr *ds_p, void *extra); | |
| 230 | 230 | |
| 231 | 231 | /* get a pointer to a named parameter */ |
| 232 | 232 | char *icd_distributor__get_string_value(icd_distributor *, char *); |
callweaver/trunk/include/callweaver/icd/icd_distributor_list.h (unified diff)
| r5560 | r5625 | |
|---|---|---|
| 68 | 68 | icd_distributor *icd_distributor_list__pop(icd_distributor_list * that); |
| 69 | 69 | |
| 70 | 70 | /* Print our a copy of the list */ |
| 71 | icd_status icd_distributor_list__dump(icd_distributor_list * that, struct cw_dynstr **ds_p); | |
| 71 | icd_status icd_distributor_list__dump(icd_distributor_list * that, struct cw_dynstr *ds_p); | |
| 72 | 72 | |
| 73 | 73 | /***** Locking *****/ |
| 74 | 74 |
callweaver/trunk/include/callweaver/icd/icd_distributor_private.h (unified diff)
| r5560 | r5625 | |
|---|---|---|
| 53 | 53 | icd_member_list *agents; |
| 54 | 54 | icd_plugable_fn *(*get_plugable_fn) (icd_caller * caller); |
| 55 | 55 | icd_status(*link_fn) (icd_distributor *, void *extra); |
| 56 | icd_status(*dump_fn) (icd_distributor *, int verbosity, struct cw_dynstr **ds_p, void *extra); | |
| 56 | icd_status(*dump_fn) (icd_distributor *, int verbosity, struct cw_dynstr *ds_p, void *extra); | |
| 57 | 57 | void *(*run_fn) (void *that); |
| 58 | 58 | void *link_fn_extra; |
| 59 | 59 | void *dump_fn_extra; |
callweaver/trunk/include/callweaver/icd/icd_list.h (unified diff)
| r5562 | r5625 | |
|---|---|---|
| 139 | 139 | icd_status icd_list__remove_by_element(icd_list * that, const void *payload); |
| 140 | 140 | |
| 141 | 141 | /* Print out a copy of the list */ |
| 142 | icd_status icd_list__dump(icd_list * that, int verbosity, struct cw_dynstr **ds_p); | |
| 142 | icd_status icd_list__dump(icd_list * that, int verbosity, struct cw_dynstr *ds_p); | |
| 143 | 143 | |
| 144 | 144 | /***** Node behaviours *****/ |
| 145 | 145 | |
| --- | --- | |
| 199 | 199 | |
| 200 | 200 | /* Set the dump function for this list */ |
| 201 | 201 | icd_status icd_list__set_dump_func(icd_list * that, icd_status(*dump_fn) (icd_list * list, int verbosity, |
| 202 | struct cw_dynstr **ds_p, void *extra), void *extra); | |
| 202 | struct cw_dynstr *ds_p, void *extra), void *extra); | |
| 203 | 203 | |
| 204 | 204 | /***** Locking *****/ |
| 205 | 205 | |
| --- | --- | |
| 246 | 246 | icd_list_node *icd_list__insert_ordered(icd_list * that, void *new_elem, void *cmp_fn); |
| 247 | 247 | |
| 248 | 248 | /* Standard caller list dump function */ |
| 249 | icd_status icd_list__standard_dump(icd_list * list, int verbosity, struct cw_dynstr **ds_p, void *extra); | |
| 249 | icd_status icd_list__standard_dump(icd_list * list, int verbosity, struct cw_dynstr *ds_p, void *extra); | |
| 250 | 250 | |
| 251 | 251 | /***** Comparison functions ("void *" are all "icd_list *") *****/ |
| 252 | 252 |
callweaver/trunk/include/callweaver/icd/icd_list_private.h (unified diff)
| r5562 | r5625 | |
|---|---|---|
| 103 | 103 | int (*del_fn) (icd_event * that, void *extra); |
| 104 | 104 | int (*clr_fn) (icd_event * that, void *extra); |
| 105 | 105 | int (*dstry_fn) (icd_event * that, void *extra); |
| 106 | icd_status(*dump_fn) (icd_list * that, int verbosity, struct cw_dynstr **ds_p, void *extra); | |
| 106 | icd_status(*dump_fn) (icd_list * that, int verbosity, struct cw_dynstr *ds_p, void *extra); | |
| 107 | 107 | void *ins_fn_extra; |
| 108 | 108 | void *add_fn_extra; |
| 109 | 109 | void *del_fn_extra; |
callweaver/trunk/include/callweaver/icd/icd_listeners.h (unified diff)
| r5560 | r5625 | |
|---|---|---|
| 73 | 73 | int icd_listeners__notify(icd_listeners * that, icd_event * event); |
| 74 | 74 | |
| 75 | 75 | /* Print the contents of the listener collection. */ |
| 76 | icd_status icd_listeners__dump(icd_listeners * that, struct cw_dynstr **ds_p); | |
| 76 | icd_status icd_listeners__dump(icd_listeners * that, struct cw_dynstr *ds_p); | |
| 77 | 77 | |
| 78 | 78 | #ifdef __cplusplus |
| 79 | 79 | } |
callweaver/trunk/include/callweaver/icd/icd_member.h (unified diff)
| r5560 | r5625 | |
|---|---|---|
| 96 | 96 | icd_status icd_member__increment_answered(icd_member * that); |
| 97 | 97 | |
| 98 | 98 | /* Prints the contents of the member object to the given file descriptor. */ |
| 99 | icd_status icd_member__dump(icd_member * that, int verbosity, struct cw_dynstr **ds_p); | |
| 99 | icd_status icd_member__dump(icd_member * that, int verbosity, struct cw_dynstr *ds_p); | |
| 100 | 100 | |
| 101 | 101 | /* Sort functons for members cast as callers :) */ |
| 102 | 102 | int icd_member__cmp_call_start_time_order(icd_member * arg1, icd_member * arg2); |
| --- | --- | |
| 161 | 161 | |
| 162 | 162 | /* Set the dump function for this list */ |
| 163 | 163 | icd_status icd__member__set_dump_func(icd_member * that, icd_status(*dump_fn) (icd_member * list, int verbosity, |
| 164 | struct cw_dynstr **ds_p, void *extra), void *extra); | |
| 164 | struct cw_dynstr *ds_p, void *extra), void *extra); | |
| 165 | 165 | |
| 166 | 166 | /***** Fields *****/ |
| 167 | 167 | |
| --- | --- | |
| 189 | 189 | /***** Predefined behaviours *****/ |
| 190 | 190 | |
| 191 | 191 | /* Standard member list dump function */ |
| 192 | icd_status icd_member__standard_dump(icd_member * that, int verbosity, struct cw_dynstr **ds_p, void *extra); | |
| 192 | icd_status icd_member__standard_dump(icd_member * that, int verbosity, struct cw_dynstr *ds_p, void *extra); | |
| 193 | 193 | |
| 194 | 194 | #ifdef __cplusplus |
| 195 | 195 | } |
callweaver/trunk/include/callweaver/icd/icd_member_list.h (unified diff)
| r5560 | r5625 | |
|---|---|---|
| 90 | 90 | icd_member *icd_member_list__get_for_caller(icd_member_list * that, icd_caller * caller); |
| 91 | 91 | |
| 92 | 92 | /* Prints the contents of the member structures to the given file descriptor. */ |
| 93 | icd_status icd_member_list__dump(icd_member_list * that, int verbosity, struct cw_dynstr **ds_p); | |
| 93 | icd_status icd_member_list__dump(icd_member_list * that, int verbosity, struct cw_dynstr *ds_p); | |
| 94 | 94 | |
| 95 | 95 | /* Removes a member from the list when given an id, returns success or failure. */ |
| 96 | 96 | icd_status icd_member_list__remove_member(icd_member_list * that, char *id); |
| --- | --- | |
| 124 | 124 | /***** Predefined Behaviours *****/ |
| 125 | 125 | |
| 126 | 126 | /* Standard member list dump function */ |
| 127 | icd_status icd_member_list__standard_dump(icd_list * that, int verbosity, struct cw_dynstr **ds_p, void *extra); | |
| 127 | icd_status icd_member_list__standard_dump(icd_list * that, int verbosity, struct cw_dynstr *ds_p, void *extra); | |
| 128 | 128 | |
| 129 | 129 | #ifdef __cplusplus |
| 130 | 130 | } |
callweaver/trunk/include/callweaver/icd/icd_metalist.h (unified diff)
| r5562 | r5625 | |
|---|---|---|
| 91 | 91 | icd_status icd_metalist__remove_list_by_element(icd_metalist * that, icd_list * target); |
| 92 | 92 | |
| 93 | 93 | /* Prints the contents of the metalist to the given file descriptor. */ |
| 94 | icd_status icd_metalist__dump(icd_metalist * that, struct cw_dynstr **ds_p); | |
| 94 | icd_status icd_metalist__dump(icd_metalist * that, struct cw_dynstr *ds_p); | |
| 95 | 95 | |
| 96 | 96 | /**** Iterator functions ****/ |
| 97 | 97 |
callweaver/trunk/include/callweaver/icd/icd_plugable_fn_list.h (unified diff)
| r5562 | r5625 | |
|---|---|---|
| 80 | 80 | icd_status icd_plugable_fn_remove_all_plugable_fns(icd_plugable_fn_list * that); |
| 81 | 81 | |
| 82 | 82 | /* Prints the contents of the metalist to the given file descriptor. */ |
| 83 | icd_status icd_plugable_fn_list__dump(icd_plugable_fn_list * that, struct cw_dynstr **ds_p); | |
| 83 | icd_status icd_plugable_fn_list__dump(icd_plugable_fn_list * that, struct cw_dynstr *ds_p); | |
| 84 | 84 | |
| 85 | 85 | /* Getter and Setters */ |
| 86 | 86 | int icd_plugable_fn_list_count(icd_plugable_fn_list * that); |
callweaver/trunk/include/callweaver/icd/icd_queue.h (unified diff)
| r5562 | r5625 | |
|---|---|---|
| 128 | 128 | |
| 129 | 129 | |
| 130 | 130 | /* Print out a debug dump of the queue.*/ |
| 131 | icd_status icd_queue__dump(icd_queue * that, int verbosity, struct cw_dynstr **ds_p); | |
| 132 | icd_status icd_queue__standard_dump(icd_queue * that, int verbosity, struct cw_dynstr **ds_p, void *extra); | |
| 131 | icd_status icd_queue__dump(icd_queue * that, int verbosity, struct cw_dynstr *ds_p); | |
| 132 | icd_status icd_queue__standard_dump(icd_queue * that, int verbosity, struct cw_dynstr *ds_p, void *extra); | |
| 133 | 133 | |
| 134 | 134 | /* Print out key Info on Queues for cli UI */ |
| 135 | icd_status icd_queue__show(icd_queue * that, int verbosity, struct cw_dynstr **ds_p); | |
| 135 | icd_status icd_queue__show(icd_queue * that, int verbosity, struct cw_dynstr *ds_p); | |
| 136 | 136 | |
| 137 | 137 | /***** Locking *****/ |
| 138 | 138 | |
| --- | --- | |
| 171 | 171 | int icd_queue__get_chime_freq(icd_queue * that); |
| 172 | 172 | int icd_queue__set_holdannounce_holdtime(icd_queue * that, int time); |
| 173 | 173 | icd_status icd_queue__calc_holdtime(icd_queue * that); |
| 174 | icd_status icd_queue__set_dump_func(icd_queue * that, icd_status(*dump_fn) (icd_queue *, int verbosity, struct cw_dynstr **ds_p, | |
| 174 | icd_status icd_queue__set_dump_func(icd_queue * that, icd_status(*dump_fn) (icd_queue *, int verbosity, struct cw_dynstr *ds_p, | |
| 175 | 175 | void *extra), void *extra); |
| 176 | 176 | |
| 177 | 177 | typedef enum { |
callweaver/trunk/include/callweaver/manager.h (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 64 | 64 | |
| 65 | 65 | struct cw_manager_message { |
| 66 | 66 | struct cw_object obj; |
| 67 | struct cw_dynstr *data; /*!< The AMI formatted event data */ | |
| 67 | struct cw_dynstr ds; /*!< The AMI formatted event data */ | |
| 68 | 68 | size_t count; /*!< The number of key/value pairs in this event */ |
| 69 | int map[0]; /*!< Offset to the start of key and value strings relative to data */ | |
| 69 | int map[0]; /*!< Offsets to the start of key and value strings in the msg data */ | |
| 70 | 70 | }; |
| 71 | 71 | |
| 72 | 72 |
callweaver/trunk/include/callweaver/stun.h (unified diff)
| r5560 | r5625 | |
|---|---|---|
| 31 | 31 | |
| 32 | 32 | extern CW_API_PUBLIC int stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *data, size_t len, rfc3489_state_t *st); |
| 33 | 33 | |
| 34 | extern CW_API_PUBLIC int stun_do_debug(struct cw_dynstr **ds_p, int argc, char *argv[]); | |
| 34 | extern CW_API_PUBLIC int stun_do_debug(struct cw_dynstr *ds_p, int argc, char *argv[]); | |
| 35 | 35 | |
| 36 | extern CW_API_PUBLIC int stun_no_debug(struct cw_dynstr **ds_p, int argc, char *argv[]); | |
| 36 | extern CW_API_PUBLIC int stun_no_debug(struct cw_dynstr *ds_p, int argc, char *argv[]); | |
| 37 | 37 | |
| 38 | 38 | int cw_stun_init(void); |
| 39 | 39 |
callweaver/trunk/pbx/pbx_ael.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 3491 | 3491 | } |
| 3492 | 3492 | |
| 3493 | 3493 | /* CLI interface */ |
| 3494 | static int ael2_debug_read(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3494 | static int ael2_debug_read(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3495 | 3495 | { |
| 3496 | 3496 | CW_UNUSED(ds_p); |
| 3497 | 3497 | CW_UNUSED(argc); |
| --- | --- | |
| 3501 | 3501 | return 0; |
| 3502 | 3502 | } |
| 3503 | 3503 | |
| 3504 | static int ael2_debug_tokens(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3504 | static int ael2_debug_tokens(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3505 | 3505 | { |
| 3506 | 3506 | CW_UNUSED(ds_p); |
| 3507 | 3507 | CW_UNUSED(argc); |
| --- | --- | |
| 3511 | 3511 | return 0; |
| 3512 | 3512 | } |
| 3513 | 3513 | |
| 3514 | static int ael2_debug_procs(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3514 | static int ael2_debug_procs(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3515 | 3515 | { |
| 3516 | 3516 | CW_UNUSED(ds_p); |
| 3517 | 3517 | CW_UNUSED(argc); |
| --- | --- | |
| 3521 | 3521 | return 0; |
| 3522 | 3522 | } |
| 3523 | 3523 | |
| 3524 | static int ael2_debug_contexts(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3524 | static int ael2_debug_contexts(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3525 | 3525 | { |
| 3526 | 3526 | CW_UNUSED(ds_p); |
| 3527 | 3527 | CW_UNUSED(argc); |
| --- | --- | |
| 3531 | 3531 | return 0; |
| 3532 | 3532 | } |
| 3533 | 3533 | |
| 3534 | static int ael2_no_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3534 | static int ael2_no_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3535 | 3535 | { |
| 3536 | 3536 | CW_UNUSED(ds_p); |
| 3537 | 3537 | CW_UNUSED(argc); |
| --- | --- | |
| 3541 | 3541 | return 0; |
| 3542 | 3542 | } |
| 3543 | 3543 | |
| 3544 | static int ael2_reload(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 3544 | static int ael2_reload(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 3545 | 3545 | { |
| 3546 | 3546 | CW_UNUSED(ds_p); |
| 3547 | 3547 | CW_UNUSED(argc); |
callweaver/trunk/pbx/pbx_config.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 123 | 123 | /* |
| 124 | 124 | * REMOVE INCLUDE command stuff |
| 125 | 125 | */ |
| 126 | static int handle_context_dont_include(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 126 | static int handle_context_dont_include(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 127 | 127 | { |
| 128 | 128 | if (argc != 5) return RESULT_SHOWUSAGE; |
| 129 | 129 | |
| --- | --- | |
| 140 | 140 | return RESULT_FAILURE; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | static void complete_context_dont_include(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 143 | static void complete_context_dont_include(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 144 | 144 | { |
| 145 | 145 | struct cw_context *c; |
| 146 | 146 | struct cw_include *i; |
| --- | --- | |
| 228 | 228 | /* |
| 229 | 229 | * REMOVE EXTENSION command stuff |
| 230 | 230 | */ |
| 231 | static int handle_context_remove_extension(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 231 | static int handle_context_remove_extension(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 232 | 232 | { |
| 233 | 233 | int removing_priority = 0; |
| 234 | 234 | char *exten, *context; |
| --- | --- | |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | |
| 299 | static void complete_context_remove_extension(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 299 | static void complete_context_remove_extension(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 300 | 300 | { |
| 301 | 301 | struct cw_context *c; |
| 302 | 302 | struct cw_exten *e; |
| --- | --- | |
| 399 | 399 | /* |
| 400 | 400 | * Include context ... |
| 401 | 401 | */ |
| 402 | static int handle_context_add_include(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 402 | static int handle_context_add_include(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 403 | 403 | { |
| 404 | 404 | if (argc != 5) return RESULT_SHOWUSAGE; |
| 405 | 405 | |
| --- | --- | |
| 437 | 437 | return RESULT_SUCCESS; |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | static void complete_context_add_include(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 440 | static void complete_context_add_include(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 441 | 441 | { |
| 442 | 442 | struct cw_context *c, *c2; |
| 443 | 443 | |
| --- | --- | |
| 493 | 493 | /* |
| 494 | 494 | * 'save dialplan' CLI command implementation functions ... |
| 495 | 495 | */ |
| 496 | static int handle_save_dialplan(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 496 | static int handle_save_dialplan(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 497 | 497 | { |
| 498 | 498 | char filename[256]; |
| 499 | 499 | struct cw_context *c; |
| --- | --- | |
| 733 | 733 | /* |
| 734 | 734 | * ADD EXTENSION command stuff |
| 735 | 735 | */ |
| 736 | static int handle_context_add_extension(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 736 | static int handle_context_add_extension(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 737 | 737 | { |
| 738 | 738 | char *whole_exten; |
| 739 | 739 | char *exten, *prior; |
| --- | --- | |
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | /* add extension 6123,1,Dial,IAX/212.71.138.13/6123 into local */ |
| 821 | static void complete_context_add_extension(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 821 | static void complete_context_add_extension(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 822 | 822 | { |
| 823 | 823 | struct cw_context *c; |
| 824 | 824 | |
| --- | --- | |
| 852 | 852 | /* |
| 853 | 853 | * IGNOREPAT CLI stuff |
| 854 | 854 | */ |
| 855 | static int handle_context_add_ignorepat(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 855 | static int handle_context_add_ignorepat(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 856 | 856 | { |
| 857 | 857 | if (argc != 5) return RESULT_SHOWUSAGE; |
| 858 | 858 | if (strcmp(argv[3], "into")) return RESULT_SHOWUSAGE; |
| --- | --- | |
| 888 | 888 | return RESULT_SUCCESS; |
| 889 | 889 | } |
| 890 | 890 | |
| 891 | static void complete_context_add_ignorepat(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 891 | static void complete_context_add_ignorepat(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 892 | 892 | { |
| 893 | 893 | struct cw_context *c; |
| 894 | 894 | |
| --- | --- | |
| 923 | 923 | } |
| 924 | 924 | } |
| 925 | 925 | |
| 926 | static int handle_context_remove_ignorepat(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 926 | static int handle_context_remove_ignorepat(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 927 | 927 | { |
| 928 | 928 | if (argc != 5) return RESULT_SHOWUSAGE; |
| 929 | 929 | if (strcmp(argv[3], "from")) return RESULT_SHOWUSAGE; |
| --- | --- | |
| 957 | 957 | |
| 958 | 958 | static int pbx_load_module(void); |
| 959 | 959 | |
| 960 | static int handle_reload_extensions(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 960 | static int handle_reload_extensions(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 961 | 961 | { |
| 962 | 962 | CW_UNUSED(ds_p); |
| 963 | 963 | CW_UNUSED(argv); |
| --- | --- | |
| 969 | 969 | return RESULT_SUCCESS; |
| 970 | 970 | } |
| 971 | 971 | |
| 972 | static void complete_context_remove_ignorepat(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 972 | static void complete_context_remove_ignorepat(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 973 | 973 | { |
| 974 | 974 | struct cw_context *c; |
| 975 | 975 |
callweaver/trunk/pbx/pbx_dundi.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 2192 | 2192 | } |
| 2193 | 2193 | } |
| 2194 | 2194 | |
| 2195 | static int dundi_do_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2195 | static int dundi_do_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2196 | 2196 | { |
| 2197 | 2197 | CW_UNUSED(argv); |
| 2198 | 2198 | |
| --- | --- | |
| 2204 | 2204 | return RESULT_SUCCESS; |
| 2205 | 2205 | } |
| 2206 | 2206 | |
| 2207 | static int dundi_do_store_history(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2207 | static int dundi_do_store_history(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2208 | 2208 | { |
| 2209 | 2209 | CW_UNUSED(argv); |
| 2210 | 2210 | |
| --- | --- | |
| 2216 | 2216 | return RESULT_SUCCESS; |
| 2217 | 2217 | } |
| 2218 | 2218 | |
| 2219 | static int dundi_flush(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2219 | static int dundi_flush(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2220 | 2220 | { |
| 2221 | 2221 | int stats=0; |
| 2222 | 2222 | if ((argc < 2) || (argc > 3)) |
| --- | --- | |
| 2251 | 2251 | return RESULT_SUCCESS; |
| 2252 | 2252 | } |
| 2253 | 2253 | |
| 2254 | static int dundi_no_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2254 | static int dundi_no_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2255 | 2255 | { |
| 2256 | 2256 | CW_UNUSED(argv); |
| 2257 | 2257 | |
| --- | --- | |
| 2263 | 2263 | return RESULT_SUCCESS; |
| 2264 | 2264 | } |
| 2265 | 2265 | |
| 2266 | static int dundi_no_store_history(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2266 | static int dundi_no_store_history(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2267 | 2267 | { |
| 2268 | 2268 | CW_UNUSED(argv); |
| 2269 | 2269 | |
| --- | --- | |
| 2289 | 2289 | } |
| 2290 | 2290 | } |
| 2291 | 2291 | |
| 2292 | static void complete_peer_4(struct cw_dynstr **ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 2292 | static void complete_peer_4(struct cw_dynstr *ds_p, char *argv[], int lastarg, int lastarg_len) | |
| 2293 | 2293 | { |
| 2294 | 2294 | char eid_str[20]; |
| 2295 | 2295 | struct dundi_peer *p; |
| --- | --- | |
| 2323 | 2323 | qsort(results, count, sizeof(results[0]), rescomp); |
| 2324 | 2324 | } |
| 2325 | 2325 | |
| 2326 | static int dundi_do_lookup(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2326 | static int dundi_do_lookup(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2327 | 2327 | { |
| 2328 | 2328 | int res; |
| 2329 | 2329 | char tmp[256]; |
| --- | --- | |
| 2364 | 2364 | return RESULT_SUCCESS; |
| 2365 | 2365 | } |
| 2366 | 2366 | |
| 2367 | static int dundi_do_precache(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2367 | static int dundi_do_precache(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2368 | 2368 | { |
| 2369 | 2369 | int res; |
| 2370 | 2370 | char tmp[256]; |
| --- | --- | |
| 2389 | 2389 | return RESULT_SUCCESS; |
| 2390 | 2390 | } |
| 2391 | 2391 | |
| 2392 | static int dundi_do_query(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2392 | static int dundi_do_query(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2393 | 2393 | { |
| 2394 | 2394 | int res; |
| 2395 | 2395 | char tmp[256]; |
| --- | --- | |
| 2429 | 2429 | return RESULT_SUCCESS; |
| 2430 | 2430 | } |
| 2431 | 2431 | |
| 2432 | static int dundi_show_peer(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2432 | static int dundi_show_peer(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2433 | 2433 | { |
| 2434 | 2434 | char iabuf[INET_ADDRSTRLEN]; |
| 2435 | 2435 | char eid_str[20]; |
| --- | --- | |
| 2491 | 2491 | return RESULT_SUCCESS; |
| 2492 | 2492 | } |
| 2493 | 2493 | |
| 2494 | static int dundi_show_peers(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2494 | static int dundi_show_peers(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2495 | 2495 | { |
| 2496 | 2496 | #define FORMAT2 "%-20.20s %-15.15s %-10.10s %-8.8s %-15.15s\n" |
| 2497 | 2497 | #define FORMAT "%-20.20s %-15.15s %s %-10.10s %-8.8s %-15.15s\n" |
| --- | --- | |
| 2576 | 2576 | #undef FORMAT2 |
| 2577 | 2577 | } |
| 2578 | 2578 | |
| 2579 | static int dundi_show_trans(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2579 | static int dundi_show_trans(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2580 | 2580 | { |
| 2581 | 2581 | #define FORMAT2 "%-22.22s %-5.5s %-5.5s %-3.3s %-3.3s %-3.3s\n" |
| 2582 | 2582 | #define FORMAT "%-16.16s:%5d %-5.5d %-5.5d %-3.3d %-3.3d %-3.3d\n" |
| --- | --- | |
| 2600 | 2600 | #undef FORMAT2 |
| 2601 | 2601 | } |
| 2602 | 2602 | |
| 2603 | static int dundi_show_entityid(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2603 | static int dundi_show_entityid(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2604 | 2604 | { |
| 2605 | 2605 | char eid_str[20]; |
| 2606 | 2606 | |
| --- | --- | |
| 2616 | 2616 | return RESULT_SUCCESS; |
| 2617 | 2617 | } |
| 2618 | 2618 | |
| 2619 | static int dundi_show_requests(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2619 | static int dundi_show_requests(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2620 | 2620 | { |
| 2621 | 2621 | #define FORMAT2 "%-15s %-15s %-15s %-3.3s %-3.3s\n" |
| 2622 | 2622 | #define FORMAT "%-15s %-15s %-15s %-3.3d %-3.3d\n" |
| --- | --- | |
| 2642 | 2642 | |
| 2643 | 2643 | /* Grok-a-dial DUNDi */ |
| 2644 | 2644 | |
| 2645 | static int dundi_show_mappings(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2645 | static int dundi_show_mappings(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2646 | 2646 | { |
| 2647 | 2647 | #define FORMAT2 "%-12.12s %-7.7s %-12.12s %-10.10s %-5.5s %-25.25s\n" |
| 2648 | 2648 | #define FORMAT "%-12.12s %-7d %-12.12s %-10.10s %-5.5s %-25.25s\n" |
| --- | --- | |
| 2667 | 2667 | #undef FORMAT2 |
| 2668 | 2668 | } |
| 2669 | 2669 | |
| 2670 | static int dundi_show_precache(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 2670 | static int dundi_show_precache(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 2671 | 2671 | { |
| 2672 | 2672 | #define FORMAT2 "%-12.12s %-12.12s %-10.10s\n" |
| 2673 | 2673 | #define FORMAT "%-12.12s %-12.12s %02d:%02d:%02d\n" |
callweaver/trunk/res/include/res_odbc.h (unified diff)
| r5560 | r5625 | |
|---|---|---|
| 56 | 56 | extern CW_API_PUBLIC void destroy_odbc_obj(odbc_obj **obj); |
| 57 | 57 | extern CW_API_PUBLIC int register_odbc_obj(char *name,odbc_obj *obj); |
| 58 | 58 | extern CW_API_PUBLIC odbc_obj *fetch_odbc_obj(const char *name, int check); |
| 59 | extern CW_API_PUBLIC int odbc_dump_fd(struct cw_dynstr **ds_p, odbc_obj *obj); | |
| 59 | extern CW_API_PUBLIC int odbc_dump_fd(struct cw_dynstr *ds_p, odbc_obj *obj); | |
| 60 | 60 | extern CW_API_PUBLIC int odbc_sanity_check(odbc_obj *obj); |
| 61 | 61 | extern CW_API_PUBLIC int odbc_smart_execute(odbc_obj *obj, SQLHSTMT stmt); |
| 62 | 62 | extern CW_API_PUBLIC int odbc_smart_direct_execute(odbc_obj *obj, SQLHSTMT stmt, char *sql); |
callweaver/trunk/res/res_config_mysql.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 73 | 73 | |
| 74 | 74 | static int parse_config(void); |
| 75 | 75 | static int mysql_reconnect(const char *database); |
| 76 | static int realtime_mysql_status(struct cw_dynstr **ds_p, int argc, char **argv); | |
| 76 | static int realtime_mysql_status(struct cw_dynstr *ds_p, int argc, char **argv); | |
| 77 | 77 | |
| 78 | 78 | static const char cli_realtime_mysql_status_usage[] = |
| 79 | 79 | "Usage: realtime mysql status\n" |
| --- | --- | |
| 658 | 658 | } |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | static int realtime_mysql_status(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 661 | static int realtime_mysql_status(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 662 | 662 | { |
| 663 | 663 | char status[256], status2[100] = ""; |
| 664 | 664 | int conntime = time(NULL) - connect_time; |
callweaver/trunk/res/res_indications.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 87 | 87 | /* |
| 88 | 88 | * ADD INDICATION command stuff |
| 89 | 89 | */ |
| 90 | static int handle_add_indication(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 90 | static int handle_add_indication(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 91 | 91 | { |
| 92 | 92 | struct tone_zone *tz; |
| 93 | 93 | int created_country = 0; |
| --- | --- | |
| 129 | 129 | /* |
| 130 | 130 | * REMOVE INDICATION command stuff |
| 131 | 131 | */ |
| 132 | static int handle_remove_indication(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 132 | static int handle_remove_indication(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 133 | 133 | { |
| 134 | 134 | struct tone_zone *tz; |
| 135 | 135 | |
| --- | --- | |
| 164 | 164 | /* |
| 165 | 165 | * SHOW INDICATIONS command stuff |
| 166 | 166 | */ |
| 167 | static int handle_show_indications(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 167 | static int handle_show_indications(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 168 | 168 | { |
| 169 | 169 | struct tone_zone *tz; |
| 170 | 170 | char buf[256]; |
callweaver/trunk/res/res_jabber.c (unified diff)
| r5620 | r5625 | |
|---|---|---|
| 213 | 213 | |
| 214 | 214 | CW_UNUSED(sess); |
| 215 | 215 | |
| 216 | if ((node = jabber_message_node_printf(globals.event_master, "CALLWEAVER EVENT", "%s", event->data))) | |
| 216 | if ((node = jabber_message_node_printf(globals.event_master, "CALLWEAVER EVENT", "%s", event->ds.data))) | |
| 217 | 217 | jabber_message_node_push(&global_profile, node, Q_OUTBOUND); |
| 218 | 218 | |
| 219 | 219 | return 0; |
| --- | --- | |
| 1722 | 1722 | */ |
| 1723 | 1723 | static void *cli_command_thread(void *cli_command) |
| 1724 | 1724 | { |
| 1725 | struct cw_dynstr *ds = NULL; | |
| 1725 | struct cw_dynstr ds = CW_DYNSTR_INIT; | |
| 1726 | 1726 | |
| 1727 | 1727 | cw_cli_command(&ds, (char *)cli_command); |
| 1728 | 1728 | cw_dynstr_free(&ds); |
callweaver/trunk/res/res_monitor.c (unified diff)
| r5620 | r5625 | |
|---|---|---|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | if (chan->monitor->joinfiles && !cw_strlen_zero(chan->monitor->filename_base)) { |
| 268 | struct cw_dynstr *cmd = NULL; | |
| 268 | struct cw_dynstr cmd = CW_DYNSTR_INIT; | |
| 269 | 269 | /* This mapping is because that's what corelib/file.c does when asked to write wav49 */ |
| 270 | 270 | const char *format = (strcasecmp(chan->monitor->format, "wav49") == 0) ? "WAV" : chan->monitor->format; |
| 271 | 271 | char *name = chan->monitor->filename_base; |
| --- | --- | |
| 292 | 292 | if (execute) |
| 293 | 293 | cw_object_put(execute); |
| 294 | 294 | |
| 295 | if (cmd && !cmd->error) { | |
| 296 | cw_log(CW_LOG_DEBUG,"Executing: %s\n", cmd->data); | |
| 297 | if (cw_safe_system(cmd->data) == -1) | |
| 298 | cw_log(CW_LOG_WARNING, "Failed to execute: %s failed.\n", cmd->data); | |
| 295 | if (!cmd.error) { | |
| 296 | cw_log(CW_LOG_DEBUG,"Executing: %s\n", cmd.data); | |
| 297 | if (cw_safe_system(cmd.data) == -1) | |
| 298 | cw_log(CW_LOG_WARNING, "Failed to execute: %s failed.\n", cmd.data); | |
| 299 | 299 | } else |
| 300 | 300 | cw_log(CW_LOG_ERROR, "Out of memory!\n"); |
| 301 | 301 | |
| 302 | if (cmd) | |
| 303 | cw_dynstr_free(&cmd); | |
| 302 | cw_dynstr_free(&cmd); | |
| 304 | 303 | } |
| 305 | 304 | |
| 306 | 305 | free(chan->monitor->format); |
callweaver/trunk/res/res_musiconhold.c (unified diff)
| r5601 | r5625 | |
|---|---|---|
| 1105 | 1105 | } |
| 1106 | 1106 | |
| 1107 | 1107 | |
| 1108 | static int moh_reload(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1108 | static int moh_reload(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1109 | 1109 | { |
| 1110 | 1110 | struct mohclass *moh; |
| 1111 | 1111 | int x; |
| --- | --- | |
| 1144 | 1144 | return 0; |
| 1145 | 1145 | } |
| 1146 | 1146 | |
| 1147 | static int cli_files_show(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1147 | static int cli_files_show(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1148 | 1148 | { |
| 1149 | 1149 | struct mohclass *class; |
| 1150 | 1150 | int i; |
| --- | --- | |
| 1166 | 1166 | return 0; |
| 1167 | 1167 | } |
| 1168 | 1168 | |
| 1169 | static int moh_classes_show(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1169 | static int moh_classes_show(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1170 | 1170 | { |
| 1171 | 1171 | struct mohclass *class; |
| 1172 | 1172 |
callweaver/trunk/res/res_odbc.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 240 | 240 | return 0; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | int odbc_dump_fd(struct cw_dynstr **ds_p, odbc_obj *obj) | |
| 243 | int odbc_dump_fd(struct cw_dynstr *ds_p, odbc_obj *obj) | |
| 244 | 244 | { |
| 245 | 245 | /* make sure the connection is up before we lie to our master.*/ |
| 246 | 246 | odbc_sanity_check(obj); |
| --- | --- | |
| 248 | 248 | return 0; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | static int odbc_connect_usage(struct cw_dynstr **ds_p) | |
| 251 | static int odbc_connect_usage(struct cw_dynstr *ds_p) | |
| 252 | 252 | { |
| 253 | 253 | cw_dynstr_printf(ds_p, "usage odbc connect <DSN>\n"); |
| 254 | 254 | return 0; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | static int odbc_disconnect_usage(struct cw_dynstr **ds_p) | |
| 257 | static int odbc_disconnect_usage(struct cw_dynstr *ds_p) | |
| 258 | 258 | { |
| 259 | 259 | cw_dynstr_printf(ds_p, "usage odbc disconnect <DSN>\n"); |
| 260 | 260 | return 0; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | static int odbc_show_command(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 263 | static int odbc_show_command(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 264 | 264 | { |
| 265 | 265 | odbc_obj *obj; |
| 266 | 266 | int x = 0; |
| --- | --- | |
| 282 | 282 | return 0; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | static int odbc_disconnect_command(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 285 | static int odbc_disconnect_command(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 286 | 286 | { |
| 287 | 287 | odbc_obj *obj; |
| 288 | 288 | |
| --- | --- | |
| 298 | 298 | return 0; |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | static int odbc_connect_command(struct cw_dynstr **ds_p, int argc, char **argv) | |
| 301 | static int odbc_connect_command(struct cw_dynstr *ds_p, int argc, char **argv) | |
| 302 | 302 | { |
| 303 | 303 | odbc_obj *obj; |
| 304 | 304 |
callweaver/trunk/res/res_ogi.c (unified diff)
| r5594 | r5625 | |
|---|---|---|
| 1313 | 1313 | "Usage: ogi no debug\n" |
| 1314 | 1314 | " Disables dumping of OGI transactions for debugging purposes\n"; |
| 1315 | 1315 | |
| 1316 | static int ogi_do_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1316 | static int ogi_do_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1317 | 1317 | { |
| 1318 | 1318 | CW_UNUSED(argv); |
| 1319 | 1319 | |
| --- | --- | |
| 1325 | 1325 | return RESULT_SUCCESS; |
| 1326 | 1326 | } |
| 1327 | 1327 | |
| 1328 | static int ogi_no_debug(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1328 | static int ogi_no_debug(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1329 | 1329 | { |
| 1330 | 1330 | CW_UNUSED(argv); |
| 1331 | 1331 | |
| --- | --- | |
| 1679 | 1679 | } |
| 1680 | 1680 | } |
| 1681 | 1681 | |
| 1682 | static int help_workhorse(struct cw_dynstr **ds_p, const char **match) | |
| 1682 | static int help_workhorse(struct cw_dynstr *ds_p, const char **match) | |
| 1683 | 1683 | { |
| 1684 | 1684 | char fullcmd[80]; |
| 1685 | 1685 | char matchstr[80]; |
| --- | --- | |
| 1949 | 1949 | return returnstatus; |
| 1950 | 1950 | } |
| 1951 | 1951 | |
| 1952 | static int handle_showogi(struct cw_dynstr **ds_p, int argc, char *argv[]) { | |
| 1952 | static int handle_showogi(struct cw_dynstr *ds_p, int argc, char *argv[]) { | |
| 1953 | 1953 | struct ogi_command *e; |
| 1954 | 1954 | char fullcmd[80]; |
| 1955 | 1955 | if ((argc < 2)) |
| --- | --- | |
| 1972 | 1972 | return RESULT_SUCCESS; |
| 1973 | 1973 | } |
| 1974 | 1974 | |
| 1975 | static int handle_dumpogihtml(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 1975 | static int handle_dumpogihtml(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 1976 | 1976 | { |
| 1977 | 1977 | char fullcmd[80]; |
| 1978 | 1978 | struct ogi_command *e; |
callweaver/trunk/res/res_osp.c (unified diff)
| r5560 | r5625 | |
|---|---|---|
| 282 | 282 | return 0; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | static int show_osp(struct cw_dynstr **ds_p, int argc, char *argv[]) | |
| 285 | static int show_osp(struct cw_dynstr *ds_p, int argc, char *argv[]) | |
| 286 | 286 | { |
| 287 | 287 | struct osp_provider *osp; |
| 288 | 288 | char *search = NULL; |
callweaver/trunk/res/res_sqlite.c (unified diff)
| r5596 | r5625 | |
|---|---|---|
| 109 | 109 | static int exist_callback(void *pArg, int argc, char **argv, char **columnNames); |
| 110 | 110 | |
| 111 | 111 | struct switch_config { |
| 112 | struct cw_dynstr **ds_p; | |
| 112 | struct cw_dynstr *ds_p; | |
| 113 | 113 | int timeout; |
| 114 | 114 | int seeheads; |
| 115 | 115 | }; |
| --- | --- | |
| 271 | 271 | return 0; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | static int sqlite_cli(struct cw_dynstr **ds_p, int argc, char *argv[]) { | |
| 274 | static int sqlite_cli(struct cw_dynstr *ds_p, int argc, char *argv[]) { | |
| 275 | 275 | char sqlbuf[1024]; |
| 276 | 276 | char path[ARRAY_SIZE]; |
| 277 | 277 | switch_config config; |
![Home changeset 5625 [home]](/images/logo.png?1180520111)

RSS Feeds