/* $OpenBSD: snmpd.h,v 1.1.1.1 2022/09/01 14:20:33 martijn Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter * Copyright (c) 2003, 2004 Henning Brauer * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef SNMPD_H #define SNMPD_H #include #include #include #include #include #include #include #include #include #include #include #include #include "log.h" #ifndef nitems #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) #endif /* * common definitions for snmpd */ #define CONF_FILE "/etc/snmpd.conf" #define SNMPD_SOCKET "/var/run/snmpd.sock" #define SNMPD_USER "_snmpd" #define SNMP_PORT "161" #define SNMPTRAP_PORT "162" #define SNMPD_MAXSTRLEN 484 #define SNMPD_MAXCOMMUNITYLEN SNMPD_MAXSTRLEN #define SNMPD_MAXVARBIND 0x7fffffff #define SNMPD_MAXVARBINDLEN 1210 #define SNMPD_MAXENGINEIDLEN 32 #define SNMPD_MAXUSERNAMELEN 32 #define SNMPD_MAXCONTEXNAMELEN 32 #define SNMP_USM_MAXDIGESTLEN 48 #define SNMP_USM_SALTLEN 8 #define SNMP_USM_KEYLEN 64 #define SNMP_CIPHER_KEYLEN 16 #define SMALL_READ_BUF_SIZE 1024 #define READ_BUF_SIZE 65535 #define RT_BUF_SIZE 16384 #define MAX_RTSOCK_BUF (2 * 1024 * 1024) #define SNMP_ENGINEID_OLD 0x00 #define SNMP_ENGINEID_NEW 0x80 /* RFC3411 */ #define SNMP_ENGINEID_FMT_IPv4 1 #define SNMP_ENGINEID_FMT_IPv6 2 #define SNMP_ENGINEID_FMT_MAC 3 #define SNMP_ENGINEID_FMT_TEXT 4 #define SNMP_ENGINEID_FMT_OCT 5 #define SNMP_ENGINEID_FMT_HH 129 #define PEN_OPENBSD 30155 #if DEBUG #define DPRINTF log_debug #else #define DPRINTF(x...) do {} while(0) #endif /* * daemon structures */ struct snmpd { int sc_ncpu; int64_t *sc_cpustates; int sc_rtfilter; }; extern struct snmpd *snmpd_env; /* mib.c */ u_long smi_getticks(void); /* timer.c */ void timer_init(void); /* util.c */ ssize_t sendtofrom(int, void *, size_t, int, struct sockaddr *, socklen_t, struct sockaddr *, socklen_t); ssize_t recvfromto(int, void *, size_t, int, struct sockaddr *, socklen_t *, struct sockaddr *, socklen_t *); const char *log_in6addr(const struct in6_addr *); const char *print_host(struct sockaddr_storage *, char *, size_t); char *tohexstr(u_int8_t *, int); uint8_t *fromhexstr(uint8_t *, const char *, size_t); #endif /* SNMPD_H */