MCPcopy Create free account
hub / github.com/F-Stack/f-stack / auto_stop

Function auto_stop

dpdk/app/dumpcap/main.c:183–208  ·  view source on GitHub ↗

Set auto stop values */

Source from the content-addressed store, hash-verified

181
182/* Set auto stop values */
183static void auto_stop(char *opt)
184{
185 char *value, *endp;
186
187 value = strchr(opt, ':');
188 if (value == NULL)
189 rte_exit(EXIT_FAILURE,
190 "Missing colon in auto stop parameter\n");
191
192 *value++ = '\0';
193 if (strcmp(opt, "duration") == 0) {
194 double interval = strtod(value, &endp);
195
196 if (*value == '\0' || *endp != '\0' || interval <= 0)
197 rte_exit(EXIT_FAILURE,
198 "Invalid duration \"%s\"\n", value);
199 stop.duration = interval;
200 } else if (strcmp(opt, "filesize") == 0) {
201 stop.size = get_uint(value, "filesize", 0) * 1024;
202 } else if (strcmp(opt, "packets") == 0) {
203 stop.packets = get_uint(value, "packets", 0);
204 } else {
205 rte_exit(EXIT_FAILURE,
206 "Unknown autostop parameter \"%s\"\n", opt);
207 }
208}
209
210/* Add interface to list of interfaces to capture */
211static struct interface *add_interface(const char *name)

Callers 1

parse_optsFunction · 0.85

Calls 4

strchrFunction · 0.85
rte_exitFunction · 0.85
strcmpFunction · 0.85
get_uintFunction · 0.85

Tested by

no test coverage detected