and added files
[bcm963xx.git] / userapps / opensource / net-snmp / agent / mibgroup / smux / smux.h
1 /*
2  * Smux module authored by Rohit Dube.
3  * Rewritten by Nick Amato <naamato@merit.net>.
4  */
5
6 #define SMUXPORT 199
7
8 #define SMUXMAXPKTSIZE 1500
9 #define SMUXMAXSTRLEN  1024
10 #define SMUXMAXPEERS   10
11
12 #define SMUX_OPEN       (ASN_APPLICATION | ASN_CONSTRUCTOR | 0)
13 #define SMUX_CLOSE      (ASN_APPLICATION | ASN_PRIMITIVE | 1)
14 #define SMUX_RREQ       (ASN_APPLICATION | ASN_CONSTRUCTOR | 2)
15 #define SMUX_RRSP       (ASN_APPLICATION | ASN_PRIMITIVE | 3)
16 #define SMUX_SOUT       (ASN_APPLICATION | ASN_PRIMITIVE | 4)
17
18 #define SMUX_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0)
19 #define SMUX_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 1)
20 #define SMUX_GETRSP     (ASN_CONTEXT | ASN_CONSTRUCTOR | 2)
21 #define SMUX_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 3)
22 #define SMUX_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 4)
23
24 #define SMUXC_GOINGDOWN                    0
25 #define SMUXC_UNSUPPORTEDVERSION           1
26 #define SMUXC_PACKETFORMAT                 2
27 #define SMUXC_PROTOCOLERROR                3
28 #define SMUXC_INTERNALERROR                4
29 #define SMUXC_AUTHENTICATIONFAILURE        5
30
31 #define SMUX_MAX_PEERS          10
32 #define SMUX_MAX_PRIORITY       2147483647
33
34 #define SMUX_REGOP_DELETE               0
35 #define SMUX_REGOP_REGISTER_RO          1
36 #define SMUX_REGOP_REGISTER_RW          2
37
38 /*
39  * Authorized peers read from the config file
40  */
41 typedef struct _smux_peer_auth {
42     oid             sa_oid[MAX_OID_LEN];        /* name of peer                 */
43     size_t          sa_oid_len; /* length of peer name          */
44     char            sa_passwd[SMUXMAXSTRLEN];   /* configured passwd            */
45     int             sa_active_fd;       /* the peer using this auth     */
46 } smux_peer_auth;
47
48 /*
49  * Registrations
50  */
51 typedef struct _smux_reg {
52     oid             sr_name[MAX_OID_LEN];       /* name of subtree              */
53     size_t          sr_name_len;        /* length of subtree name       */
54     int             sr_priority;        /* priority of registration     */
55     int             sr_fd;      /* descriptor of owner          */
56     struct _smux_reg *sr_next;  /* next one                     */
57 } smux_reg;
58
59 extern void     init_smux(void);
60 extern int      smux_accept(int);
61 extern u_char  *smux_snmp_process(int, oid *, size_t *, size_t *, u_char *,
62                                   int);
63 extern int      smux_process(int);
64 extern void     smux_parse_peer_auth(const char *, char *);
65 extern void     smux_free_peer_auth(void);
66 extern void     send_enterprise_trap_vars(int, int, oid *, int,
67                                           netsnmp_variable_list *);