Lines Matching refs:sc

15 try_parse(struct snmp_client *sc, const char *str)
17 const int r = snmp_parse_server(sc, str);
19 std::cout << "snmp_parse_server: " << sc->error << "\n";
25 struct snmp_client sc;
26 snmp_client_init(&sc);
28 REQUIRE(try_parse(&sc, "") == 0);
29 REQUIRE(sc.trans == SNMP_TRANS_UDP);
30 REQUIRE(sc.chost == ""s);
31 REQUIRE(sc.cport == "snmp"s);
32 REQUIRE(sc.read_community == "public"s);
33 REQUIRE(sc.write_community == "private"s);
37 struct snmp_client sc;
38 snmp_client_init(&sc);
42 REQUIRE(try_parse(&sc, str.c_str()) == 0);
43 REQUIRE(sc.trans == SNMP_TRANS_UDP);
44 REQUIRE(sc.chost == str);
45 REQUIRE(sc.cport == "snmp"s);
46 REQUIRE(sc.read_community == "public"s);
47 REQUIRE(sc.write_community == "private"s);
51 REQUIRE(try_parse(&sc, str.c_str()) == 0);
52 REQUIRE(sc.trans == SNMP_TRANS_UDP);
53 REQUIRE(sc.chost == str);
54 REQUIRE(sc.cport == "snmp"s);
55 REQUIRE(sc.read_community == "public"s);
56 REQUIRE(sc.write_community == "private"s);
60 REQUIRE(try_parse(&sc, str.c_str()) == 0);
61 REQUIRE(sc.trans == SNMP_TRANS_UDP);
62 REQUIRE(sc.chost == str);
63 REQUIRE(sc.cport == "snmp"s);
64 REQUIRE(sc.read_community == "public"s);
65 REQUIRE(sc.write_community == "private"s);
69 REQUIRE(try_parse(&sc, str.c_str()) == 0);
70 REQUIRE(sc.trans == SNMP_TRANS_LOC_DGRAM);
71 REQUIRE(sc.chost == str);
72 REQUIRE(sc.cport == ""s);
73 REQUIRE(sc.read_community == "public"s);
74 REQUIRE(sc.write_community == "private"s);
78 REQUIRE(try_parse(&sc, str.c_str()) == 0);
79 REQUIRE(sc.trans == SNMP_TRANS_LOC_DGRAM);
80 REQUIRE(sc.chost == str);
81 REQUIRE(sc.cport == ""s);
82 REQUIRE(sc.read_community == "public"s);
83 REQUIRE(sc.write_community == "private"s);
88 struct snmp_client sc;
89 snmp_client_init(&sc);
94 REQUIRE(try_parse(&sc, str.c_str()) == 0);
95 REQUIRE(sc.trans == SNMP_TRANS_UDP6);
96 REQUIRE(sc.chost == host);
97 REQUIRE(sc.cport == "snmp"s);
98 REQUIRE(sc.read_community == "public"s);
99 REQUIRE(sc.write_community == "private"s);
104 REQUIRE(try_parse(&sc, str.c_str()) == 0);
105 REQUIRE(sc.trans == SNMP_TRANS_UDP6);
106 REQUIRE(sc.chost == host);
107 REQUIRE(sc.cport == "snmp"s);
108 REQUIRE(sc.read_community == "public"s);
109 REQUIRE(sc.write_community == "private"s);
114 REQUIRE(try_parse(&sc, str.c_str()) == 0);
115 REQUIRE(sc.trans == SNMP_TRANS_UDP6);
116 REQUIRE(sc.chost == host);
117 REQUIRE(sc.cport == "snmp"s);
118 REQUIRE(sc.read_community == "public"s);
119 REQUIRE(sc.write_community == "private"s);
124 REQUIRE(try_parse(&sc, str.c_str()) == -1);
125 REQUIRE(sc.error == host + ": Name does not resolve");
130 REQUIRE(try_parse(&sc, str.c_str()) == -1);
131 REQUIRE(sc.error == host + ": Name does not resolve");
136 REQUIRE(try_parse(&sc, str.c_str()) == -1);
137 REQUIRE(sc.error == host + ": Name does not resolve");
142 REQUIRE(try_parse(&sc, str.c_str()) == -1);
143 REQUIRE(sc.error == "junk at end of server specification 'xxx'"s);
148 struct snmp_client sc;
149 snmp_client_init(&sc);
155 REQUIRE(try_parse(&sc, str.c_str()) == 0);
156 REQUIRE(sc.trans == SNMP_TRANS_UDP);
157 REQUIRE(sc.chost == host);
158 REQUIRE(sc.cport == port);
159 REQUIRE(sc.read_community == "public"s);
160 REQUIRE(sc.write_community == "private"s);
166 REQUIRE(try_parse(&sc, str.c_str()) == 0);
167 REQUIRE(sc.trans == SNMP_TRANS_UDP);
168 REQUIRE(sc.chost == host);
169 REQUIRE(sc.cport == port);
170 REQUIRE(sc.read_community == "public"s);
171 REQUIRE(sc.write_community == "private"s);
177 REQUIRE(try_parse(&sc, str.c_str()) == 0);
178 REQUIRE(sc.trans == SNMP_TRANS_UDP);
179 REQUIRE(sc.chost == host);
180 REQUIRE(sc.cport == port);
181 REQUIRE(sc.read_community == "public"s);
182 REQUIRE(sc.write_community == "private"s);
188 REQUIRE(try_parse(&sc, str.c_str()) == 0);
189 REQUIRE(sc.trans == SNMP_TRANS_UDP);
190 REQUIRE(sc.chost == host);
191 REQUIRE(sc.cport == port);
192 REQUIRE(sc.read_community == "public"s);
193 REQUIRE(sc.write_community == "private"s);
199 REQUIRE(try_parse(&sc, str.c_str()) == -1);
200 REQUIRE(sc.error == "empty port name"s);
205 struct snmp_client sc;
206 snmp_client_init(&sc);
212 REQUIRE(try_parse(&sc, str.c_str()) == 0);
213 REQUIRE(sc.trans == SNMP_TRANS_UDP6);
214 REQUIRE(sc.chost == host);
215 REQUIRE(sc.cport == port);
216 REQUIRE(sc.read_community == "public"s);
217 REQUIRE(sc.write_community == "private"s);
223 REQUIRE(try_parse(&sc, str.c_str()) == 0);
224 REQUIRE(sc.trans == SNMP_TRANS_UDP6);
225 REQUIRE(sc.chost == host);
226 REQUIRE(sc.cport == port);
227 REQUIRE(sc.read_community == "public"s);
228 REQUIRE(sc.write_community == "private"s);
234 REQUIRE(try_parse(&sc, str.c_str()) == -1);
235 REQUIRE(sc.error == "empty port name"s);
240 struct snmp_client sc;
241 snmp_client_init(&sc);
246 REQUIRE(try_parse(&sc, str.c_str()) == 0);
247 REQUIRE(sc.trans == SNMP_TRANS_UDP);
248 REQUIRE(sc.chost == host);
249 REQUIRE(sc.cport == "snmp"s);
250 REQUIRE(sc.read_community == "public"s);
251 REQUIRE(sc.write_community == "private"s);
256 REQUIRE(try_parse(&sc, str.c_str()) == 0);
257 REQUIRE(sc.trans == SNMP_TRANS_UDP);
258 REQUIRE(sc.chost == host);
259 REQUIRE(sc.cport == "snmp"s);
260 REQUIRE(sc.read_community == "public"s);
261 REQUIRE(sc.write_community == "private"s);
266 REQUIRE(try_parse(&sc, str.c_str()) == 0);
267 REQUIRE(sc.trans == SNMP_TRANS_UDP);
268 REQUIRE(sc.chost == host);
269 REQUIRE(sc.cport == "snmp"s);
270 REQUIRE(sc.read_community == "public"s);
271 REQUIRE(sc.write_community == "private"s);
276 REQUIRE(try_parse(&sc, str.c_str()) == 0);
277 REQUIRE(sc.trans == SNMP_TRANS_UDP);
278 REQUIRE(sc.chost == host);
279 REQUIRE(sc.cport == "snmp"s);
280 REQUIRE(sc.read_community == "public"s);
281 REQUIRE(sc.write_community == "private"s);
286 REQUIRE(try_parse(&sc, str.c_str()) == 0);
287 REQUIRE(sc.trans == SNMP_TRANS_UDP);
288 REQUIRE(sc.chost == host);
289 REQUIRE(sc.cport == "snmp"s);
290 REQUIRE(sc.read_community == "public"s);
291 REQUIRE(sc.write_community == "private"s);
296 REQUIRE(try_parse(&sc, str.c_str()) == 0);
297 REQUIRE(sc.trans == SNMP_TRANS_UDP);
298 REQUIRE(sc.chost == host);
299 REQUIRE(sc.cport == "snmp"s);
300 REQUIRE(sc.read_community == "public"s);
301 REQUIRE(sc.write_community == "private"s);
306 struct snmp_client sc;
307 snmp_client_init(&sc);
313 REQUIRE(try_parse(&sc, str.c_str()) == 0);
314 REQUIRE(sc.trans == SNMP_TRANS_UDP);
315 REQUIRE(sc.chost == host);
316 REQUIRE(sc.cport == "snmp"s);
317 REQUIRE(sc.read_community == "public"s);
318 REQUIRE(sc.write_community == "private"s);
324 REQUIRE(try_parse(&sc, str.c_str()) == 0);
325 REQUIRE(sc.trans == SNMP_TRANS_UDP);
326 REQUIRE(sc.chost == host);
327 REQUIRE(sc.cport == "snmp"s);
328 REQUIRE(sc.read_community == "public"s);
329 REQUIRE(sc.write_community == "private"s);
335 REQUIRE(try_parse(&sc, str.c_str()) == 0);
336 REQUIRE(sc.trans == SNMP_TRANS_UDP6);
337 REQUIRE(sc.chost == host);
338 REQUIRE(sc.cport == "snmp"s);
339 REQUIRE(sc.read_community == "public"s);
340 REQUIRE(sc.write_community == "private"s);
346 REQUIRE(try_parse(&sc, str.c_str()) == 0);
347 REQUIRE(sc.trans == SNMP_TRANS_UDP6);
348 REQUIRE(sc.chost == host);
349 REQUIRE(sc.cport == "snmp"s);
350 REQUIRE(sc.read_community == "public"s);
351 REQUIRE(sc.write_community == "private"s);
357 REQUIRE(try_parse(&sc, str.c_str()) == 0);
358 REQUIRE(sc.trans == SNMP_TRANS_LOC_DGRAM);
359 REQUIRE(sc.chost == host);
360 REQUIRE(sc.cport == ""s);
361 REQUIRE(sc.read_community == "public"s);
362 REQUIRE(sc.write_community == "private"s);
368 REQUIRE(try_parse(&sc, str.c_str()) == 0);
369 REQUIRE(sc.trans == SNMP_TRANS_LOC_STREAM);
370 REQUIRE(sc.chost == host);
371 REQUIRE(sc.cport == ""s);
372 REQUIRE(sc.read_community == "public"s);
373 REQUIRE(sc.write_community == "private"s);
379 REQUIRE(try_parse(&sc, str.c_str()) == -1);
380 REQUIRE(sc.error == "unknown transport specifier '" + trans + "'");
386 REQUIRE(try_parse(&sc, str.c_str()) == -1);
387 REQUIRE(sc.error == "empty transport specifier"s);
392 struct snmp_client sc;
393 snmp_client_init(&sc);
400 REQUIRE(try_parse(&sc, str.c_str()) == 0);
401 REQUIRE(sc.trans == SNMP_TRANS_UDP);
402 REQUIRE(sc.chost == host);
403 REQUIRE(sc.cport == port);
404 REQUIRE(sc.read_community == "public"s);
405 REQUIRE(sc.write_community == "private"s);
412 REQUIRE(try_parse(&sc, str.c_str()) == 0);
413 REQUIRE(sc.trans == SNMP_TRANS_UDP);
414 REQUIRE(sc.chost == host);
415 REQUIRE(sc.cport == port);
416 REQUIRE(sc.read_community == "public"s);
417 REQUIRE(sc.write_community == "private"s);
424 REQUIRE(try_parse(&sc, str.c_str()) == 0);
425 REQUIRE(sc.trans == SNMP_TRANS_UDP);
426 REQUIRE(sc.chost == host);
427 REQUIRE(sc.cport == port);
428 REQUIRE(sc.read_community == "public"s);
429 REQUIRE(sc.write_community == "private"s);
436 REQUIRE(try_parse(&sc, str.c_str()) == 0);
437 REQUIRE(sc.trans == SNMP_TRANS_UDP6);
438 REQUIRE(sc.chost == host);
439 REQUIRE(sc.cport == port);
440 REQUIRE(sc.read_community == "public"s);
441 REQUIRE(sc.write_community == "private"s);
447 struct snmp_client sc;
448 snmp_client_init(&sc);
454 REQUIRE(try_parse(&sc, str.c_str()) == 0);
455 REQUIRE(sc.trans == SNMP_TRANS_UDP);
456 REQUIRE(sc.chost == host);
457 REQUIRE(sc.cport == "snmp"s);
458 REQUIRE(sc.read_community == comm);
459 REQUIRE(sc.write_community == comm);
465 REQUIRE(try_parse(&sc, str.c_str()) == 0);
466 REQUIRE(sc.trans == SNMP_TRANS_UDP);
467 REQUIRE(sc.chost == host);
468 REQUIRE(sc.cport == "snmp"s);
469 REQUIRE(sc.read_community == comm);
470 REQUIRE(sc.write_community == comm);
476 REQUIRE(try_parse(&sc, str.c_str()) == 0);
477 REQUIRE(sc.trans == SNMP_TRANS_UDP);
478 REQUIRE(sc.chost == host);
479 REQUIRE(sc.cport == "snmp"s);
480 REQUIRE(sc.read_community == comm);
481 REQUIRE(sc.write_community == comm);
487 struct snmp_client sc;
488 snmp_client_init(&sc);
496 REQUIRE(try_parse(&sc, str.c_str()) == 0);
497 REQUIRE(sc.trans == SNMP_TRANS_UDP6);
498 REQUIRE(sc.chost == host);
499 REQUIRE(sc.cport == port);
500 REQUIRE(sc.read_community == comm);
501 REQUIRE(sc.write_community == comm);
509 REQUIRE(try_parse(&sc, str.c_str()) == 0);
510 REQUIRE(sc.trans == SNMP_TRANS_UDP6);
511 REQUIRE(sc.chost == host);
512 REQUIRE(sc.cport == port);
513 REQUIRE(sc.read_community == comm);
514 REQUIRE(sc.write_community == comm);
522 REQUIRE(try_parse(&sc, str.c_str()) == 0);
523 REQUIRE(sc.trans == SNMP_TRANS_UDP6);
524 REQUIRE(sc.chost == host);
525 REQUIRE(sc.cport == port);
526 REQUIRE(sc.read_community == comm);
527 REQUIRE(sc.write_community == comm);