[BACK]Return to smi.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / snmp

Annotation of src/usr.bin/snmp/smi.h, Revision 1.1

1.1     ! martijn     1: /*     $OpenBSD$       */
        !             2:
        !             3: /*
        !             4:  * Copyright (c) 2019 Martijn van Duren <martijn@openbsd.org>
        !             5:  * Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org>
        !             6:  *
        !             7:  * Permission to use, copy, modify, and distribute this software for any
        !             8:  * purpose with or without fee is hereby granted, provided that the above
        !             9:  * copyright notice and this permission notice appear in all copies.
        !            10:  *
        !            11:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
        !            12:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
        !            13:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
        !            14:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
        !            15:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
        !            16:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
        !            17:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
        !            18:  */
        !            19:
        !            20: #include <sys/tree.h>
        !            21: #include <sys/queue.h>
        !            22:
        !            23: #define OID_ROOT               0x00
        !            24: #define OID_RD                 0x01
        !            25: #define OID_WR                 0x02
        !            26: #define OID_IFSET              0x04    /* only if user-specified value */
        !            27: #define OID_DYNAMIC            0x08    /* free allocated data */
        !            28: #define OID_TABLE              0x10    /* dynamic sub-elements */
        !            29: #define OID_MIB                        0x20    /* root-OID of a supported MIB */
        !            30: #define OID_KEY                        0x40    /* lookup tables */
        !            31: #define        OID_REGISTERED          0x80    /* OID registered by subagent */
        !            32:
        !            33: #define OID_RS                 (OID_RD|OID_IFSET)
        !            34: #define OID_WS                 (OID_WR|OID_IFSET)
        !            35: #define OID_RW                 (OID_RD|OID_WR)
        !            36: #define OID_RWS                        (OID_RW|OID_IFSET)
        !            37:
        !            38: #define OID_TRD                        (OID_RD|OID_TABLE)
        !            39: #define OID_TWR                        (OID_WR|OID_TABLE)
        !            40: #define OID_TRS                        (OID_RD|OID_IFSET|OID_TABLE)
        !            41: #define OID_TWS                        (OID_WR|OID_IFSET|OID_TABLE)
        !            42: #define OID_TRW                        (OID_RD|OID_WR|OID_TABLE)
        !            43: #define OID_TRWS               (OID_RW|OID_IFSET|OID_TABLE)
        !            44:
        !            45: enum smi_output_string {
        !            46:        smi_os_default,
        !            47:        smi_os_hex,
        !            48:        smi_os_ascii
        !            49: };
        !            50:
        !            51: enum smi_oid_lookup {
        !            52:        smi_oidl_numeric,
        !            53:        smi_oidl_short,
        !            54:        smi_oidl_full
        !            55: };
        !            56:
        !            57: struct oid {
        !            58:        struct ber_oid           o_id;
        !            59: #define o_oid                   o_id.bo_id
        !            60: #define o_oidlen                o_id.bo_n
        !            61:
        !            62:        char                    *o_name;
        !            63:
        !            64:        u_int                    o_flags;
        !            65:
        !            66:        int                      (*o_get)(struct oid *, struct ber_oid *,
        !            67:                                    struct ber_element **);
        !            68:        int                      (*o_set)(struct oid *, struct ber_oid *,
        !            69:                                    struct ber_element **);
        !            70:        struct ber_oid          *(*o_table)(struct oid *, struct ber_oid *,
        !            71:                                    struct ber_oid *);
        !            72:
        !            73:        long long                o_val;
        !            74:        void                    *o_data;
        !            75:
        !            76:        struct ctl_conn         *o_session;
        !            77:
        !            78:        RB_ENTRY(oid)            o_element;
        !            79:        RB_ENTRY(oid)            o_keyword;
        !            80:        TAILQ_ENTRY(oid)         o_list;
        !            81: };
        !            82:
        !            83: int smi_init(void);
        !            84: unsigned int smi_application(struct ber_element *);
        !            85: int smi_string2oid(const char *, struct ber_oid *);
        !            86: char *smi_oid2string(struct ber_oid *, char *, size_t, enum smi_oid_lookup);
        !            87: void smi_mibtree(struct oid *);
        !            88: struct oid *smi_foreach(struct oid *, u_int);
        !            89: void smi_debug_elements(struct ber_element *);
        !            90: char *smi_print_element(struct ber_element *, int, enum smi_output_string,
        !            91:     enum smi_oid_lookup);