Lines Matching full:opt

78 } opt = {  variable
127 opt.silent_send = true; in cs_parse_args()
130 opt.size = atoi(optarg); in cs_parse_args()
133 opt.sock.family = AF_INET; in cs_parse_args()
136 opt.sock.family = AF_INET6; in cs_parse_args()
140 opt.sock.proto = IPPROTO_UDP; in cs_parse_args()
142 opt.sock.proto = IPPROTO_UDP; in cs_parse_args()
143 opt.msg_more = true; in cs_parse_args()
145 opt.sock.proto = IPPROTO_ICMP; in cs_parse_args()
147 opt.sock.type = SOCK_RAW; in cs_parse_args()
154 opt.sockopt.priority = atoi(optarg); in cs_parse_args()
157 opt.mark.ena = true; in cs_parse_args()
158 opt.mark.val = atoi(optarg); in cs_parse_args()
161 opt.priority.ena = true; in cs_parse_args()
162 opt.priority.val = atoi(optarg); in cs_parse_args()
165 opt.sockopt.mark = atoi(optarg); in cs_parse_args()
168 opt.num_pkt = atoi(optarg); in cs_parse_args()
171 opt.txtime.ena = true; in cs_parse_args()
172 opt.txtime.delay = atoi(optarg); in cs_parse_args()
175 opt.ts.ena = true; in cs_parse_args()
178 opt.cmsg.dontfrag.ena = true; in cs_parse_args()
179 opt.cmsg.dontfrag.val = atoi(optarg); in cs_parse_args()
182 opt.sockopt.dontfrag = atoi(optarg); in cs_parse_args()
185 opt.cmsg.tclass.ena = true; in cs_parse_args()
186 opt.cmsg.tclass.val = atoi(optarg); in cs_parse_args()
189 opt.sockopt.tclass = atoi(optarg); in cs_parse_args()
192 opt.cmsg.hlimit.ena = true; in cs_parse_args()
193 opt.cmsg.hlimit.val = atoi(optarg); in cs_parse_args()
196 opt.sockopt.hlimit = atoi(optarg); in cs_parse_args()
199 opt.cmsg.exthdr.ena = true; in cs_parse_args()
202 opt.cmsg.exthdr.val = IPV6_HOPOPTS; in cs_parse_args()
205 opt.cmsg.exthdr.val = IPV6_DSTOPTS; in cs_parse_args()
208 opt.cmsg.exthdr.val = IPV6_RTHDRDSTOPTS; in cs_parse_args()
221 opt.host = argv[optind]; in cs_parse_args()
222 opt.service = argv[optind + 1]; in cs_parse_args()
267 SOL_SOCKET, SO_MARK, &opt.mark); in cs_write_cmsg()
269 SOL_SOCKET, SO_PRIORITY, &opt.priority); in cs_write_cmsg()
271 if (opt.sock.family == AF_INET) { in cs_write_cmsg()
273 SOL_IP, IP_TOS, &opt.cmsg.tclass); in cs_write_cmsg()
275 SOL_IP, IP_TTL, &opt.cmsg.hlimit); in cs_write_cmsg()
278 SOL_IPV6, IPV6_DONTFRAG, &opt.cmsg.dontfrag); in cs_write_cmsg()
280 SOL_IPV6, IPV6_TCLASS, &opt.cmsg.tclass); in cs_write_cmsg()
282 SOL_IPV6, IPV6_HOPLIMIT, &opt.cmsg.hlimit); in cs_write_cmsg()
285 if (opt.txtime.ena) { in cs_write_cmsg()
290 opt.txtime.delay * 1000; in cs_write_cmsg()
302 if (opt.ts.ena) { in cs_write_cmsg()
314 if (opt.cmsg.exthdr.ena) { in cs_write_cmsg()
321 cmsg->cmsg_type = opt.cmsg.exthdr.val; in cs_write_cmsg()
354 if (!opt.ts.ena) in cs_read_cmsg()
418 if (opt.sockopt.mark && in ca_set_sockopts()
420 &opt.sockopt.mark, sizeof(opt.sockopt.mark))) in ca_set_sockopts()
422 if (opt.sockopt.priority && in ca_set_sockopts()
424 &opt.sockopt.priority, sizeof(opt.sockopt.priority))) in ca_set_sockopts()
427 if (opt.sock.family == AF_INET) { in ca_set_sockopts()
428 if (opt.sockopt.tclass && in ca_set_sockopts()
430 &opt.sockopt.tclass, sizeof(opt.sockopt.tclass))) in ca_set_sockopts()
432 if (opt.sockopt.hlimit && in ca_set_sockopts()
434 &opt.sockopt.hlimit, sizeof(opt.sockopt.hlimit))) in ca_set_sockopts()
437 if (opt.sockopt.dontfrag && in ca_set_sockopts()
439 &opt.sockopt.dontfrag, sizeof(opt.sockopt.dontfrag))) in ca_set_sockopts()
441 if (opt.sockopt.tclass && in ca_set_sockopts()
443 &opt.sockopt.tclass, sizeof(opt.sockopt.tclass))) in ca_set_sockopts()
445 if (opt.sockopt.hlimit && in ca_set_sockopts()
447 &opt.sockopt.hlimit, sizeof(opt.sockopt.hlimit))) in ca_set_sockopts()
451 if (opt.txtime.ena) { in ca_set_sockopts()
460 if (opt.ts.ena) { in ca_set_sockopts()
483 buf = malloc(opt.size); in main()
484 memrnd(buf, opt.size); in main()
487 hints.ai_family = opt.sock.family; in main()
490 err = getaddrinfo(opt.host, opt.service, &hints, &ai); in main()
493 opt.host, opt.service); in main()
497 if (ai->ai_family == AF_INET6 && opt.sock.proto == IPPROTO_ICMP) in main()
498 opt.sock.proto = IPPROTO_ICMPV6; in main()
500 fd = socket(ai->ai_family, opt.sock.type, opt.sock.proto); in main()
507 if (opt.sock.proto == IPPROTO_ICMP) { in main()
510 } else if (opt.sock.proto == IPPROTO_ICMPV6) { in main()
513 } else if (opt.sock.type == SOCK_RAW) { in main()
514 struct udphdr hdr = { 1, 2, htons(opt.size), 0 }; in main()
518 sin6->sin6_port = htons(opt.sock.proto); in main()
529 iov[0].iov_len = opt.size; in main()
539 for (i = 0; i < opt.num_pkt; i++) { in main()
540 err = sendmsg(fd, &msg, opt.msg_more ? MSG_MORE : 0); in main()
542 if (!opt.silent_send) in main()
546 } else if (err != (int)opt.size) { in main()
551 if (opt.msg_more) { in main()
562 if (opt.ts.ena) { in main()
571 usleep(opt.txtime.delay / 20); in main()