1 /* MIB service - minix.c - implementation of the CTL_MINIX subtree */ 2 3 #include "mib.h" 4 5 #if MINIX_TEST_SUBTREE 6 7 static char test_string[16], test_struct[12]; 8 9 static struct mib_node mib_minix_test_secret_table[] = { 10 /* 0*/ [SECRET_VALUE] = MIB_INT(_RO, 12345, "value", 11 "The combination to my luggage"), 12 }; 13 14 /* 15 * Note that even the descriptions here have been chosen such that returned 16 * description array alignment is tested. Do not change existing fields 17 * lightly, although adding new fields is always fine. 18 */ 19 static struct mib_node mib_minix_test_table[] = { 20 /* 0*/ [TEST_INT] = MIB_INT(_RO | CTLFLAG_HEX, 0x01020304, "int", 21 "Value test field"), 22 /* 1*/ [TEST_BOOL] = MIB_BOOL(_RW, 0, "bool", 23 "Boolean test field"), 24 /* 2*/ [TEST_QUAD] = MIB_QUAD(_RW, 0, "quad", "Quad test field"), 25 /* 3*/ [TEST_STRING] = MIB_STRING(_RW, test_string, "string", 26 "String test field"), 27 /* 4*/ [TEST_STRUCT] = MIB_STRUCT(_RW, test_struct, "struct", 28 "Structure test field"), 29 /* 5*/ [TEST_PRIVATE] = MIB_INT(_RW | CTLFLAG_PRIVATE, -5375, 30 "private", "Private test field"), 31 /* 6*/ [TEST_ANYWRITE] = MIB_INT(_RW | CTLFLAG_ANYWRITE, 0, 32 "anywrite", "AnyWrite test field"), 33 /* 7*/ [TEST_DYNAMIC] = MIB_INT(_RO, 0, "deleteme", 34 "This node will be destroyed"), 35 /* 8*/ [TEST_SECRET] = MIB_NODE(_RO | CTLFLAG_PRIVATE, 36 mib_minix_test_secret_table, "secret", 37 "Private subtree"), 38 /* 9*/ [TEST_PERM] = MIB_INT(_P | _RO, 1, "permanent", NULL), 39 /*10*/ [TEST_DESTROY1] = MIB_INT(_RO, 123, "destroy1", NULL), 40 /*11*/ [TEST_DESTROY2] = MIB_INT(_RO, 456, "destroy2", 41 "This node will be destroyed"), 42 }; 43 44 #endif /* MINIX_TEST_SUBTREE */ 45 46 static struct mib_node mib_minix_mib_table[] = { 47 /* 1*/ [MIB_NODES] = MIB_INTPTR(_P | _RO | CTLFLAG_UNSIGNED, 48 &nodes, "nodes", 49 "Number of nodes in the MIB tree"), 50 /* 2*/ [MIB_OBJECTS] = MIB_INTPTR(_P | _RO | CTLFLAG_UNSIGNED, 51 &objects, "objects", "Number of " 52 "dynamically allocated MIB objects"), 53 }; 54 55 static struct mib_node mib_minix_table[] = { 56 #if MINIX_TEST_SUBTREE 57 /* 0*/ [MINIX_TEST] = MIB_NODE(_RW | CTLFLAG_HIDDEN, 58 mib_minix_test_table, "test", 59 "Test87 testing ground"), 60 #endif /* MINIX_TEST_SUBTREE */ 61 /* 1*/ [MINIX_MIB] = MIB_NODE(_P | _RO, mib_minix_mib_table, 62 "mib", "MIB service information"), 63 }; 64 65 /* 66 * Initialize the CTL_MINIX subtree. 67 */ 68 void 69 mib_minix_init(struct mib_node * node) 70 { 71 72 MIB_INIT_ENODE(node, mib_minix_table); 73 } 74