/* * Copyright 2006-2010, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: * Axel Dörfler, axeld@pinc-software.de * Oliver Tappe, zooey@hirschkaefer.de * Atis Elsts, the.kfx@gmail.com */ #include #include #include #include #include #include #include #include #include #include #include #include #include extern const char* __progname; const char* kProgramName = __progname; enum preferred_output_format { PREFER_OUTPUT_MASK, PREFER_OUTPUT_PREFIX_LENGTH, }; struct address_family { int family; const char* name; const char* identifiers[4]; preferred_output_format preferred_format; }; struct media_type { int type; const char* name; const char* pretty; struct { int subtype; const char* name; const char* pretty; } subtypes [6]; struct { int option; bool read_only; const char* name; const char* pretty; } options [6]; }; static const address_family kFamilies[] = { { AF_INET, "inet", {"AF_INET", "inet", "ipv4", NULL}, PREFER_OUTPUT_MASK }, { AF_INET6, "inet6", {"AF_INET6", "inet6", "ipv6", NULL}, PREFER_OUTPUT_PREFIX_LENGTH }, { -1, NULL, {NULL}, PREFER_OUTPUT_MASK } }; static const media_type kMediaTypes[] = { { 0, // for generic options "all", "All", { { IFM_AUTO, "auto", "Auto-select" }, { -1, NULL, NULL } }, { { IFM_FULL_DUPLEX, true, "fullduplex", "Full Duplex" }, { IFM_HALF_DUPLEX, true, "halfduplex", "Half Duplex" }, { IFM_LOOP, true, "loop", "Loop" }, //{ IFM_ACTIVE, false, "active", "Active" }, { -1, false, NULL, NULL } } }, { IFM_ETHER, "ether", "Ethernet", { //{ IFM_AUTO, "auto", "Auto-select" }, //{ IFM_AUI, "AUI", "10 MBit, AUI" }, //{ IFM_10_2, "10base2", "10 MBit, 10BASE-2" }, { IFM_10_T, "10baseT", "10 MBit, 10BASE-T" }, { IFM_100_TX, "100baseTX", "100 MBit, 100BASE-TX" }, { IFM_1000_T, "1000baseT", "1 GBit, 1000BASE-T" }, { IFM_1000_SX, "1000baseSX", "1 GBit, 1000BASE-SX" }, { -1, NULL, NULL } }, { { -1, false, NULL, NULL } } }, { -1, NULL, NULL, {{ -1, NULL, NULL }}, {{ -1, false, NULL, NULL }} } }; static void usage(int status) { printf("usage: %s [ [
] [
[] | " "auto-config] [