snmp_api_util.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
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
9#ifndef SQUID_SNMP_API_UTIL_H
10#define SQUID_SNMP_API_UTIL_H
11
12/* NP: required for typedef ipaddr */
13#include "snmp_pdu.h"
14
15/***********************************************************
16 Copyright 1997 by Carnegie Mellon University
17
18 All Rights Reserved
19
20Permission to use, copy, modify, and distribute this software and its
21documentation for any purpose and without fee is hereby granted,
22provided that the above copyright notice appear in all copies and that
23both that copyright notice and this permission notice appear in
24supporting documentation, and that the name of CMU not be
25used in advertising or publicity pertaining to distribution of the
26software without specific, written prior permission.
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 */
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 */
55};
56
57/*
58 * The list of active/open sessions.
59 */
64};
65
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 */
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
87#if HAVE_SRAND
88#define random rand
89#define srandom srand
90#endif /* HAVE_SRAND */
91
92#ifdef __cplusplus
93extern "C" {
94#endif
95
97int snmp_select_info_session(struct snmp_session *session_, struct timeval *timeout);
99
100#ifdef __cplusplus
101}
102
103#endif
104
105#endif /* SQUID_SNMP_API_UTIL_H */
106
int snmp_select_info_session(struct snmp_session *session_, struct timeval *timeout)
int snmp_get_socket_session(struct snmp_session *session_)
int snmp_timeout_session(struct snmp_session *sp_)
struct timeval time
Definition: snmp_api_util.h:52
struct snmp_pdu * pdu
Definition: snmp_api_util.h:54
struct request_list * next_request
Definition: snmp_api_util.h:48
struct timeval expire
Definition: snmp_api_util.h:53
struct session_list * next
Definition: snmp_api_util.h:61
struct snmp_internal_session * internal
Definition: snmp_api_util.h:63
struct snmp_session * session
Definition: snmp_api_util.h:62
struct sockaddr_in addr
Definition: snmp_api_util.h:68
struct request_list * requests
Definition: snmp_api_util.h:69

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors