#define IP4STR(ip) ip>>24,(ip>>16)&0xff,(ip>>8)&0xff,ip&0xff
// Get single route 192.168.1.0/24 by Primary Key
route.prefix = IP4ADDR(192,168,1,0);
route.mask = 24;
ret = cross_dbGetRowByPK (hRtTbl, &route, &route, 0);
CHECK (ret, "Failed to get route 192.168.1.0/24 by Primary Key");
printf ("Get single route: %d.%d.%d.%d/%d->%d.%d.%d.%d intf: %s metric: %d flags: 0x%x\n",
IP4STR(route.prefix), route.mask, IP4STR(route.nexthop), route.intf, route.metric, route.flags);
// Get one row where nexthop=192.168.1.254
route.nexthop = IP4ADDR(192,168,1,254);
ret = cross_dbGetOneRow (hRtTbl, "nexthop", &route, &route, 0);
CHECK (ret, "Failed to get one route where nexthop=192.168.1.254");
printf ("Get one route where nexthop=192.168.1.254: "
"%d.%d.%d.%d/%d->%d.%d.%d.%d intf: %s metric: %d flags: 0x%x\n",
IP4STR(route.prefix), route.mask, IP4STR(route.nexthop), route.intf, route.metric, route.flags);