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_proc_table[] = { 56 /* 1*/ [PROC_LIST] = MIB_FUNC(_P | _RO | CTLTYPE_STRUCT, 0, 57 mib_minix_proc_list, "list", 58 "Process list"), 59 /* 2*/ [PROC_DATA] = MIB_FUNC(_P | _RO | CTLTYPE_NODE, 0, 60 mib_minix_proc_data, "data", 61 "Process data"), 62 }; 63 64 static struct mib_node mib_minix_table[] = { 65 #if MINIX_TEST_SUBTREE 66 /* 0*/ [MINIX_TEST] = MIB_NODE(_RW | CTLFLAG_HIDDEN, 67 mib_minix_test_table, "test", 68 "Test87 testing ground"), 69 #endif /* MINIX_TEST_SUBTREE */ 70 /* 1*/ [MINIX_MIB] = MIB_NODE(_P | _RO, mib_minix_mib_table, 71 "mib", "MIB service information"), 72 /* 2*/ [MINIX_PROC] = MIB_NODE(_P | _RO, mib_minix_proc_table, 73 "proc", "Process information for ProcFS"), 74 }; 75 76 /* 77 * Initialize the CTL_MINIX subtree. 78 */ 79 void 80 mib_minix_init(struct mib_node * node) 81 { 82 83 MIB_INIT_ENODE(node, mib_minix_table); 84 } 85