comparison sip-in/readconf.c @ 91:fd23e2747b45

sip-in: add sip-udp-retrans configuration setting
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 23 Sep 2022 19:05:08 -0800
parents 736c2d68595f
children a9137bdb6047
comparison
equal deleted inserted replaced
90:736c2d68595f 91:fd23e2747b45
101 return; 101 return;
102 } 102 }
103 fprintf(stderr, "%s line %d: invalid boolean argument \"%s\"\n", 103 fprintf(stderr, "%s line %d: invalid boolean argument \"%s\"\n",
104 config_file_pathname, st->lineno, arg); 104 config_file_pathname, st->lineno, arg);
105 exit(1); 105 exit(1);
106 }
107
108 static void
109 handle_retrans_conf(st, kw, arg)
110 struct parse_state *st;
111 char *kw, *arg;
112 {
113 char *cp = arg;
114
115 if (!isdigit(*cp)) {
116 inv: fprintf(stderr,
117 "%s line %d: %s setting requires two numeric arguments\n",
118 config_file_pathname, st->lineno, kw);
119 exit(1);
120 }
121 cfg_retrans_timeout = strtoul(cp, &cp, 10);
122 while (isspace(*cp))
123 cp++;
124 if (!isdigit(*cp))
125 goto inv;
126 cfg_retrans_count = strtoul(cp, &cp, 10);
127 while (isspace(*cp))
128 cp++;
129 if (*cp != '\0' && *cp != '#')
130 goto inv;
106 } 131 }
107 132
108 static void 133 static void
109 process_line(st, line) 134 process_line(st, line)
110 struct parse_state *st; 135 struct parse_state *st;
137 set_id = 2; 162 set_id = 2;
138 } else if (!strcmp(kw, "use-100rel")) { 163 } else if (!strcmp(kw, "use-100rel")) {
139 handler = handle_bool; 164 handler = handle_bool;
140 var = &cfg_use_100rel; 165 var = &cfg_use_100rel;
141 set_id = 0; 166 set_id = 0;
167 } else if (!strcmp(kw, "sip-udp-retrans")) {
168 handler = handle_retrans_conf;
169 var = (void *) 0;
170 set_id = 0;
142 } else { 171 } else {
143 fprintf(stderr, "%s line %d: non-understood keyword \"%s\"\n", 172 fprintf(stderr, "%s line %d: non-understood keyword \"%s\"\n",
144 config_file_pathname, st->lineno, kw); 173 config_file_pathname, st->lineno, kw);
145 exit(1); 174 exit(1);
146 } 175 }