Skip to content

Commit 81b65f4

Browse files
committed
Move declarations of global functions and variables from .c to .h
This allows the compiler to verify consistency of variable and function declarations for variables and functions that are used in more than one file.
1 parent 09a42c9 commit 81b65f4

File tree

192 files changed

+313
-589
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+313
-589
lines changed

agent/agent_index.c

-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ struct snmp_index {
6565
struct snmp_index *next_idx;
6666
} *snmp_index_head = NULL;
6767

68-
extern netsnmp_session *main_session;
69-
7068
/*
7169
* The caller is responsible for free()ing the memory returned by
7270
* this function.

agent/agent_registry.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
#include <net-snmp/agent/null.h>
6060
#include <net-snmp/agent/table.h>
6161
#include <net-snmp/agent/table_iterator.h>
62+
#include <net-snmp/agent/agent_index.h>
6263
#include <net-snmp/agent/agent_registry.h>
6364

6465
#ifdef USING_AGENTX_SUBAGENT_MODULE
@@ -1257,7 +1258,6 @@ netsnmp_register_mib(const char *moduleName,
12571258
*/
12581259
if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
12591260
NETSNMP_DS_AGENT_ROLE) != MASTER_AGENT) {
1260-
extern struct snmp_session *main_session;
12611261
if (main_session == NULL) {
12621262
register_mib_detach_node(subtree);
12631263
}
@@ -2236,7 +2236,6 @@ shutdown_tree(void) {
22362236

22372237
}
22382238

2239-
extern void dump_idx_registry(void);
22402239
void
22412240
dump_registry(void)
22422241
{

agent/helpers/old_api.c

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ static void free_wrapper(void * p)
4040
* don't use these!
4141
*/
4242
void set_current_agent_session(netsnmp_agent_session *asp);
43-
netsnmp_agent_session *netsnmp_get_current_agent_session(void);
4443

4544
/** @defgroup old_api old_api
4645
* Calls mib module code written in the old style of code.

agent/mibgroup/Rmon/alarm.c

+1-13
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <net-snmp/net-snmp-includes.h>
4141
#include <net-snmp/agent/net-snmp-agent-includes.h>
4242
#include "alarm.h"
43+
#include "event.h"
4344
/*
4445
* Implementation headers
4546
*/
@@ -128,19 +129,6 @@
128129
0;
129130
#endif
130131

131-
/*
132-
* find & enjoy it in event.c
133-
*/
134-
extern int
135-
event_api_send_alarm(u_char is_rising,
136-
u_long alarm_index,
137-
u_long event_index,
138-
oid * alarmed_var,
139-
size_t alarmed_var_length,
140-
u_long sample_type,
141-
u_long value,
142-
u_long the_threshold, char *alarm_descr);
143-
144132
static int
145133
fetch_var_val(oid * name, size_t namelen, u_long * new_value)
146134
{

agent/mibgroup/Rmon/alarmTable.c

+1-10
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <net-snmp/agent/net-snmp-agent-includes.h>
1616
#include "utilities/iquery.h"
1717
#include "alarmTable.h"
18+
#include "event.h"
1819

1920
netsnmp_feature_require(iquery)
2021
netsnmp_feature_require(query_set_default_session)
@@ -69,16 +70,6 @@ initialize_table_alarmTable(void)
6970
*/
7071
}
7172

72-
extern int
73-
event_api_send_alarm(u_char is_rising,
74-
u_long alarm_index,
75-
u_long event_index,
76-
oid * alarmed_var,
77-
size_t alarmed_var_length,
78-
u_long sample_type,
79-
u_long value,
80-
u_long the_threshold, const char *alarm_descr);
81-
8273
#define ALARM_STR1_LEN 32
8374
typedef enum {
8475
RMON1_ENTRY_VALID = 1,

agent/mibgroup/Rmon/event.h

+8
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,12 @@ config_require(util_funcs)
3030

3131
config_require(Rmon/agutil)
3232
config_require(Rmon/rows)
33+
34+
int
35+
event_api_send_alarm(u_char is_rising, u_long alarm_index,
36+
u_long event_index, oid * alarmed_var,
37+
size_t alarmed_var_length, u_long sample_type,
38+
u_long value, u_long the_threshold,
39+
char *alarm_descr);
40+
3341
#endif /* _MIBGROUP_EVENT_H */

agent/mibgroup/agent/nsTransactionTable.c

-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ init_nsTransactionTable(void)
9595
each appropriately according to the data matching the first row
9696
and return the put_index_data variable at the end of the function.
9797
*/
98-
extern netsnmp_agent_session *agent_delegated_list;
99-
10098
netsnmp_variable_list *
10199
nsTransactionTable_get_first_data_point(void **my_loop_context,
102100
void **my_data_context,

agent/mibgroup/agent/nsVacmAccessTable.h

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ config_add_mib(NET-SNMP-VACM-MIB)
1212
*/
1313
void init_nsVacmAccessTable(void);
1414
void initialize_table_nsVacmAccessTable(void);
15+
void init_register_nsVacm_context(const char *context);
1516
Netsnmp_Node_Handler nsVacmAccessTable_handler;
1617
Netsnmp_First_Data_Point nsVacmAccessTable_get_first_data_point;
1718
Netsnmp_Next_Data_Point nsVacmAccessTable_get_next_data_point;

agent/mibgroup/agentx/client.c

-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ int
104104
agentx_open_session(netsnmp_session * ss)
105105
{
106106
netsnmp_pdu *pdu, *response;
107-
extern oid version_sysoid[];
108-
extern int version_sysoid_len;
109107
u_long timeout;
110108

111109
DEBUGMSGTL(("agentx/subagent", "opening session \n"));

agent/mibgroup/agentx/master_admin.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
#include "agentx/protocol.h"
3737
#include "agentx/client.h"
38+
#include "agentx/subagent.h"
39+
#include "agentx/master_admin.h"
3840

3941
#include <net-snmp/agent/agent_index.h>
4042
#include <net-snmp/agent/agent_trap.h>
@@ -408,8 +410,6 @@ agentx_notify(netsnmp_session * session, netsnmp_pdu *pdu)
408410
{
409411
netsnmp_session *sp;
410412
netsnmp_variable_list *var;
411-
extern const oid sysuptime_oid[], snmptrap_oid[];
412-
extern const size_t sysuptime_oid_len, snmptrap_oid_len;
413413

414414
sp = find_agentx_session(session, pdu->sessid);
415415
if (sp == NULL)

agent/mibgroup/agentx/subagent.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#endif
3232

3333
#include <net-snmp/net-snmp-includes.h>
34+
#include <net-snmp/agent/agent_index.h>
3435
#include <net-snmp/agent/net-snmp-agent-includes.h>
3536
#include <net-snmp/library/snmp_assert.h>
3637

@@ -89,8 +90,6 @@ struct agent_netsnmp_set_info {
8990
static struct agent_netsnmp_set_info *Sets = NULL;
9091

9192
netsnmp_session *agentx_callback_sess = NULL;
92-
extern int callback_master_num;
93-
extern netsnmp_session *main_session; /* from snmp_agent.c */
9493

9594
int
9695
subagent_startup(int majorID, int minorID,

agent/mibgroup/agentx/subagent.h

+9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ config_require(agentx/agentx_config)
1111
config_error(agentx/subagent depends on the Callback transport)
1212
#endif
1313

14+
extern int callback_master_num;
15+
16+
extern const oid snmptrap_oid[];
17+
extern const oid snmptrapenterprise_oid[];
18+
extern const oid sysuptime_oid[];
19+
extern const size_t snmptrap_oid_len;
20+
extern const size_t snmptrapenterprise_oid_len;
21+
extern const size_t sysuptime_oid_len;
22+
1423
int subagent_init(void);
1524
int handle_agentx_packet(int, netsnmp_session *, int,
1625
netsnmp_pdu *, void *);

agent/mibgroup/disman/event/mteEvent.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <net-snmp/net-snmp-features.h>
88
#include <net-snmp/net-snmp-includes.h>
99
#include <net-snmp/agent/net-snmp-agent-includes.h>
10+
#include "agentx/subagent.h"
1011
#include "disman/event/mteEvent.h"
1112
#include "disman/event/mteTrigger.h"
1213
#include "disman/event/mteObjects.h"
@@ -349,8 +350,6 @@ _mteEvent_fire_notify( struct mteEvent *entry, /* The event to fire */
349350
oid *suffix, size_t sfx_len ) /* Matching instance */
350351
{
351352
netsnmp_variable_list *var, *v2;
352-
extern const oid snmptrap_oid[];
353-
extern const size_t snmptrap_oid_len;
354353
netsnmp_session *s;
355354

356355
/*

agent/mibgroup/disman/event/mteScalars.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ handle_mteTriggerFailures(netsnmp_mib_handler *handler,
106106
netsnmp_agent_request_info *reqinfo,
107107
netsnmp_request_info *requests)
108108
{
109-
#ifdef USING_DISMAN_EVENT_MTETRIGGER_MODULE
110-
extern long mteTriggerFailures;
111-
#else
109+
#ifndef USING_DISMAN_EVENT_MTETRIGGER_MODULE
112110
long mteTriggerFailures = 0;
113111
#endif
114112

agent/mibgroup/disman/event/mteTrigger.c

-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ mteTrigger_run( unsigned int reg, void *clientarg)
219219
}
220220

221221
{
222-
extern netsnmp_agent_session *netsnmp_processing_set;
223222
if (netsnmp_processing_set) {
224223
/*
225224
* netsnmp_handle_request will not be responsive to our efforts to

agent/mibgroup/disman/event/mteTrigger.h

+1
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ struct mteTrigger {
184184
* Container structure for the (combined) mteTrigger*Tables,
185185
* and routine to create this.
186186
*/
187+
extern long mteTriggerFailures;
187188
extern netsnmp_tdata *trigger_table_data;
188189
extern void init_trigger_table_data(void);
189190

agent/mibgroup/disman/expression/expErrorTable.c

-3
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ struct variable2 expErrorTable_variables[] = {
7979
var_expErrorTable, 2, {1, 4}}
8080
};
8181

82-
extern struct header_complex_index *expExpressionTableStorage;
83-
84-
8582
void
8683
init_expErrorTable(void)
8784
{

agent/mibgroup/disman/expression/expExpressionTable.c

-2
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ struct variable2 expExpressionTable_variables[] = {
9797
*/
9898

9999
struct header_complex_index *expExpressionTableStorage = NULL;
100-
extern struct header_complex_index *expObjectTableStorage;
101-
extern struct header_complex_index *expValueTableStorage;
102100

103101
oid mmTimeInstance[] = { 1, 3, 6, 1, 2, 1, 1, 3, 0 };
104102

agent/mibgroup/disman/expression/expExpressionTable.h

+2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ config_require(header_complex)
116116
#define EXP_FAILURE_DIVIDEBYZERO 11
117117

118118

119+
extern struct header_complex_index *expExpressionTableStorage;
120+
119121
/*
120122
* function prototypes
121123
*/

agent/mibgroup/disman/expression/expObjectTable.c

-6
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ struct variable2 expObjectTable_variables[] = {
9999
};
100100

101101

102-
/*
103-
* global storage of our data, saved in and configured by header_complex()
104-
*/
105-
extern struct header_complex_index *expExpressionTableStorage;
106-
extern struct header_complex_index *expValueTableStorage;
107-
108102
struct header_complex_index *expObjectTableStorage = NULL;
109103

110104
/*

agent/mibgroup/disman/expression/expObjectTable.h

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ config_require(header_complex)
6868
#define EXPOBJCETSAMPLETYPE_ABSOLUTEVALUE 1
6969
#define EXPOBJCETSAMPLETYPE_DELTAVALUE 2
7070
#define EXPOBJCETSAMPLETYPE_CHANGEVALUE 3
71+
72+
extern struct header_complex_index *expObjectTableStorage;
73+
7174
/*
7275
* function prototypes
7376
*/

agent/mibgroup/disman/expression/expValueTable.c

-5
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,6 @@ static const struct variable2 expValueTable_variables[] = {
104104
};
105105

106106

107-
/*
108-
* global storage of our data, saved in and configured by header_complex()
109-
*/
110-
extern struct header_complex_index *expExpressionTableStorage;
111-
extern struct header_complex_index *expObjectTableStorage;
112107
static struct header_complex_index *expValueTableStorage = NULL;
113108

114109
/*

agent/mibgroup/disman/mteTriggerBooleanTable.c

-6
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,6 @@ struct variable2 mteTriggerBooleanTable_variables[] = {
109109
*/
110110

111111

112-
/*
113-
* global storage of our data, saved in and configured by header_complex()
114-
*/
115-
extern struct header_complex_index *mteTriggerTableStorage;
116-
117-
118112
/*
119113
* init_mteTriggerBooleanTable():
120114
* Initialization routine. This is called when the agent starts up.

agent/mibgroup/disman/mteTriggerDeltaTable.c

-7
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,6 @@ struct variable2 mteTriggerDeltaTable_variables[] = {
8585
*/
8686

8787

88-
/*
89-
* global storage of our data, saved in and configured by header_complex()
90-
*/
91-
extern struct header_complex_index *mteTriggerTableStorage;
92-
93-
94-
9588
/*
9689
* init_mteTriggerDeltaTable():
9790
* Initialization routine. This is called when the agent starts up.

agent/mibgroup/disman/mteTriggerExistenceTable.c

-8
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,6 @@ struct variable2 mteTriggerExistenceTable_variables[] = {
103103
*/
104104

105105

106-
/*
107-
* global storage of our data, saved in and configured by header_complex()
108-
*/
109-
extern struct header_complex_index *mteTriggerTableStorage;
110-
111-
112-
113-
114106
/*
115107
* init_mteTriggerExistenceTable():
116108
* Initialization routine. This is called when the agent starts up.

agent/mibgroup/disman/mteTriggerTable.c

-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ struct variable2 mteTriggerTable_variables[] = {
189189
struct header_complex_index *mteTriggerTableStorage = NULL;
190190

191191
netsnmp_session *mte_callback_sess = NULL;
192-
extern int callback_master_num;
193192

194193
/*
195194
* init_mteTriggerTable():

agent/mibgroup/disman/mteTriggerTable.h

+2
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ config_error(disman/mteTriggerTable depends on the Callback transport)
215215
#define MTE_FAILURE_SAMPLEOVERRUN -6
216216

217217

218+
extern struct header_complex_index *mteTriggerTableStorage;
219+
218220
/*
219221
* function prototypes
220222
*/

agent/mibgroup/disman/mteTriggerThresholdTable.c

-5
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,6 @@ struct variable2 mteTriggerThresholdTable_variables[] = {
157157
* (L = length of the oidsuffix)
158158
*/
159159

160-
/*
161-
* global storage of our data, saved in and configured by header_complex()
162-
*/
163-
extern struct header_complex_index *mteTriggerTableStorage;
164-
165160

166161
/*
167162
* init_mteTriggerThresholdTable():

agent/mibgroup/disman/nslookup/lookupCtlTable.h

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ struct lookupResultsTable_data {
5656
int storagetype;
5757
};
5858

59+
extern struct header_complex_index *lookupCtlTableStorage;
60+
extern struct header_complex_index *lookupResultsTableStorage;
61+
5962
/*
6063
* function declarations
6164
*/

agent/mibgroup/disman/nslookup/lookupResultsTable.c

-6
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ struct variable2 lookupResultsTable_variables[] = {
3434
var_lookupResultsTable, 2, {1, 3}}
3535
};
3636

37-
/*
38-
* global storage of our data, saved in and configured by header_complex()
39-
*/
40-
41-
extern struct header_complex_index *lookupCtlTableStorage;
42-
extern struct header_complex_index *lookupResultsTableStorage;
4337

4438
int
4539
lookupResultsTable_inadd(struct lookupResultsTable_data *thedata);

agent/mibgroup/disman/ping/pingCtlTable.h

+3
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ struct pingProbeHistoryTable_data {
201201

202202
};
203203

204+
extern struct header_complex_index *pingCtlTableStorage;
205+
extern struct header_complex_index *pingResultsTableStorage;
206+
extern struct header_complex_index *pingProbeHistoryTableStorage;
204207

205208
/*
206209
* function declarations

0 commit comments

Comments
 (0)