/* * Copyright 2006-2013, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: * Axel Dörfler, axeld@pinc-software.de * Alexander von Gluck */ #include #include #include #include #include #include #include #include #include #include #include #include #include extern const char* __progname; const char* kProgramName = __progname; enum modes { RTM_LIST = 0, RTM_DELETE, RTM_ADD, RTM_GET, // TODO: RTM_CHANGE, RTM_FLUSH, }; enum preferredPrefixFormat { PREFIX_PREFER_NETMASK = 0, PREFIX_PREFER_CIDR, }; struct address_family { int family; const char* name; const char* identifiers[4]; int maxAddressLength; int preferredPrefixFormat; }; static const address_family kFamilies[] = { { AF_INET, "IPv4", {"AF_INET", "inet", "ipv4", NULL}, 15, PREFIX_PREFER_NETMASK, }, { AF_INET6, "IPv6", {"AF_INET6", "inet6", "ipv6", NULL}, 39, PREFIX_PREFER_CIDR, }, { -1, NULL, {NULL}, -1, -1 } }; void usage(int status) { printf("usage: %s [command] [] [
] " " [