MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / ph_run_pi_cmd

Function ph_run_pi_cmd

modules/pi_http/http_fnc.c:2701–3232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2699
2700
2701int ph_run_pi_cmd(int mod, int cmd,
2702 void *connection, void *con_cls,
2703 str *page, str *buffer)
2704{
2705 char *p;
2706 char *buf;
2707 int ret;
2708
2709 str s_arg;
2710 str l_arg;
2711 str temp_holder;
2712 int temp_counter;
2713 int i;
2714 int j;
2715 int max_page_len;
2716 ph_cmd_t *command;
2717
2718 int _len;
2719 int link_on;
2720
2721 char tmp;
2722 char c[2];
2723 db_val_t *c_vals = NULL;
2724 db_val_t *q_vals = NULL;
2725 db_val_t *val;
2726 str val_str = {NULL, 0};
2727 int nr_rows;
2728 ph_db_url_t *db_url = NULL;
2729 db_res_t *res = NULL;
2730 db_val_t *values = NULL;
2731 db_row_t *rows;
2732 ph_mod_t *ph_modules;
2733
2734 ph_modules = ph_framework_data->ph_modules;
2735
2736 html_page_data.page.s = buffer->s;
2737 html_page_data.page.len = 0;
2738 html_page_data.buffer.s = buffer->s;
2739 html_page_data.buffer.len = buffer->len;
2740 html_page_data.mod = mod;
2741 html_page_data.cmd = cmd;
2742 max_page_len = buffer->len;
2743
2744 if (0!=ph_build_header(page, buffer->len, mod, cmd)) return -1;
2745 buf = page->s;
2746 p = page->s + page->len;
2747
2748 if (cmd<0) return ph_build_content(page, buffer->len, mod, cmd, NULL, NULL);
2749
2750 httpd_api.lookup_arg(connection, "cmd", con_cls, &l_arg);
2751 if(l_arg.s==NULL) return ph_build_content(page, buffer->len, mod, cmd, NULL, NULL);
2752
2753 LM_DBG("got arg cmd=[%.*s]\n", l_arg.len, l_arg.s);
2754
2755 command = &ph_modules[mod].cmds[cmd];
2756
2757 if (l_arg.len==3 && strncmp(l_arg.s, "pre", 3)==0) {
2758 /* We prebuild values only for update */

Callers 1

ph_answer_to_connectionFunction · 0.85

Calls 11

ph_build_headerFunction · 0.85
ph_build_contentFunction · 0.85
getValFunction · 0.85
use_tableFunction · 0.85
int2strFunction · 0.85
ph_build_replyFunction · 0.85
db_int2strFunction · 0.85
db_bigint2strFunction · 0.85
db_double2strFunction · 0.85
db_time2str_nqFunction · 0.85
ph_build_reply_footerFunction · 0.85

Tested by

no test coverage detected