]> git.ipfire.org Git - thirdparty/squid.git/blame - include/snmp_api_util.h
Bug 4436: Fix DEFAULT_SSL_CRTD
[thirdparty/squid.git] / include / snmp_api_util.h
CommitLineData
5c193dec 1/*
ef57eb7b 2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
5c193dec
AJ
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
b5638623 9#ifndef SQUID_SNMP_API_UTIL_H
10#define SQUID_SNMP_API_UTIL_H
54f642bf 11
b038cb7b 12/* NP: required for typedef ipaddr */
e1f7507e
AJ
13#include "snmp_pdu.h"
14
54f642bf 15/***********************************************************
f53969cc 16 Copyright 1997 by Carnegie Mellon University
54f642bf 17
18 All Rights Reserved
19
c5dd4956
AJ
20Permission to use, copy, modify, and distribute this software and its
21documentation for any purpose and without fee is hereby granted,
54f642bf 22provided that the above copyright notice appear in all copies and that
c5dd4956 23both that copyright notice and this permission notice appear in
54f642bf 24supporting documentation, and that the name of CMU not be
25used in advertising or publicity pertaining to distribution of the
c5dd4956 26software without specific, written prior permission.
54f642bf 27
28CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
29ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
30CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
31ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
32WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
33ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
34SOFTWARE.
35******************************************************************/
36
37/*
38 * snmp_api_util.h - API management.
39 * Didier DESIDERIO (SINFOR) - November 26th, 1997
40 */
41
42#define PACKET_LENGTH 4500
43
44/*
45 * A list of all the outstanding requests for a particular session.
46 */
47struct request_list {
48 struct request_list *next_request;
f53969cc
SM
49 int request_id; /* request id */
50 int retries; /* Number of retries */
51 u_int timeout; /* length to wait for timeout */
52 struct timeval time; /* Time this request was made */
53 struct timeval expire; /* time this request is due to expire */
54 struct snmp_pdu *pdu; /* The pdu for this request (saved so it can be retransmitted */
54f642bf 55};
56
57/*
58 * The list of active/open sessions.
59 */
60struct session_list {
61 struct session_list *next;
62 struct snmp_session *session;
63 struct snmp_internal_session *internal;
64};
65
66struct snmp_internal_session {
f53969cc
SM
67 int sd; /* socket descriptor for this connection */
68 struct sockaddr_in addr; /* address of connected peer */
69 struct request_list *requests; /* Info about outstanding requests */
54f642bf 70};
71
72/* Define these here, as they aren't defined normall under
73 * cygnus Win32 stuff.
74 */
75#undef timercmp
76#define timercmp(tvp, uvp, cmp) \
77 (((tvp)->tv_sec) cmp ((uvp)->tv_sec)) || \
78 ((((tvp)->tv_sec) == ((uvp)->tv_sec)) && \
79 (((tvp)->tv_usec) cmp ((uvp)->tv_usec)))
80
81#undef timerclear
82#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
83
84#undef timerisset
85#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
86
32d002cb 87#if HAVE_SRAND
54f642bf 88#define random rand
89#define srandom srand
90#endif /* HAVE_SRAND */
91
92#ifdef __cplusplus
e1381638 93extern "C" {
54f642bf 94#endif
95
f53969cc
SM
96int snmp_get_socket_session(struct snmp_session *session_);
97int snmp_select_info_session(struct snmp_session *session_, struct timeval *timeout);
98int snmp_timeout_session(struct snmp_session *sp_);
54f642bf 99
100#ifdef __cplusplus
101}
54f642bf 102
43d4303e 103#endif
b5638623 104
f53969cc
SM
105#endif /* SQUID_SNMP_API_UTIL_H */
106