Lines Matching defs:idx

52   int idx;
137 if (!memcmp(str, alist->name, len)) return alist->idx;
147 if (!strcmp(str, alist->name)) return alist->idx;
151 static char *idx_to_string(int idx, struct arglist *list)
155 if (idx < 0) return NULL;
157 if (idx == alist->idx) return alist->name;
193 int32_t idx;
197 if ((sscanf(ptr, "0x%x %s\n", &idx, toybuf) != 2) &&
198 (sscanf(ptr, "0x%x %s #", &idx, toybuf) != 2) &&
199 (sscanf(ptr, "%d %s\n", &idx, toybuf) != 2) &&
200 (sscanf(ptr, "%d %s #", &idx, toybuf) != 2)) {
204 if (idx >= 0 && idx < size) {
205 int index = idx & (size-1);
208 list[index]->idx = idx;
230 list[value]->idx = value;
302 * return RPDB table name as per idx.
304 static char *namefromRPDB(int idx, u_int8_t whichDB)
308 if (idx < 0 || idx >= RPDB_ENTRIES) {
309 snprintf(toybuf, RPDB_ENTRIES, "%u", idx);
315 if (alist[idx] && alist[idx]->name) return alist[idx]->name;
317 if (whichDB == RPDB_rtdsfield) snprintf(toybuf, RPDB_ENTRIES, "0x%02x", idx);
318 else snprintf(toybuf, RPDB_ENTRIES, "%u", idx);
339 static char *rtmtype_idx2str(u_int8_t idx)
341 char *name = idx_to_string(idx, rtmtypes);
343 if (!name) snprintf(toybuf, RPDB_ENTRIES, "%u", idx);
350 int idx = string_to_idx(name, rtmtypes);
352 if (idx < 0) return atolx_range(name, 0, 255);
353 return idx;
544 int test = (ismulti ? p->idx & flags : 0) || p->idx == flags;
560 int idx;
567 if ((idx = substring_to_idx(*argv++, vlan_optlist)) == -1) help_exit(0);
568 switch (idx) {
576 if ((idx = substring_to_idx(*argv, vlan_protolist)) == -1) help_exit(0);
577 if (!idx) proto = ETH_P_8021Q; // PROTO_8021Q - 0
578 else if (idx == 1) proto = 0x88A8; // ETH Protocol - 8021AD
586 flags.mask |= (idx -1); // VLAN FLAG REORDER Header
587 flags.flags &= ~(idx -1); // VLAN FLAG REORDER Header
588 if (!param) flags.flags |= (idx -1); // VLAN FLAG REORDER Header
611 uint8_t idx = substring_to_idx(*argv, objectlist);
613 if (!idx) {
617 else if (idx == 1) dev = name = *++argv;
618 else if (idx == 2) link = *++argv;
619 else if (idx == 3) addr = *++argv;
656 uint32_t idx = get_ifaceindex(link, 1);
658 IFLA_LINK, &idx, sizeof(uint32_t));
690 int idx, flags = 0, masks = 0xffff, fd;
698 if ((idx = substring_to_idx(*argv++, cmd_objectlist)) == -1) help_exit(0);
699 switch(idx) {
709 if (idx == 2) {
710 masks &= ~case_flags[idx-2];
711 flags &= ~case_flags[idx-2];
712 } else flags |= case_flags[idx-2];
714 if (idx == 2) {
715 masks |= case_flags[idx-2];
716 flags |= case_flags[idx-2];
717 } else masks &= ~case_flags[idx-2];
983 int idx;
988 if (!*argv) idx = 2;
989 else if ((idx = substring_to_idx(*argv++, cmd_objectlist)) == -1)
991 ipcmd = cmdobjlist[idx];
1105 int idx = 0,length_brd = 0, length_peer = 0,length_any = 0,length_local = 0,
1132 idx = substring_to_idx(*argv, cmd_objectlist);
1133 if (idx >= 0)
1136 switch(idx) {
1276 int idx; uint32_t netmask = 0, found = 0;
1293 switch (idx = substring_to_idx(*argv, cmd_objectlist)) {
1316 int idx = atolx(*argv);
1318 name = xstrdup(namefromRPDB(idx, RPDB_rtscopes));
1473 int idx;
1479 if (!*argv) idx = 1;
1480 else if ((idx = substring_to_idx(*argv++, cmd_objectlist)) == -1)
1483 ipcmd = cmdobjlist[idx];
1780 int idx, flag;
1797 switch(idx = substring_to_idx(*argv, cmd_objectlist)) {
1809 if (!idx) request.msg.rtm_src_len = netmask;
1812 (!idx ? RTA_SRC : RTA_DST), addr, len);
1819 if (idx == 1) idev = *argv, flag = RTA_IIF;
1821 idx = get_ifaceindex(*argv, 1);
1823 flag, (char*)&idx, sizeof(idx));
1877 int family = TT.addressfamily, idx;
1888 switch (idx = substring_to_idx(*argv, cmd_objectlist)) {
1891 if ((idx = idxfromRPDB(*argv,RPDB_rtprotos)) < 0)
1893 gfilter.proto = idx;
1902 if (idx == 3) gfilter.idev = dev;
1916 idx = substring_to_idx(*argv, cmd_objectlist);
1917 if (idx == 6) gfilter.tb = -1;
1918 else if (idx == 9) gfilter.tb = 0;
1919 else if (idx != 13) {
1929 idx = substring_to_idx(*argv, cmd_objectlist);
1930 if (idx < 0) if (!*++argv) show_iproute_help();
1931 if (idx == 10)
1939 if ((idx == 12 ||idx == 11) && !*++argv) show_iproute_help();
1945 if (idx != 11) gfilter.rsrc = gfilter.msrc;
1949 idx = substring_to_idx(*argv, cmd_objectlist);
1950 if (idx != -1 && !*++argv) show_iproute_help();
1952 if (idx == 10) {
1961 if ((idx == 12 ||idx == 11) && !*++argv) show_iproute_help();
1967 if (idx != 11) gfilter.rdst = gfilter.mdst;
2002 int idx;
2040 idx = substring_to_idx(*argv, cmd_objectlist);
2041 if (!idx) {
2046 } else if (idx == 1) {
2052 } else if (idx == 2) {
2058 idx = atolx(*argv);
2059 add_uint32_rtattr_to_buffer(mxrta, sizeof(mxbuf), RTAX_MTU, idx);
2060 } else if (idx == 4) {
2062 if ((idx = idxfromRPDB(*argv,RPDB_rtprotos)) < 0)
2064 req.msg.rtm_protocol = idx;
2066 } else if (idx == 5) {
2069 } else if (idx == 6 || idx == 7) {
2072 } else if (idx == 9) {
2085 if (idx == 8)
2087 idx = substring_to_idx(*argv,rtmtypes);
2088 if (idx != -1) {
2090 req.msg.rtm_type = idx;
2103 idx = get_ifaceindex(d,1);
2105 RTA_OIF, (char*)&idx, sizeof(idx));
2133 int idx = 1;
2139 switch (idx = substring_to_idx(*argv , cmd_objectlist1)) {
2184 int8_t idx, tflag = 0, opt = (*argv[-1] == 'a') ? RTM_NEWRULE : RTM_DELRULE;
2207 switch ((idx = substring_to_idx(*argv, options))) {
2217 tmp = idx ? &request.msg.rtm_dst_len : &request.msg.rtm_src_len;
2222 (idx ? RTA_DST : RTA_SRC), addr, len);
2232 error_exit("Missing %s", (idx == 2) ? "Preference" : "fwmark");
2235 error_exit("Invalid %s", (idx == 2) ? "Preference" : "fwmark");
2237 ((idx == 2) ? RTA_PRIORITY : RTA_PROTOINFO),
2407 int idx;
2412 if (!*argv) idx = 1;
2413 else if ((idx = substring_to_idx(*argv++, options)) == -1)
2415 ipcmd = cmdobjlist[idx];
2538 int idx;
2564 switch (idx = string_to_idx(*argv, opts)) {
2598 if (idx == 1) {
2602 } else if (idx == 2) {
2642 (idx == 12) ? (ptnl->iph.daddr = addr) : (ptnl->iph.saddr = addr);
2739 int idx = 2, rtype = SIOCDELTUNNEL;
2742 idx = 0;
2745 idx = 1;
2750 parse_iptunnel_args(&iptnl, argv, idx);
2751 if (idx != 2 && iptnl.iph.ttl && !(iptnl.iph.frag_off))
2760 if (idx != 2) error_exit("invalid tunnel mode");
2767 int idx;
2773 if (!*argv) idx = 1;
2774 else if ((idx = substring_to_idx(*argv++, opts)) == -1)
2776 ipcmd = cmdobjlist[idx];
2834 int idx, isip = !(toys.which->name[2]); //1 -> if only ip
2883 if ((idx = substring_to_idx(*optargv, ip_objectlist)) == -1) help_exit(0);
2884 ipcmd = cmdobjlist[idx];
2890 if ((idx = string_to_idx(toys.which->name, ip_objectlist)) == -1)
2892 ipcmd = cmdobjlist[idx];