2
* Note: this file originally auto-generated by mib2c using
3
* : mib2c.notify.conf,v 5.3 2004/04/15 12:29:19 dts12 Exp $
6
#include <net-snmp/net-snmp-config.h>
7
#include <net-snmp/net-snmp-includes.h>
8
#include <net-snmp/agent/net-snmp-agent-includes.h>
10
#include <impl/i18n.h>
11
#include <impl/framework.h>
12
#include <impl/receiver.h>
13
#include <impl/socket.h>
16
#include "impl/pgmMIB.h"
17
#include "impl/pgmMIB_columns.h"
18
#include "impl/pgmMIB_enums.h"
21
//#define PGMMIB_DEBUG
26
struct pgm_snmp_data_context_t {
31
typedef struct pgm_snmp_data_context_t pgm_snmp_data_context_t;
33
struct pgm_snmp_context_t {
36
int index; /* table index */
37
unsigned instance; /* unique number per node */
38
pgm_snmp_data_context_t data_context;
41
typedef struct pgm_snmp_context_t pgm_snmp_context_t;
44
static const oid snmptrap_oid[] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};
49
static int initialize_table_pgmSourceTable(void);
50
static Netsnmp_Node_Handler pgmSourceTable_handler;
51
static Netsnmp_First_Data_Point pgmSourceTable_get_first_data_point;
52
static Netsnmp_Next_Data_Point pgmSourceTable_get_next_data_point;
53
static Netsnmp_Free_Loop_Context pgmSourceTable_free_loop_context;
55
static int initialize_table_pgmSourceConfigTable(void);
56
static Netsnmp_Node_Handler pgmSourceConfigTable_handler;
57
static Netsnmp_First_Data_Point pgmSourceConfigTable_get_first_data_point;
58
static Netsnmp_Next_Data_Point pgmSourceConfigTable_get_next_data_point;
59
static Netsnmp_Free_Loop_Context pgmSourceConfigTable_free_loop_context;
61
static int initialize_table_pgmSourcePerformanceTable(void);
62
static Netsnmp_Node_Handler pgmSourcePerformanceTable_handler;
63
static Netsnmp_First_Data_Point pgmSourcePerformanceTable_get_first_data_point;
64
static Netsnmp_Next_Data_Point pgmSourcePerformanceTable_get_next_data_point;
65
static Netsnmp_Free_Loop_Context pgmSourcePerformanceTable_free_loop_context;
67
static int initialize_table_pgmReceiverTable(void);
68
static Netsnmp_Node_Handler pgmReceiverTable_handler;
69
static Netsnmp_First_Data_Point pgmReceiverTable_get_first_data_point;
70
static Netsnmp_Next_Data_Point pgmReceiverTable_get_next_data_point;
71
static Netsnmp_Free_Loop_Context pgmReceiverTable_free_loop_context;
73
static int initialize_table_pgmReceiverConfigTable(void);
74
static Netsnmp_Node_Handler pgmReceiverConfigTable_handler;
75
static Netsnmp_First_Data_Point pgmReceiverConfigTable_get_first_data_point;
76
static Netsnmp_Next_Data_Point pgmReceiverConfigTable_get_next_data_point;
77
static Netsnmp_Free_Loop_Context pgmReceiverConfigTable_free_loop_context;
79
static int initialize_table_pgmReceiverPerformanceTable(void);
80
static Netsnmp_Node_Handler pgmReceiverPerformanceTable_handler;
81
static Netsnmp_First_Data_Point pgmReceiverPerformanceTable_get_first_data_point;
82
static Netsnmp_Next_Data_Point pgmReceiverPerformanceTable_get_next_data_point;
83
static Netsnmp_Free_Loop_Context pgmReceiverPerformanceTable_free_loop_context;
91
if (MIB_REGISTERED_OK != initialize_table_pgmSourceTable()) {
93
PGM_ERROR_DOMAIN_SNMP,
95
_("pgmSourceTable registration: see SNMP log for further details."));
98
if (MIB_REGISTERED_OK != initialize_table_pgmSourceConfigTable()) {
100
PGM_ERROR_DOMAIN_SNMP,
102
_("pgmSourceConfigTable registration: see SNMP log for further details."));
105
if (MIB_REGISTERED_OK != initialize_table_pgmSourcePerformanceTable()) {
106
pgm_set_error (error,
107
PGM_ERROR_DOMAIN_SNMP,
109
_("pgmSourcePerformanceTable registration: see SNMP log for further details."));
112
if (MIB_REGISTERED_OK != initialize_table_pgmReceiverTable()) {
113
pgm_set_error (error,
114
PGM_ERROR_DOMAIN_SNMP,
116
_("pgmReceiverTable registration: see SNMP log for further details."));
119
if (MIB_REGISTERED_OK != initialize_table_pgmReceiverConfigTable()) {
120
pgm_set_error (error,
121
PGM_ERROR_DOMAIN_SNMP,
123
_("pgmReceiverConfigTable registration: see SNMP log for further details."));
126
if (MIB_REGISTERED_OK != initialize_table_pgmReceiverPerformanceTable()) {
127
pgm_set_error (error,
128
PGM_ERROR_DOMAIN_SNMP,
130
_("pgmReceiverPerformanceTable registration: see SNMP log for further details."));
140
* returns MIB_REGISTERED_OK on success, failures include:
141
* MIB_REGISTRATION_FAILED
142
* MIB_DUPLICATE_REGISTRATION
148
initialize_table_pgmSourceTable (void)
150
pgm_debug ("initialize_table_pgmSourceTable ()");
152
static const oid pgmSourceTable_oid[] = {1,3,6,1,3,112,1,2,100,2};
153
netsnmp_table_registration_info* table_info = NULL;
154
netsnmp_iterator_info* iinfo = NULL;
155
netsnmp_handler_registration* reg = NULL;
157
reg = netsnmp_create_handler_registration ("pgmSourceTable", pgmSourceTable_handler,
158
pgmSourceTable_oid, OID_LENGTH( pgmSourceTable_oid ),
163
table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
164
if (NULL == table_info)
167
table_info->min_column = COLUMN_PGMSOURCESOURCEADDRESS;
168
table_info->max_column = COLUMN_PGMSOURCESOURCEPORTNUMBER;
170
netsnmp_table_helper_add_indexes (table_info,
171
ASN_OCTET_STR, /* index: pgmSourceGlobalId */
172
ASN_UNSIGNED, /* index: pgmSourceSourcePort */
175
iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
179
iinfo->get_first_data_point = pgmSourceTable_get_first_data_point;
180
iinfo->get_next_data_point = pgmSourceTable_get_next_data_point;
181
iinfo->free_loop_context_at_end = pgmSourceTable_free_loop_context;
182
iinfo->table_reginfo = table_info;
184
return netsnmp_register_table_iterator (reg, iinfo);
187
if (table_info && table_info->indexes) /* table_data_free_func() is internal */
188
snmp_free_var (table_info->indexes);
189
SNMP_FREE( table_info );
191
netsnmp_handler_registration_free (reg);
196
/* called for first row of data in SNMP table
198
* goal is to cache all the relevant data for subsequent get_next_data_point (row) calls in my_loop_context,
199
* optionally returns my_data_context.
201
* returns answer or NULL
205
netsnmp_variable_list*
206
pgmSourceTable_get_first_data_point(
207
void** my_loop_context, /* valid through one query of multiple "data points" */
208
void** my_data_context, /* answer blob which is passed to handler() */
209
netsnmp_variable_list* put_index_data, /* answer */
210
netsnmp_iterator_info* mydata /* iinfo on init() */
214
pgm_assert (NULL != my_loop_context);
215
pgm_assert (NULL != my_data_context);
216
pgm_assert (NULL != put_index_data);
217
pgm_assert (NULL != mydata);
219
pgm_debug ("pgmSourceTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
220
(const void*)my_loop_context,
221
(const void*)my_data_context,
222
(const void*)put_index_data,
223
(const void*)mydata);
225
pgm_rwlock_reader_lock (&pgm_sock_list_lock);
227
if (NULL == pgm_sock_list) {
228
pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
232
/* create our own context for this SNMP loop */
233
pgm_snmp_context_t* context = pgm_new0 (pgm_snmp_context_t, 1);
234
context->list = pgm_sock_list;
235
*my_loop_context = context;
237
/* pass on for generic row access */
238
return pgmSourceTable_get_next_data_point (my_loop_context, my_data_context, put_index_data, mydata);
242
netsnmp_variable_list*
243
pgmSourceTable_get_next_data_point(
244
void** my_loop_context,
245
void** my_data_context,
246
netsnmp_variable_list* put_index_data,
247
netsnmp_iterator_info* mydata
251
pgm_assert (NULL != my_loop_context);
252
pgm_assert (NULL != my_data_context);
253
pgm_assert (NULL != put_index_data);
254
pgm_assert (NULL != mydata);
256
pgm_debug ("pgmSourceTable_get_next_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
257
(const void*)my_loop_context,
258
(const void*)my_data_context,
259
(const void*)put_index_data,
260
(const void*)mydata);
262
pgm_snmp_context_t* context = (pgm_snmp_context_t*)*my_loop_context;
263
netsnmp_variable_list *idx = put_index_data;
265
if (NULL == context->list)
268
pgm_sock_t* sock = context->list->data;
270
/* pgmSourceGlobalId */
271
char gsi[ PGM_GSISTRLEN ];
272
pgm_gsi_print_r (&sock->tsi.gsi, gsi, sizeof(gsi));
273
snmp_set_var_typed_value (idx, ASN_OCTET_STR, (const u_char*)&gsi, strlen (gsi));
274
idx = idx->next_variable;
276
/* pgmSourceSourcePort */
277
const unsigned sport = ntohs (sock->tsi.sport);
278
snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&sport, sizeof(sport));
280
*my_data_context = sock;
281
context->list = context->list->next;
283
return put_index_data;
288
pgmSourceTable_free_loop_context (
289
void* my_loop_context,
290
netsnmp_iterator_info* mydata
294
pgm_assert (NULL != my_loop_context);
295
pgm_assert (NULL != mydata);
297
pgm_debug ("pgmSourceTable_free_loop_context (my_loop_context:%p mydata:%p)",
298
(const void*)my_loop_context,
299
(const void*)mydata);
301
pgm_snmp_context_t* context = (pgm_snmp_context_t*)my_loop_context;
303
my_loop_context = NULL;
305
pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
310
pgmSourceTable_handler (
311
netsnmp_mib_handler* handler,
312
netsnmp_handler_registration* reginfo,
313
netsnmp_agent_request_info* reqinfo,
314
netsnmp_request_info* requests
318
pgm_assert (NULL != handler);
319
pgm_assert (NULL != reginfo);
320
pgm_assert (NULL != reqinfo);
321
pgm_assert (NULL != requests);
323
pgm_debug ("pgmSourceTable_handler (handler:%p reginfo:%p reqinfo:%p requests:%p)",
324
(const void*)handler,
325
(const void*)reginfo,
326
(const void*)reqinfo,
327
(const void*)requests);
329
switch (reqinfo->mode) {
331
/* Read-support (also covers GetNext requests) */
334
for (netsnmp_request_info* request = requests;
336
request = request->next)
338
const pgm_sock_t* sock = (pgm_sock_t*)netsnmp_extract_iterator_context (request);
340
netsnmp_set_request_error (reqinfo, request, SNMP_NOSUCHINSTANCE);
344
netsnmp_variable_list *var = request->requestvb;
345
netsnmp_table_request_info* table_info = netsnmp_extract_table_info (request);
346
if (NULL == table_info) {
347
snmp_log (LOG_ERR, "pgmSourceTable_handler: empty table request info.\n");
351
switch (table_info->colnum) {
353
case COLUMN_PGMSOURCESOURCEADDRESS:
355
struct sockaddr_in s4;
356
if (AF_INET == sock->send_gsr.gsr_source.ss_family)
357
memcpy (&s4, &sock->send_gsr.gsr_source, sizeof(s4));
359
memset (&s4, 0, sizeof(s4));
360
snmp_set_var_typed_value (var, ASN_IPADDRESS,
361
(const u_char*)&s4.sin_addr.s_addr,
362
sizeof(struct in_addr) );
366
case COLUMN_PGMSOURCEGROUPADDRESS:
368
struct sockaddr_in s4;
369
if (AF_INET == sock->send_gsr.gsr_group.ss_family)
370
memcpy (&s4, &sock->send_gsr.gsr_group, sizeof(s4));
372
memset (&s4, 0, sizeof(s4));
373
snmp_set_var_typed_value (var, ASN_IPADDRESS,
374
(const u_char*)&s4.sin_addr.s_addr,
375
sizeof(struct in_addr) );
379
case COLUMN_PGMSOURCEDESTPORT:
381
const unsigned dport = ntohs (sock->dport);
382
snmp_set_var_typed_value (var, ASN_UNSIGNED,
383
(const u_char*)&dport, sizeof(dport) );
388
case COLUMN_PGMSOURCESOURCEGSI:
389
snmp_set_var_typed_value (var, ASN_OCTET_STR,
390
(const u_char*)table_info->indexes->val.string,
391
table_info->indexes->val_len);
395
case COLUMN_PGMSOURCESOURCEPORTNUMBER:
396
snmp_set_var_typed_value (var, ASN_UNSIGNED,
397
(const u_char*)table_info->indexes->next_variable->val.integer,
398
table_info->indexes->next_variable->val_len);
403
snmp_log (LOG_ERR, "pgmSourceTable_handler: unknown column.\n");
409
case MODE_SET_RESERVE1:
411
snmp_log (LOG_ERR, "pgmSourceTable_handler: unsupported mode.\n");
416
return SNMP_ERR_NOERROR;
420
* pgmSourceConfigTable
426
initialize_table_pgmSourceConfigTable(void)
428
pgm_debug ("initialize_table_pgmSourceConfigTable ()");
430
static const oid pgmSourceConfigTable_oid[] = {1,3,6,1,3,112,1,2,100,3};
431
netsnmp_table_registration_info* table_info = NULL;
432
netsnmp_iterator_info* iinfo = NULL;
433
netsnmp_handler_registration* reg = NULL;
435
reg = netsnmp_create_handler_registration ("pgmSourceConfigTable", pgmSourceConfigTable_handler,
436
pgmSourceConfigTable_oid, OID_LENGTH( pgmSourceConfigTable_oid ),
441
table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
442
if (NULL == table_info)
445
table_info->min_column = COLUMN_PGMSOURCETTL;
446
table_info->max_column = COLUMN_PGMSOURCESPMPATHADDRESS;
448
netsnmp_table_helper_add_indexes (table_info,
449
ASN_OCTET_STR, /* index: pgmSourceConfigGlobalId */
450
ASN_UNSIGNED, /* index: pgmSourceConfigSourcePort */
453
iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
457
iinfo->get_first_data_point = pgmSourceConfigTable_get_first_data_point;
458
iinfo->get_next_data_point = pgmSourceConfigTable_get_next_data_point;
459
iinfo->free_loop_context_at_end = pgmSourceConfigTable_free_loop_context;
460
iinfo->table_reginfo = table_info;
462
return netsnmp_register_table_iterator (reg, iinfo);
465
if (table_info && table_info->indexes) /* table_data_free_func() is internal */
466
snmp_free_var (table_info->indexes);
467
SNMP_FREE( table_info );
469
netsnmp_handler_registration_free (reg);
474
/* called for first row of data in SNMP table
476
* goal is to cache all the relevant data for subsequent get_next_data_point (row) calls in my_loop_context,
477
* optionally returns my_data_context.
479
* returns answer or NULL
483
netsnmp_variable_list*
484
pgmSourceConfigTable_get_first_data_point(
485
void** my_loop_context, /* valid through one query of multiple "data points" */
486
void** my_data_context, /* answer blob which is passed to handler() */
487
netsnmp_variable_list* put_index_data, /* answer */
488
netsnmp_iterator_info* mydata /* iinfo on init() */
492
pgm_assert (NULL != my_loop_context);
493
pgm_assert (NULL != my_data_context);
494
pgm_assert (NULL != put_index_data);
495
pgm_assert (NULL != mydata);
497
pgm_debug ("pgmSourceConfigTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
498
(const void*)my_loop_context,
499
(const void*)my_data_context,
500
(const void*)put_index_data,
501
(const void*)mydata);
503
pgm_rwlock_reader_lock (&pgm_sock_list_lock);
505
if (NULL == pgm_sock_list) {
506
pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
510
/* create our own context for this SNMP loop */
511
pgm_snmp_context_t* context = pgm_new0 (pgm_snmp_context_t, 1);
512
context->list = pgm_sock_list;
513
*my_loop_context = context;
515
/* pass on for generic row access */
516
return pgmSourceConfigTable_get_next_data_point (my_loop_context, my_data_context, put_index_data, mydata);
520
netsnmp_variable_list*
521
pgmSourceConfigTable_get_next_data_point(
522
void** my_loop_context,
523
void** my_data_context,
524
netsnmp_variable_list* put_index_data,
525
netsnmp_iterator_info* mydata
529
pgm_assert (NULL != my_loop_context);
530
pgm_assert (NULL != my_data_context);
531
pgm_assert (NULL != put_index_data);
532
pgm_assert (NULL != mydata);
534
pgm_debug ("pgmSourceConfigTable_get_next_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
535
(const void*)my_loop_context,
536
(const void*)my_data_context,
537
(const void*)put_index_data,
538
(const void*)mydata);
540
pgm_snmp_context_t* context = (pgm_snmp_context_t*)*my_loop_context;
541
netsnmp_variable_list *idx = put_index_data;
543
if (NULL == context->list)
546
pgm_sock_t* sock = context->list->data;
548
/* pgmSourceGlobalId */
549
char gsi[ PGM_GSISTRLEN ];
550
pgm_gsi_print_r (&sock->tsi.gsi, gsi, sizeof(gsi));
551
snmp_set_var_typed_value (idx, ASN_OCTET_STR, (const u_char*)&gsi, strlen (gsi));
552
idx = idx->next_variable;
554
/* pgmSourceSourcePort */
555
const unsigned sport = ntohs (sock->tsi.sport);
556
snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&sport, sizeof(sport));
558
*my_data_context = sock;
559
context->list = context->list->next;
561
return put_index_data;
566
pgmSourceConfigTable_free_loop_context (
567
void* my_loop_context,
568
netsnmp_iterator_info* mydata
572
pgm_assert (NULL != my_loop_context);
573
pgm_assert (NULL != mydata);
575
pgm_debug ("pgmSourceConfigTable_free_loop_context (my_loop_context:%p mydata:%p)",
576
(const void*)my_loop_context,
577
(const void*)mydata);
579
pgm_snmp_context_t* context = (pgm_snmp_context_t*)my_loop_context;
581
my_loop_context = NULL;
583
pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
588
pgmSourceConfigTable_handler (
589
netsnmp_mib_handler* handler,
590
netsnmp_handler_registration* reginfo,
591
netsnmp_agent_request_info* reqinfo,
592
netsnmp_request_info* requests
596
pgm_assert (NULL != handler);
597
pgm_assert (NULL != reginfo);
598
pgm_assert (NULL != reqinfo);
599
pgm_assert (NULL != requests);
601
pgm_debug ("pgmSourceConfigTable_handler (handler:%p reginfo:%p reqinfo:%p requests:%p)",
602
(const void*)handler,
603
(const void*)reginfo,
604
(const void*)reqinfo,
605
(const void*)requests);
607
switch (reqinfo->mode) {
609
/* Read-support (also covers GetNext requests) */
612
for (netsnmp_request_info* request = requests;
614
request = request->next)
616
const pgm_sock_t* sock = (pgm_sock_t*)netsnmp_extract_iterator_context (request);
618
netsnmp_set_request_error (reqinfo, request, SNMP_NOSUCHINSTANCE);
622
netsnmp_variable_list *var = request->requestvb;
623
netsnmp_table_request_info* table_info = netsnmp_extract_table_info (request);
624
if (NULL == table_info) {
625
snmp_log (LOG_ERR, "pgmSourceTable_handler: empty table request info.\n");
629
switch (table_info->colnum) {
631
case COLUMN_PGMSOURCETTL:
633
const unsigned hops = sock->hops;
634
snmp_set_var_typed_value (var, ASN_UNSIGNED,
635
(const u_char*)&hops, sizeof(hops) );
639
case COLUMN_PGMSOURCEADVMODE:
641
const unsigned adv_mode = 0 == sock->adv_mode ? PGMSOURCEADVMODE_TIME : PGMSOURCEADVMODE_DATA;
642
snmp_set_var_typed_value (var, ASN_INTEGER,
643
(const u_char*)&adv_mode, sizeof(adv_mode) );
647
/* FIXED: pgmSourceLateJoin = disable(2) */
648
case COLUMN_PGMSOURCELATEJOIN:
650
const unsigned late_join = PGMSOURCELATEJOIN_DISABLE;
651
snmp_set_var_typed_value (var, ASN_INTEGER,
652
(const u_char*)&late_join, sizeof(late_join) );
656
case COLUMN_PGMSOURCETXWMAXRTE:
658
const unsigned txw_max_rte = sock->txw_max_rte;
659
snmp_set_var_typed_value (var, ASN_UNSIGNED,
660
(const u_char*)&txw_max_rte, sizeof(txw_max_rte) );
664
case COLUMN_PGMSOURCETXWSECS:
666
const unsigned txw_secs = sock->txw_secs;
667
snmp_set_var_typed_value (var, ASN_UNSIGNED,
668
(const u_char*)&txw_secs, sizeof(txw_secs) );
672
/* FIXED: TXW_ADV_SECS = 0 */
673
case COLUMN_PGMSOURCETXWADVSECS:
675
const unsigned txw_adv_secs = 0;
676
snmp_set_var_typed_value (var, ASN_UNSIGNED,
677
(const u_char*)&txw_adv_secs, sizeof(txw_adv_secs) );
681
/* FIXED: pgmSourceAdvIvl = TXW_ADV_SECS * 1000 = 0 */
682
case COLUMN_PGMSOURCEADVIVL:
684
const unsigned adv_ivl = 0;
685
snmp_set_var_typed_value (var, ASN_UNSIGNED,
686
(const u_char*)&adv_ivl, sizeof(adv_ivl) );
690
case COLUMN_PGMSOURCESPMIVL:
692
const unsigned spm_ivl = pgm_to_msecs (sock->spm_ambient_interval);
693
snmp_set_var_typed_value (var, ASN_UNSIGNED,
694
(const u_char*)&spm_ivl, sizeof(spm_ivl) );
699
case COLUMN_PGMSOURCESPMHEARTBEATIVLMIN:
701
const unsigned ihb_min = 0;
702
snmp_set_var_typed_value (var, ASN_UNSIGNED,
703
(const u_char*)&ihb_min, sizeof(ihb_min) );
708
case COLUMN_PGMSOURCESPMHEARTBEATIVLMAX:
710
const unsigned ihb_max = 0;
711
snmp_set_var_typed_value (var, ASN_UNSIGNED,
712
(const u_char*)&ihb_max, sizeof(ihb_max) );
717
case COLUMN_PGMSOURCERDATABACKOFFIVL:
719
const unsigned nak_bo_ivl = pgm_to_msecs (sock->nak_bo_ivl);
720
snmp_set_var_typed_value (var, ASN_UNSIGNED,
721
(const u_char*)&nak_bo_ivl, sizeof(nak_bo_ivl) );
725
/* FIXED: pgmSourceFEC = disabled(1) */
726
case COLUMN_PGMSOURCEFEC:
728
const unsigned fec = (sock->use_ondemand_parity || sock->use_proactive_parity) ? 1 : 0;
729
snmp_set_var_typed_value (var, ASN_INTEGER,
730
(const u_char*)&fec, sizeof(fec) );
734
/* FIXED: pgmSourceFECTransmissionGrpSize = 0 */
735
case COLUMN_PGMSOURCEFECTRANSMISSIONGRPSIZE:
737
const unsigned fec_tgs = sock->rs_k;
738
snmp_set_var_typed_value (var, ASN_UNSIGNED,
739
(const u_char*)&fec_tgs, sizeof(fec_tgs) );
743
/* FIXED: pgmSourceFECProactiveParitySize = 0 */
744
case COLUMN_PGMSOURCEFECPROACTIVEPARITYSIZE:
746
const unsigned fec_paps = sock->rs_proactive_h;
747
snmp_set_var_typed_value (var, ASN_UNSIGNED,
748
(const u_char*)&fec_paps, sizeof(fec_paps) );
752
/* IPv6 not supported */
753
case COLUMN_PGMSOURCESPMPATHADDRESS:
755
struct sockaddr_in s4;
756
if (AF_INET == sock->recv_gsr[0].gsr_source.ss_family)
757
memcpy (&s4, &sock->recv_gsr[0].gsr_source, sizeof(s4));
759
memset (&s4, 0, sizeof(s4));
760
snmp_set_var_typed_value (var, ASN_IPADDRESS,
761
(const u_char*)&s4.sin_addr.s_addr,
762
sizeof(struct in_addr) );
767
snmp_log (LOG_ERR, "pgmSourceConfigTable_handler: unknown column.\n");
773
case MODE_SET_RESERVE1:
775
snmp_log (LOG_ERR, "pgmSourceConfigTable_handler: unsupported mode.\n");
780
return SNMP_ERR_NOERROR;
784
* pgmSourcePerformanceTable
789
initialize_table_pgmSourcePerformanceTable (void)
791
pgm_debug ("initialize_table_pgmSourcePerformanceTable ()");
793
static const oid pgmSourcePerformanceTable_oid[] = {1,3,6,1,3,112,1,2,100,4};
794
netsnmp_table_registration_info* table_info = NULL;
795
netsnmp_iterator_info* iinfo = NULL;
796
netsnmp_handler_registration* reg = NULL;
798
reg = netsnmp_create_handler_registration ("pgmSourcePerformanceTable", pgmSourcePerformanceTable_handler,
799
pgmSourcePerformanceTable_oid, OID_LENGTH( pgmSourcePerformanceTable_oid ),
804
table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
805
if (NULL == table_info)
808
table_info->min_column = COLUMN_PGMSOURCEDATABYTESSENT;
809
table_info->max_column = COLUMN_PGMSOURCENNAKERRORS;
811
netsnmp_table_helper_add_indexes (table_info,
812
ASN_OCTET_STR, /* index: pgmSourceGlobalId */
813
ASN_UNSIGNED, /* index: pgmSourceSourcePort */
816
iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
820
iinfo->get_first_data_point = pgmSourcePerformanceTable_get_first_data_point;
821
iinfo->get_next_data_point = pgmSourcePerformanceTable_get_next_data_point;
822
iinfo->free_loop_context_at_end = pgmSourcePerformanceTable_free_loop_context;
823
iinfo->table_reginfo = table_info;
825
return netsnmp_register_table_iterator (reg, iinfo);
828
if (table_info && table_info->indexes) /* table_data_free_func() is internal */
829
snmp_free_var (table_info->indexes);
830
SNMP_FREE( table_info );
832
netsnmp_handler_registration_free (reg);
837
/* called for first row of data in SNMP table
839
* goal is to cache all the relevant data for subsequent get_next_data_point (row) calls in my_loop_context,
840
* optionally returns my_data_context.
842
* returns answer or NULL
846
netsnmp_variable_list*
847
pgmSourcePerformanceTable_get_first_data_point (
848
void** my_loop_context, /* valid through one query of multiple "data points" */
849
void** my_data_context, /* answer blob which is passed to handler() */
850
netsnmp_variable_list* put_index_data, /* answer */
851
netsnmp_iterator_info* mydata /* iinfo on init() */
855
pgm_assert (NULL != my_loop_context);
856
pgm_assert (NULL != my_data_context);
857
pgm_assert (NULL != put_index_data);
858
pgm_assert (NULL != mydata);
860
pgm_debug ("pgmSourcePerformanceTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
861
(const void*)my_loop_context,
862
(const void*)my_data_context,
863
(const void*)put_index_data,
864
(const void*)mydata);
866
pgm_rwlock_reader_lock (&pgm_sock_list_lock);
868
if (NULL == pgm_sock_list) {
869
pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
873
/* create our own context for this SNMP loop */
874
pgm_snmp_context_t* context = pgm_new0 (pgm_snmp_context_t, 1);
875
context->list = pgm_sock_list;
876
*my_loop_context = context;
878
/* pass on for generic row access */
879
return pgmSourcePerformanceTable_get_next_data_point (my_loop_context, my_data_context, put_index_data, mydata);
883
netsnmp_variable_list*
884
pgmSourcePerformanceTable_get_next_data_point (
885
void** my_loop_context,
886
void** my_data_context,
887
netsnmp_variable_list* put_index_data,
888
netsnmp_iterator_info* mydata
892
pgm_assert (NULL != my_loop_context);
893
pgm_assert (NULL != my_data_context);
894
pgm_assert (NULL != put_index_data);
895
pgm_assert (NULL != mydata);
897
pgm_debug ("pgmSourcePerformanceTable_get_next_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
898
(const void*)my_loop_context,
899
(const void*)my_data_context,
900
(const void*)put_index_data,
901
(const void*)mydata);
903
pgm_snmp_context_t* context = (pgm_snmp_context_t*)*my_loop_context;
904
netsnmp_variable_list *idx = put_index_data;
906
if (NULL == context->list)
909
pgm_sock_t* sock = context->list->data;
911
/* pgmSourceGlobalId */
912
char gsi[ PGM_GSISTRLEN ];
913
pgm_gsi_print_r (&sock->tsi.gsi, gsi, sizeof(gsi));
914
snmp_set_var_typed_value (idx, ASN_OCTET_STR, (const u_char*)&gsi, strlen (gsi));
915
idx = idx->next_variable;
917
/* pgmSourceSourcePort */
918
const unsigned sport = ntohs (sock->tsi.sport);
919
snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&sport, sizeof(sport));
921
*my_data_context = sock;
922
context->list = context->list->next;
924
return put_index_data;
929
pgmSourcePerformanceTable_free_loop_context (
930
void* my_loop_context,
931
netsnmp_iterator_info* mydata
935
pgm_assert (NULL != my_loop_context);
936
pgm_assert (NULL != mydata);
938
pgm_debug ("pgmPerformanceSourceTable_free_loop_context (my_loop_context:%p mydata:%p)",
939
(const void*)my_loop_context,
940
(const void*)mydata);
942
pgm_snmp_context_t* context = (pgm_snmp_context_t*)my_loop_context;
944
my_loop_context = NULL;
946
pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
951
pgmSourcePerformanceTable_handler (
952
netsnmp_mib_handler* handler,
953
netsnmp_handler_registration* reginfo,
954
netsnmp_agent_request_info* reqinfo,
955
netsnmp_request_info* requests
959
pgm_assert (NULL != handler);
960
pgm_assert (NULL != reginfo);
961
pgm_assert (NULL != reqinfo);
962
pgm_assert (NULL != requests);
964
pgm_debug ("pgmSourcePerformanceTable_handler (handler:%p reginfo:%p reqinfo:%p requests:%p)",
965
(const void*)handler,
966
(const void*)reginfo,
967
(const void*)reqinfo,
968
(const void*)requests);
970
switch (reqinfo->mode) {
972
/* Read-support (also covers GetNext requests) */
975
for (netsnmp_request_info* request = requests;
977
request = request->next)
979
const pgm_sock_t* sock = (pgm_sock_t*)netsnmp_extract_iterator_context (request);
981
netsnmp_set_request_error (reqinfo, request, SNMP_NOSUCHINSTANCE);
985
const pgm_txw_t* window = (const pgm_txw_t*)sock->window;
987
netsnmp_variable_list *var = request->requestvb;
988
netsnmp_table_request_info* table_info = netsnmp_extract_table_info (request);
989
if (NULL == table_info) {
990
snmp_log (LOG_ERR, "pgmSourceTable_handler: empty table request info.\n");
994
switch (table_info->colnum) {
996
case COLUMN_PGMSOURCEDATABYTESSENT:
998
const unsigned data_bytes = sock->cumulative_stats[PGM_PC_SOURCE_DATA_BYTES_SENT];
999
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1000
(const u_char*)&data_bytes, sizeof(data_bytes) );
1004
case COLUMN_PGMSOURCEDATAMSGSSENT:
1006
const unsigned data_msgs = sock->cumulative_stats[PGM_PC_SOURCE_DATA_MSGS_SENT];
1007
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1008
(const u_char*)&data_msgs, sizeof(data_msgs) );
1012
case COLUMN_PGMSOURCEBYTESBUFFERED:
1014
const unsigned bytes_buffered = sock->can_send_data ? pgm_txw_size (window) : 0;
1015
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1016
(const u_char*)&bytes_buffered, sizeof(bytes_buffered) );
1020
case COLUMN_PGMSOURCEMSGSBUFFERED:
1022
const unsigned msgs_buffered = sock->can_send_data ? pgm_txw_length (window) : 0;
1023
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1024
(const u_char*)&msgs_buffered, sizeof(msgs_buffered) );
1028
/* PGM_PC_SOURCE_SELECTIVE_BYTES_RETRANSMITTED + COLUMN_PGMSOURCEPARITYBYTESRETRANSMITTED */
1029
case COLUMN_PGMSOURCEBYTESRETRANSMITTED:
1031
const unsigned bytes_resent = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_BYTES_RETRANSMITTED];
1032
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1033
(const u_char*)&bytes_resent, sizeof(bytes_resent) );
1037
/* PGM_PC_SOURCE_SELECTIVE_MSGS_RETRANSMITTED + COLUMN_PGMSOURCEPARITYMSGSRETRANSMITTED */
1038
case COLUMN_PGMSOURCEMSGSRETRANSMITTED:
1040
const unsigned msgs_resent = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_MSGS_RETRANSMITTED];
1041
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1042
(const u_char*)&msgs_resent, sizeof(msgs_resent) );
1046
case COLUMN_PGMSOURCEBYTESSENT:
1048
const unsigned bytes_sent = sock->cumulative_stats[PGM_PC_SOURCE_BYTES_SENT];
1049
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1050
(const u_char*)&bytes_sent, sizeof(bytes_sent) );
1054
/* COLUMN_PGMSOURCEPARITYNAKPACKETSRECEIVED + COLUMN_PGMSOURCESELECTIVENAKPACKETSRECEIVED */
1055
case COLUMN_PGMSOURCERAWNAKSRECEIVED:
1057
const unsigned nak_packets = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_RECEIVED];
1058
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1059
(const u_char*)&nak_packets, sizeof(nak_packets) );
1063
/* PGM_PC_SOURCE_SELECTIVE_NAKS_IGNORED + COLUMN_PGMSOURCEPARITYNAKSIGNORED */
1064
case COLUMN_PGMSOURCENAKSIGNORED:
1066
const unsigned naks_ignored = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_IGNORED];
1067
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1068
(const u_char*)&naks_ignored, sizeof(naks_ignored) );
1072
case COLUMN_PGMSOURCECKSUMERRORS:
1074
const unsigned cksum_errors = sock->cumulative_stats[PGM_PC_SOURCE_CKSUM_ERRORS];
1075
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1076
(const u_char*)&cksum_errors, sizeof(cksum_errors) );
1080
case COLUMN_PGMSOURCEMALFORMEDNAKS:
1082
const unsigned malformed_naks = sock->cumulative_stats[PGM_PC_SOURCE_MALFORMED_NAKS];
1083
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1084
(const u_char*)&malformed_naks, sizeof(malformed_naks) );
1088
case COLUMN_PGMSOURCEPACKETSDISCARDED:
1090
const unsigned packets_discarded = sock->cumulative_stats[PGM_PC_SOURCE_PACKETS_DISCARDED];
1091
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1092
(const u_char*)&packets_discarded, sizeof(packets_discarded) );
1096
/* PGM_PC_SOURCE_SELECTIVE_NAKS_RECEIVED + COLUMN_PGMSOURCEPARITYNAKSRECEIVED */
1097
case COLUMN_PGMSOURCENAKSRCVD:
1099
const unsigned naks_received = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_RECEIVED];
1100
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1101
(const u_char*)&naks_received, sizeof(naks_received) );
1106
case COLUMN_PGMSOURCEPARITYBYTESRETRANSMITTED:
1108
const unsigned parity_bytes_resent = 0;
1109
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1110
(const u_char*)&parity_bytes_resent, sizeof(parity_bytes_resent) );
1114
case COLUMN_PGMSOURCESELECTIVEBYTESRETRANSMITED:
1116
const unsigned selective_bytes_resent = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_BYTES_RETRANSMITTED];
1117
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1118
(const u_char*)&selective_bytes_resent, sizeof(selective_bytes_resent) );
1123
case COLUMN_PGMSOURCEPARITYMSGSRETRANSMITTED:
1125
const unsigned parity_msgs_resent = 0;
1126
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1127
(const u_char*)&parity_msgs_resent, sizeof(parity_msgs_resent) );
1131
case COLUMN_PGMSOURCESELECTIVEMSGSRETRANSMITTED:
1133
const unsigned selective_msgs_resent = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_MSGS_RETRANSMITTED];
1134
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1135
(const u_char*)&selective_msgs_resent, sizeof(selective_msgs_resent) );
1140
case COLUMN_PGMSOURCEBYTESADMIT:
1142
const unsigned bytes_admit = 0;
1143
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1144
(const u_char*)&bytes_admit, sizeof(bytes_admit) );
1149
case COLUMN_PGMSOURCEMSGSADMIT:
1151
const unsigned msgs_admit = 0;
1152
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1153
(const u_char*)&msgs_admit, sizeof(msgs_admit) );
1158
case COLUMN_PGMSOURCEPARITYNAKPACKETSRECEIVED:
1160
const unsigned parity_nak_packets = 0;
1161
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1162
(const u_char*)&parity_nak_packets, sizeof(parity_nak_packets) );
1166
case COLUMN_PGMSOURCESELECTIVENAKPACKETSRECEIVED:
1168
const unsigned selective_nak_packets = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_RECEIVED];
1169
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1170
(const u_char*)&selective_nak_packets, sizeof(selective_nak_packets) );
1175
case COLUMN_PGMSOURCEPARITYNAKSRECEIVED:
1177
const unsigned parity_naks = 0;
1178
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1179
(const u_char*)&parity_naks, sizeof(parity_naks) );
1183
case COLUMN_PGMSOURCESELECTIVENAKSRECEIVED:
1185
const unsigned selective_naks = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_RECEIVED];
1186
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1187
(const u_char*)&selective_naks, sizeof(selective_naks) );
1192
case COLUMN_PGMSOURCEPARITYNAKSIGNORED:
1194
const unsigned parity_naks_ignored = 0;
1195
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1196
(const u_char*)&parity_naks_ignored, sizeof(parity_naks_ignored) );
1200
case COLUMN_PGMSOURCESELECTIVENAKSIGNORED:
1202
const unsigned selective_naks_ignored = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NAKS_IGNORED];
1203
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1204
(const u_char*)&selective_naks_ignored, sizeof(selective_naks_ignored) );
1208
case COLUMN_PGMSOURCEACKERRORS:
1210
const unsigned ack_errors = sock->cumulative_stats[PGM_PC_SOURCE_ACK_ERRORS];;
1211
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1212
(const u_char*)&ack_errors, sizeof(ack_errors) );
1216
case COLUMN_PGMSOURCEPGMCCACKER:
1218
struct sockaddr_in s4;
1219
if (AF_INET == sock->acker_nla.ss_family)
1220
memcpy (&s4, &sock->acker_nla, sizeof(s4));
1222
memset (&s4, 0, sizeof(s4));
1223
snmp_set_var_typed_value (var, ASN_IPADDRESS,
1224
(const u_char*)&s4.sin_addr.s_addr,
1225
sizeof(struct in_addr) );
1229
case COLUMN_PGMSOURCETRANSMISSIONCURRENTRATE:
1231
const unsigned tx_current_rate = sock->cumulative_stats[PGM_PC_SOURCE_TRANSMISSION_CURRENT_RATE];
1232
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1233
(const u_char*)&tx_current_rate, sizeof(tx_current_rate) );
1237
case COLUMN_PGMSOURCEACKPACKETSRECEIVED:
1239
const unsigned ack_packets = sock->cumulative_stats[PGM_PC_SOURCE_ACK_PACKETS_RECEIVED];
1240
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1241
(const u_char*)&ack_packets, sizeof(ack_packets) );
1245
/* COLUMN_PGMSOURCEPARITYNNAKPACKETSRECEIVED + COLUMN_PGMSOURCESELECTIVENNAKPACKETSRECEIVED */
1246
case COLUMN_PGMSOURCENNAKPACKETSRECEIVED:
1248
const unsigned nnak_packets = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NNAK_PACKETS_RECEIVED];
1249
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1250
(const u_char*)&nnak_packets, sizeof(nnak_packets) );
1255
case COLUMN_PGMSOURCEPARITYNNAKPACKETSRECEIVED:
1257
const unsigned parity_nnak_packets = 0;
1258
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1259
(const u_char*)&parity_nnak_packets, sizeof(parity_nnak_packets) );
1263
case COLUMN_PGMSOURCESELECTIVENNAKPACKETSRECEIVED:
1265
const unsigned selective_nnak_packets = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NNAK_PACKETS_RECEIVED];
1266
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1267
(const u_char*)&selective_nnak_packets, sizeof(selective_nnak_packets) );
1271
/* COLUMN_PGMSOURCEPARITYNNAKSRECEIVED + COLUMN_PGMSOURCESELECTIVENNAKSRECEIVED */
1272
case COLUMN_PGMSOURCENNAKSRECEIVED:
1274
const unsigned nnaks_received = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NNAKS_RECEIVED];
1275
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1276
(const u_char*)&nnaks_received, sizeof(nnaks_received) );
1281
case COLUMN_PGMSOURCEPARITYNNAKSRECEIVED:
1283
const unsigned parity_nnaks = 0;
1284
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1285
(const u_char*)&parity_nnaks, sizeof(parity_nnaks) );
1289
case COLUMN_PGMSOURCESELECTIVENNAKSRECEIVED:
1291
const unsigned selective_nnaks = sock->cumulative_stats[PGM_PC_SOURCE_SELECTIVE_NNAKS_RECEIVED];
1292
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1293
(const u_char*)&selective_nnaks, sizeof(selective_nnaks) );
1297
case COLUMN_PGMSOURCENNAKERRORS:
1299
const unsigned malformed_nnaks = sock->cumulative_stats[PGM_PC_SOURCE_NNAK_ERRORS];
1300
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
1301
(const u_char*)&malformed_nnaks, sizeof(malformed_nnaks) );
1306
snmp_log (LOG_ERR, "pgmSourcePerformanceTable_handler: unknown column.\n");
1312
case MODE_SET_RESERVE1:
1314
snmp_log (LOG_ERR, "pgmSourcePerformanceTable_handler: unsupported mode.\n");
1319
return SNMP_ERR_NOERROR;
1328
initialize_table_pgmReceiverTable(void)
1330
pgm_debug ("initialize_table_pgmReceiverTable ()");
1332
static const oid pgmReceiverTable_oid[] = {1,3,6,1,3,112,1,3,100,2};
1333
netsnmp_table_registration_info* table_info = NULL;
1334
netsnmp_iterator_info* iinfo = NULL;
1335
netsnmp_handler_registration* reg = NULL;
1337
reg = netsnmp_create_handler_registration ("pgmReceiverTable", pgmReceiverTable_handler,
1338
pgmReceiverTable_oid, OID_LENGTH( pgmReceiverTable_oid ),
1343
table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
1344
if (NULL == table_info)
1347
table_info->min_column = COLUMN_PGMRECEIVERGROUPADDRESS;
1348
table_info->max_column = COLUMN_PGMRECEIVERUNIQUEINSTANCE;
1350
netsnmp_table_helper_add_indexes (table_info,
1351
ASN_OCTET_STR, /* index: pgmReceiverGlobalId */
1352
ASN_UNSIGNED, /* index: pgmReceiverSourcePort */
1353
ASN_UNSIGNED, /* index: pgmReceiverInstance */
1356
iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
1360
iinfo->get_first_data_point = pgmReceiverTable_get_first_data_point;
1361
iinfo->get_next_data_point = pgmReceiverTable_get_next_data_point;
1362
iinfo->free_loop_context_at_end = pgmReceiverTable_free_loop_context;
1363
iinfo->table_reginfo = table_info;
1365
return netsnmp_register_table_iterator (reg, iinfo);
1368
if (table_info && table_info->indexes) /* table_data_free_func() is internal */
1369
snmp_free_var (table_info->indexes);
1370
SNMP_FREE( table_info );
1372
netsnmp_handler_registration_free (reg);
1377
/* called for first row of data in SNMP table
1379
* goal is to cache all the relevant data for subsequent get_next_data_point (row) calls in my_loop_context,
1380
* optionally returns my_data_context.
1382
* returns answer or NULL
1386
netsnmp_variable_list*
1387
pgmReceiverTable_get_first_data_point (
1388
void** my_loop_context, /* valid through one query of multiple "data points" */
1389
void** my_data_context, /* answer blob which is passed to handler() */
1390
netsnmp_variable_list* put_index_data, /* answer */
1391
netsnmp_iterator_info* mydata /* iinfo on init() */
1394
/* pre-conditions */
1395
pgm_assert (NULL != my_loop_context);
1396
pgm_assert (NULL != my_data_context);
1397
pgm_assert (NULL != put_index_data);
1398
pgm_assert (NULL != mydata);
1400
pgm_debug ("pgmReceiverTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
1401
(const void*)my_loop_context,
1402
(const void*)my_data_context,
1403
(const void*)put_index_data,
1404
(const void*)mydata);
1406
pgm_rwlock_reader_lock (&pgm_sock_list_lock);
1408
if (NULL == pgm_sock_list) {
1409
pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
1413
/* create our own context for this SNMP loop */
1414
pgm_snmp_context_t* context = pgm_new0 (pgm_snmp_context_t, 1);
1416
/* hunt to find first node, through all socks */
1417
for (context->list = pgm_sock_list;
1419
context->list = context->list->next)
1421
/* and through all peers for each sock */
1422
pgm_sock_t* sock = (pgm_sock_t*)context->list->data;
1423
pgm_rwlock_reader_lock (&sock->peers_lock);
1424
context->node = sock->peers_list;
1425
if (context->node) {
1426
/* maintain this sock's peers lock */
1430
pgm_rwlock_reader_unlock (&sock->peers_lock);
1434
if (NULL == context->node) {
1436
pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
1440
*my_loop_context = context;
1441
*my_data_context = &context->data_context;
1443
/* pass on for generic row access */
1444
return pgmReceiverTable_get_next_data_point (my_loop_context, my_data_context, put_index_data, mydata);
1448
netsnmp_variable_list*
1449
pgmReceiverTable_get_next_data_point (
1450
void** my_loop_context,
1451
void** my_data_context,
1452
netsnmp_variable_list* put_index_data,
1453
netsnmp_iterator_info* mydata
1456
/* pre-conditions */
1457
pgm_assert (NULL != my_loop_context);
1458
pgm_assert (NULL != my_data_context);
1459
pgm_assert (NULL != put_index_data);
1460
pgm_assert (NULL != mydata);
1462
pgm_debug ("pgmReceiverTable_get_next_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
1463
(const void*)my_loop_context,
1464
(const void*)my_data_context,
1465
(const void*)put_index_data,
1466
(const void*)mydata);
1468
pgm_snmp_context_t* context = (pgm_snmp_context_t*)*my_loop_context;
1469
pgm_snmp_data_context_t* data_context = (pgm_snmp_data_context_t*)*my_data_context;
1470
netsnmp_variable_list *idx = put_index_data;
1472
if (NULL == context->list)
1475
pgm_sock_t* sock = context->list->data;
1476
data_context->sock = sock;
1478
if (NULL == context->node)
1481
pgm_peer_t* peer = context->node->data;
1482
data_context->peer = peer;
1484
/* pgmReceiverGlobalId */
1485
char gsi[ PGM_GSISTRLEN ];
1486
pgm_gsi_print_r (&peer->tsi.gsi, gsi, sizeof(gsi));
1487
snmp_set_var_typed_value (idx, ASN_OCTET_STR, (const u_char*)&gsi, strlen (gsi));
1488
idx = idx->next_variable;
1490
/* pgmReceiverSourcePort */
1491
const unsigned sport = ntohs (peer->tsi.sport);
1492
snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&sport, sizeof(sport));
1493
idx = idx->next_variable;
1495
/* pgmReceiverInstance */
1496
const unsigned instance = context->instance++;
1497
snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&instance, sizeof(instance));
1499
/* hunt for next valid node */
1500
if (context->node->next) {
1501
context->node = context->node->next;
1505
context->node = NULL;
1506
while (context->list->next) {
1507
pgm_rwlock_reader_unlock (&sock->peers_lock);
1508
context->list = context->list->next;
1509
sock = context->list->data;
1510
pgm_rwlock_reader_lock (&sock->peers_lock);
1511
context->node = sock->peers_list;
1512
if (context->node) {
1519
return put_index_data;
1524
pgmReceiverTable_free_loop_context (
1525
void* my_loop_context,
1526
netsnmp_iterator_info* mydata
1529
/* pre-conditions */
1530
pgm_assert (NULL != my_loop_context);
1531
pgm_assert (NULL != mydata);
1533
pgm_debug ("pgmReceiverTable_free_loop_context (my_loop_context:%p mydata:%p)",
1534
(const void*)my_loop_context,
1535
(const void*)mydata);
1537
pgm_snmp_context_t* context = (pgm_snmp_context_t*)my_loop_context;
1539
/* check for intra-peer state */
1540
if (context->list) {
1541
pgm_sock_t* sock = context->list->data;
1542
pgm_rwlock_reader_unlock (&sock->peers_lock);
1546
my_loop_context = NULL;
1548
pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
1553
pgmReceiverTable_handler (
1554
netsnmp_mib_handler* handler,
1555
netsnmp_handler_registration* reginfo,
1556
netsnmp_agent_request_info* reqinfo,
1557
netsnmp_request_info* requests
1560
/* pre-conditions */
1561
pgm_assert (NULL != handler);
1562
pgm_assert (NULL != reginfo);
1563
pgm_assert (NULL != reqinfo);
1564
pgm_assert (NULL != requests);
1566
pgm_debug ("pgmReceiverTable_handler (handler:%p reginfo:%p reqinfo:%p requests:%p)",
1567
(const void*)handler,
1568
(const void*)reginfo,
1569
(const void*)reqinfo,
1570
(const void*)requests);
1572
switch (reqinfo->mode) {
1574
/* Read-support (also covers GetNext requests) */
1577
for (netsnmp_request_info* request = requests;
1579
request = request->next)
1581
const pgm_snmp_data_context_t* data_context = (pgm_snmp_data_context_t*)netsnmp_extract_iterator_context (request);
1582
if (!data_context) {
1583
netsnmp_set_request_error (reqinfo, request, SNMP_NOSUCHINSTANCE);
1587
const pgm_sock_t* sock = data_context->sock;
1588
const pgm_peer_t* peer = data_context->peer;
1590
netsnmp_variable_list *var = request->requestvb;
1591
netsnmp_table_request_info* table_info = netsnmp_extract_table_info(request);
1593
if (table_info == NULL) {
1594
snmp_log (LOG_ERR, "pgmReceiverTable_handler: empty table request info.\n");
1598
switch (table_info->colnum) {
1600
case COLUMN_PGMRECEIVERGROUPADDRESS:
1602
struct sockaddr_in s4;
1603
if (AF_INET == peer->group_nla.ss_family)
1604
memcpy (&s4, &peer->group_nla, sizeof(s4));
1606
memset (&s4, 0, sizeof(s4));
1607
snmp_set_var_typed_value (var, ASN_IPADDRESS,
1608
(const u_char*)&s4.sin_addr.s_addr,
1609
sizeof(struct in_addr) );
1613
/* by definition same as sock */
1614
case COLUMN_PGMRECEIVERDESTPORT:
1616
const unsigned dport = ntohs (sock->dport);
1617
snmp_set_var_typed_value (var, ASN_UNSIGNED,
1618
(const u_char*)&dport, sizeof(dport) );
1622
case COLUMN_PGMRECEIVERSOURCEADDRESS:
1624
struct sockaddr_in s4;
1625
if (AF_INET == peer->nla.ss_family)
1626
memcpy (&s4, &peer->nla, sizeof(s4));
1628
memset (&s4, 0, sizeof(s4));
1629
snmp_set_var_typed_value (var, ASN_IPADDRESS,
1630
(const u_char*)&s4.sin_addr.s_addr,
1631
sizeof(struct in_addr) );
1635
case COLUMN_PGMRECEIVERLASTHOP:
1637
struct sockaddr_in s4;
1638
if (AF_INET == peer->local_nla.ss_family)
1639
memcpy (&s4, &peer->local_nla, sizeof(s4));
1641
memset (&s4, 0, sizeof(s4));
1642
snmp_set_var_typed_value (var, ASN_IPADDRESS,
1643
(const u_char*)&s4.sin_addr.s_addr,
1644
sizeof(struct in_addr) );
1649
case COLUMN_PGMRECEIVERSOURCEGSI:
1650
snmp_set_var_typed_value (var, ASN_OCTET_STR,
1651
(const u_char*)table_info->indexes->val.string,
1652
table_info->indexes->val_len);
1656
case COLUMN_PGMRECEIVERSOURCEPORTNUMBER:
1657
snmp_set_var_typed_value (var, ASN_UNSIGNED,
1658
(const u_char*)table_info->indexes->next_variable->val.integer,
1659
table_info->indexes->next_variable->val_len);
1663
case COLUMN_PGMRECEIVERUNIQUEINSTANCE:
1664
snmp_set_var_typed_value (var, ASN_UNSIGNED,
1665
(const u_char*)table_info->indexes->next_variable->next_variable->val.integer,
1666
table_info->indexes->next_variable->next_variable->val_len);
1670
snmp_log (LOG_ERR, "pgmReceiverTable_handler: unknown column.\n");
1676
case MODE_SET_RESERVE1:
1678
snmp_log (LOG_ERR, "pgmReceiverTable_handler: unsupported mode.\n");
1683
return SNMP_ERR_NOERROR;
1687
* pgmReceiverConfigTable
1693
initialize_table_pgmReceiverConfigTable(void)
1695
pgm_debug ("initialize_table_pgmReceiverConfigTable ()");
1697
static const oid pgmReceiverConfigTable_oid[] = {1,3,6,1,3,112,1,3,100,3};
1698
netsnmp_table_registration_info* table_info = NULL;
1699
netsnmp_iterator_info* iinfo = NULL;
1700
netsnmp_handler_registration* reg = NULL;
1702
reg = netsnmp_create_handler_registration ("pgmReceiverConfigTable", pgmReceiverConfigTable_handler,
1703
pgmReceiverConfigTable_oid, OID_LENGTH(pgmReceiverConfigTable_oid),
1708
table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
1709
if (NULL == table_info)
1712
table_info->min_column = COLUMN_PGMRECEIVERNAKBACKOFFIVL;
1713
table_info->max_column = COLUMN_PGMRECEIVERNAKFAILURETHRESHOLD;
1715
netsnmp_table_helper_add_indexes (table_info,
1716
ASN_OCTET_STR, /* index: pgmReceiverConfigGlobalId */
1717
ASN_UNSIGNED, /* index: pgmReceiverConfigSourcePort */
1718
ASN_UNSIGNED, /* index: pgmReceiverInstance */
1721
iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
1725
iinfo->get_first_data_point = pgmReceiverConfigTable_get_first_data_point;
1726
iinfo->get_next_data_point = pgmReceiverConfigTable_get_next_data_point;
1727
iinfo->free_loop_context_at_end = pgmReceiverConfigTable_free_loop_context;
1728
iinfo->table_reginfo = table_info;
1730
return netsnmp_register_table_iterator (reg, iinfo);
1733
if (table_info && table_info->indexes) /* table_data_free_func() is internal */
1734
snmp_free_var (table_info->indexes);
1735
SNMP_FREE( table_info );
1737
netsnmp_handler_registration_free (reg);
1742
/* called for first row of data in SNMP table
1744
* goal is to cache all the relevant data for subsequent get_next_data_point (row) calls in my_loop_context,
1745
* optionally returns my_data_context.
1747
* returns answer or NULL
1751
netsnmp_variable_list*
1752
pgmReceiverConfigTable_get_first_data_point(
1753
void** my_loop_context, /* valid through one query of multiple "data points" */
1754
void** my_data_context, /* answer blob which is passed to handler() */
1755
netsnmp_variable_list* put_index_data, /* answer */
1756
netsnmp_iterator_info* mydata /* iinfo on init() */
1759
/* pre-conditions */
1760
pgm_assert (NULL != my_loop_context);
1761
pgm_assert (NULL != my_data_context);
1762
pgm_assert (NULL != put_index_data);
1763
pgm_assert (NULL != mydata);
1765
pgm_debug ("pgmReceiverConfigTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
1766
(const void*)my_loop_context,
1767
(const void*)my_data_context,
1768
(const void*)put_index_data,
1769
(const void*)mydata);
1771
pgm_rwlock_reader_lock (&pgm_sock_list_lock);
1773
if (NULL == pgm_sock_list) {
1774
pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
1778
/* create our own context for this SNMP loop */
1779
pgm_snmp_context_t* context = pgm_new0 (pgm_snmp_context_t, 1);
1781
/* hunt to find first node, through all socks */
1782
for (context->list = pgm_sock_list;
1784
context->list = context->list->next)
1786
/* and through all peers for each sock */
1787
pgm_sock_t* sock = (pgm_sock_t*)context->list->data;
1788
pgm_rwlock_reader_lock (&sock->peers_lock);
1789
context->node = sock->peers_list;
1793
pgm_rwlock_reader_unlock (&sock->peers_lock);
1797
if (NULL == context->node) {
1799
pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
1803
*my_loop_context = context;
1804
*my_data_context = NULL;
1806
/* pass on for generic row access */
1807
return pgmReceiverConfigTable_get_next_data_point (my_loop_context, my_data_context, put_index_data, mydata);
1811
netsnmp_variable_list*
1812
pgmReceiverConfigTable_get_next_data_point(
1813
void** my_loop_context,
1814
void** my_data_context,
1815
netsnmp_variable_list* put_index_data,
1816
netsnmp_iterator_info* mydata
1819
/* pre-conditions */
1820
pgm_assert (NULL != my_loop_context);
1821
pgm_assert (NULL != my_data_context);
1822
pgm_assert (NULL != put_index_data);
1823
pgm_assert (NULL != mydata);
1825
pgm_debug ("pgmReceiverConfigTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
1826
(const void*)my_loop_context,
1827
(const void*)my_data_context,
1828
(const void*)put_index_data,
1829
(const void*)mydata);
1831
pgm_snmp_context_t* context = (pgm_snmp_context_t*)*my_loop_context;
1832
netsnmp_variable_list *idx = put_index_data;
1834
if (NULL == context->list)
1837
pgm_sock_t* sock = context->list->data;
1838
*my_data_context = sock;
1840
if (NULL == context->node)
1843
pgm_peer_t* peer = context->node->data;
1845
/* pgmReceiverGlobalId */
1846
char gsi[ PGM_GSISTRLEN ];
1847
pgm_gsi_print_r (&peer->tsi.gsi, gsi, sizeof(gsi));
1848
snmp_set_var_typed_value (idx, ASN_OCTET_STR, (const u_char*)&gsi, strlen (gsi));
1849
idx = idx->next_variable;
1851
/* pgmReceiverSourcePort */
1852
const unsigned sport = ntohs (peer->tsi.sport);
1853
snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&sport, sizeof(sport));
1854
idx = idx->next_variable;
1856
/* pgmReceiverInstance */
1857
const unsigned instance = context->instance++;
1858
snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&instance, sizeof(instance));
1860
/* hunt for next valid node */
1861
if (context->node->next) {
1862
context->node = context->node->next;
1866
context->node = NULL;
1867
while (context->list->next) {
1868
pgm_rwlock_reader_unlock (&sock->peers_lock);
1869
context->list = context->list->next;
1870
sock = context->list->data;
1871
pgm_rwlock_reader_lock (&sock->peers_lock);
1872
context->node = sock->peers_list;
1873
if (context->node) {
1880
return put_index_data;
1885
pgmReceiverConfigTable_free_loop_context (
1886
void* my_loop_context,
1887
netsnmp_iterator_info* mydata
1890
/* pre-conditions */
1891
pgm_assert (NULL != my_loop_context);
1892
pgm_assert (NULL != mydata);
1894
pgm_debug ("pgmReceiverConfigTable_free_loop_context (my_loop_context:%p mydata:%p)",
1895
(const void*)my_loop_context,
1896
(const void*)mydata);
1898
pgm_snmp_context_t* context = (pgm_snmp_context_t*)my_loop_context;
1900
/* check for intra-peer state */
1901
if (context->list) {
1902
pgm_sock_t* sock = context->list->data;
1903
pgm_rwlock_reader_unlock (&sock->peers_lock);
1907
my_loop_context = NULL;
1909
pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
1914
pgmReceiverConfigTable_handler (
1915
netsnmp_mib_handler* handler,
1916
netsnmp_handler_registration* reginfo,
1917
netsnmp_agent_request_info* reqinfo,
1918
netsnmp_request_info* requests
1921
/* pre-conditions */
1922
pgm_assert (NULL != handler);
1923
pgm_assert (NULL != reginfo);
1924
pgm_assert (NULL != reqinfo);
1925
pgm_assert (NULL != requests);
1927
pgm_debug ("pgmReceiverConfigTable_handler (handler:%p reginfo:%p reqinfo:%p requests:%p)",
1928
(const void*)handler,
1929
(const void*)reginfo,
1930
(const void*)reqinfo,
1931
(const void*)requests);
1933
switch (reqinfo->mode) {
1935
/* Read-support (also covers GetNext requests) */
1938
for (netsnmp_request_info* request = requests;
1940
request = request->next)
1942
const pgm_sock_t* sock = (pgm_sock_t*)netsnmp_extract_iterator_context(request);
1944
netsnmp_set_request_error (reqinfo, request, SNMP_NOSUCHINSTANCE);
1948
netsnmp_variable_list *var = request->requestvb;
1949
netsnmp_table_request_info* table_info = netsnmp_extract_table_info(request);
1951
if (NULL == table_info) {
1952
snmp_log (LOG_ERR, "pgmReceiverTable_handler: empty table request info.\n");
1956
switch (table_info->colnum) {
1958
/* nak_bo_ivl from sock */
1959
case COLUMN_PGMRECEIVERNAKBACKOFFIVL:
1961
const unsigned nak_bo_ivl = sock->nak_bo_ivl;
1962
snmp_set_var_typed_value (var, ASN_UNSIGNED,
1963
(const u_char*)&nak_bo_ivl, sizeof(nak_bo_ivl) );
1967
/* nak_rpt_ivl from sock */
1968
case COLUMN_PGMRECEIVERNAKREPEATIVL:
1970
const unsigned nak_rpt_ivl = sock->nak_rpt_ivl;
1971
snmp_set_var_typed_value (var, ASN_UNSIGNED,
1972
(const u_char*)&nak_rpt_ivl, sizeof(nak_rpt_ivl) );
1976
/* nak_ncf_retries from sock */
1977
case COLUMN_PGMRECEIVERNAKNCFRETRIES:
1979
const unsigned nak_ncf_retries = sock->nak_ncf_retries;
1980
snmp_set_var_typed_value (var, ASN_UNSIGNED,
1981
(const u_char*)&nak_ncf_retries, sizeof(nak_ncf_retries) );
1985
/* nak_rdata_ivl from sock */
1986
case COLUMN_PGMRECEIVERNAKRDATAIVL:
1988
const unsigned nak_rdata_ivl = sock->nak_rdata_ivl;
1989
snmp_set_var_typed_value (var, ASN_UNSIGNED,
1990
(const u_char*)&nak_rdata_ivl, sizeof(nak_rdata_ivl) );
1994
/* nak_data_retries from sock */
1995
case COLUMN_PGMRECEIVERNAKDATARETRIES:
1997
const unsigned nak_data_retries = sock->nak_data_retries;
1998
snmp_set_var_typed_value (var, ASN_UNSIGNED,
1999
(const u_char*)&nak_data_retries, sizeof(nak_data_retries) );
2003
/* FIXED: pgmReceiverSendNaks = enabled(1) */
2004
case COLUMN_PGMRECEIVERSENDNAKS:
2006
const unsigned send_naks = PGMRECEIVERSENDNAKS_ENABLED;
2007
snmp_set_var_typed_value (var, ASN_INTEGER,
2008
(const u_char*)&send_naks, sizeof(send_naks) );
2012
/* FIXED: pgmReceiverLateJoin = disabled(2) */
2013
case COLUMN_PGMRECEIVERLATEJOIN:
2015
const unsigned late_join = PGMRECEIVERLATEJOIN_DISABLED;
2016
snmp_set_var_typed_value (var, ASN_INTEGER,
2017
(const u_char*)&late_join, sizeof(late_join) );
2021
/* FIXED: 1 for multicast */
2022
case COLUMN_PGMRECEIVERNAKTTL:
2024
const unsigned nak_hops = 1;
2025
snmp_set_var_typed_value (var, ASN_UNSIGNED,
2026
(const u_char*)&nak_hops, sizeof(nak_hops) );
2030
/* FIXED: pgmReceiverDeliveryOrder = ordered(2) */
2031
case COLUMN_PGMRECEIVERDELIVERYORDER:
2033
const unsigned delivery_order = PGMRECEIVERDELIVERYORDER_ORDERED;
2034
snmp_set_var_typed_value (var, ASN_INTEGER,
2035
(const u_char*)&delivery_order, sizeof(delivery_order) );
2039
/* FIXED: pgmReceiverMcastNaks = disabled(2) */
2040
case COLUMN_PGMRECEIVERMCASTNAKS:
2042
const unsigned mcast_naks = PGMRECEIVERMCASTNAKS_DISABLED;
2043
snmp_set_var_typed_value (var, ASN_INTEGER,
2044
(const u_char*)&mcast_naks, sizeof(mcast_naks) );
2049
case COLUMN_PGMRECEIVERNAKFAILURETHRESHOLDTIMER:
2050
case COLUMN_PGMRECEIVERNAKFAILURETHRESHOLD:
2052
const unsigned threshold = 0;
2053
snmp_set_var_typed_value (var, ASN_UNSIGNED,
2054
(const u_char*)&threshold, sizeof(threshold) );
2059
snmp_log (LOG_ERR, "pgmReceiverTable_handler: unknown column.\n");
2065
case MODE_SET_RESERVE1:
2067
snmp_log (LOG_ERR, "pgmReceiverTable_handler: unsupported mode.\n");
2072
return SNMP_ERR_NOERROR;
2076
* pgmReceiverPerformanceTable
2081
initialize_table_pgmReceiverPerformanceTable (void)
2083
pgm_debug ("initialize_table_pgmReceiverPerformanceTable ()");
2085
static const oid pgmReceiverPerformanceTable_oid[] = {1,3,6,1,3,112,1,3,100,4};
2086
netsnmp_table_registration_info* table_info = NULL;
2087
netsnmp_iterator_info* iinfo = NULL;
2088
netsnmp_handler_registration* reg = NULL;
2090
reg = netsnmp_create_handler_registration ("pgmReceiverPerformanceTable", pgmReceiverPerformanceTable_handler,
2091
pgmReceiverPerformanceTable_oid, OID_LENGTH( pgmReceiverPerformanceTable_oid ),
2096
table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
2097
if (NULL == table_info)
2100
table_info->min_column = COLUMN_PGMRECEIVERDATABYTESRECEIVED;
2101
table_info->max_column = COLUMN_PGMRECEIVERLASTINTERVALNAKFAILURES;
2103
netsnmp_table_helper_add_indexes (table_info,
2104
ASN_OCTET_STR, /* index: pgmReceiverGlobalId */
2105
ASN_UNSIGNED, /* index: pgmReceiverSourcePort */
2106
ASN_UNSIGNED, /* index: pgmReceiverInstance */
2109
iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
2113
iinfo->get_first_data_point = pgmReceiverPerformanceTable_get_first_data_point;
2114
iinfo->get_next_data_point = pgmReceiverPerformanceTable_get_next_data_point;
2115
iinfo->free_loop_context_at_end = pgmReceiverPerformanceTable_free_loop_context;
2116
iinfo->table_reginfo = table_info;
2118
return netsnmp_register_table_iterator (reg, iinfo);
2121
if (table_info && table_info->indexes) /* table_data_free_func() is internal */
2122
snmp_free_var (table_info->indexes);
2123
SNMP_FREE( table_info );
2125
netsnmp_handler_registration_free (reg);
2130
/* called for first row of data in SNMP table
2132
* goal is to cache all the relevant data for subsequent get_next_data_point (row) calls in my_loop_context,
2133
* optionally returns my_data_context.
2135
* returns answer or NULL
2139
netsnmp_variable_list*
2140
pgmReceiverPerformanceTable_get_first_data_point (
2141
void** my_loop_context, /* valid through one query of multiple "data points" */
2142
void** my_data_context, /* answer blob which is passed to handler() */
2143
netsnmp_variable_list* put_index_data, /* answer */
2144
netsnmp_iterator_info* mydata /* iinfo on init() */
2147
/* pre-conditions */
2148
pgm_assert (NULL != my_loop_context);
2149
pgm_assert (NULL != my_data_context);
2150
pgm_assert (NULL != put_index_data);
2151
pgm_assert (NULL != mydata);
2153
pgm_debug ("pgmReceiverPerformanceTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
2154
(const void*)my_loop_context,
2155
(const void*)my_data_context,
2156
(const void*)put_index_data,
2157
(const void*)mydata);
2159
pgm_rwlock_reader_lock (&pgm_sock_list_lock);
2161
if (NULL == pgm_sock_list) {
2162
pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
2166
/* create our own context for this SNMP loop */
2167
pgm_snmp_context_t* context = pgm_new0 (pgm_snmp_context_t, 1);
2169
/* hunt to find first node, through all socks */
2170
for (context->list = pgm_sock_list;
2172
context->list = context->list->next)
2174
/* and through all peers for each sock */
2175
pgm_sock_t* sock = (pgm_sock_t*)context->list->data;
2176
pgm_rwlock_reader_lock (&sock->peers_lock);
2177
context->node = sock->peers_list;
2181
pgm_rwlock_reader_unlock (&sock->peers_lock);
2185
if (NULL == context->node) {
2187
pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
2191
*my_loop_context = context;
2192
*my_data_context = &context->data_context;
2194
/* pass on for generic row access */
2195
return pgmReceiverPerformanceTable_get_next_data_point (my_loop_context, my_data_context, put_index_data, mydata);
2199
netsnmp_variable_list*
2200
pgmReceiverPerformanceTable_get_next_data_point (
2201
void** my_loop_context,
2202
void** my_data_context,
2203
netsnmp_variable_list* put_index_data,
2204
netsnmp_iterator_info* mydata
2207
/* pre-conditions */
2208
pgm_assert (NULL != my_loop_context);
2209
pgm_assert (NULL != my_data_context);
2210
pgm_assert (NULL != put_index_data);
2211
pgm_assert (NULL != mydata);
2213
pgm_debug ("pgmReceiverPerformanceTable_get_first_data_point (my_loop_context:%p my_data_context:%p put_index_data:%p mydata:%p)",
2214
(const void*)my_loop_context,
2215
(const void*)my_data_context,
2216
(const void*)put_index_data,
2217
(const void*)mydata);
2219
pgm_snmp_context_t* context = (pgm_snmp_context_t*)*my_loop_context;
2220
pgm_snmp_data_context_t* data_context = (pgm_snmp_data_context_t*)*my_data_context;
2221
netsnmp_variable_list *idx = put_index_data;
2223
if (NULL == context->list)
2226
pgm_sock_t* sock = context->list->data;
2227
data_context->sock = sock;
2229
if (NULL == context->node)
2232
pgm_peer_t* peer = context->node->data;
2233
data_context->peer = peer;
2235
/* pgmReceiverGlobalId */
2236
char gsi[ PGM_GSISTRLEN ];
2237
pgm_gsi_print_r (&peer->tsi.gsi, gsi, sizeof(gsi));
2238
snmp_set_var_typed_value (idx, ASN_OCTET_STR, (const u_char*)&gsi, strlen (gsi));
2239
idx = idx->next_variable;
2241
/* pgmReceiverSourcePort */
2242
const unsigned sport = ntohs (peer->tsi.sport);
2243
snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&sport, sizeof(sport));
2244
idx = idx->next_variable;
2246
/* pgmReceiverInstance */
2247
const unsigned instance = context->instance++;
2248
snmp_set_var_typed_value (idx, ASN_UNSIGNED, (const u_char*)&instance, sizeof(instance));
2250
/* hunt for next valid node */
2251
if (context->node->next) {
2252
context->node = context->node->next;
2256
context->node = NULL;
2257
while (context->list->next) {
2258
pgm_rwlock_reader_unlock (&sock->peers_lock);
2259
context->list = context->list->next;
2260
sock = context->list->data;
2261
pgm_rwlock_reader_lock (&sock->peers_lock);
2262
context->node = sock->peers_list;
2269
return put_index_data;
2274
pgmReceiverPerformanceTable_free_loop_context (
2275
void* my_loop_context,
2276
netsnmp_iterator_info* mydata
2279
/* pre-conditions */
2280
pgm_assert (NULL != my_loop_context);
2281
pgm_assert (NULL != mydata);
2283
pgm_debug ("pgmReceiverPerformanceTable_free_loop_context (my_loop_context:%p mydata:%p)",
2284
(const void*)my_loop_context,
2285
(const void*)mydata);
2287
pgm_snmp_context_t* context = (pgm_snmp_context_t*)my_loop_context;
2289
/* check for intra-peer state */
2290
if (context->list) {
2291
pgm_sock_t* sock = context->list->data;
2292
pgm_rwlock_reader_unlock (&sock->peers_lock);
2296
my_loop_context = NULL;
2298
pgm_rwlock_reader_unlock (&pgm_sock_list_lock);
2303
pgmReceiverPerformanceTable_handler (
2304
netsnmp_mib_handler* handler,
2305
netsnmp_handler_registration* reginfo,
2306
netsnmp_agent_request_info* reqinfo,
2307
netsnmp_request_info* requests
2310
/* pre-conditions */
2311
pgm_assert (NULL != handler);
2312
pgm_assert (NULL != reginfo);
2313
pgm_assert (NULL != reqinfo);
2314
pgm_assert (NULL != requests);
2316
pgm_debug ("pgmReceiverPerformanceTable_handler (handler:%p reginfo:%p reqinfo:%p requests:%p)",
2317
(const void*)handler,
2318
(const void*)reginfo,
2319
(const void*)reqinfo,
2320
(const void*)requests);
2322
switch (reqinfo->mode) {
2324
/* Read-support (also covers GetNext requests) */
2327
for (netsnmp_request_info* request = requests;
2329
request = request->next)
2331
const pgm_snmp_data_context_t* data_context = (pgm_snmp_data_context_t*)netsnmp_extract_iterator_context (request);
2332
if (NULL == data_context) {
2333
netsnmp_set_request_error (reqinfo, request, SNMP_NOSUCHINSTANCE);
2337
const pgm_sock_t* sock = data_context->sock;
2338
const pgm_peer_t* peer = data_context->peer;
2339
const pgm_rxw_t* window = peer->window;
2341
netsnmp_variable_list *var = request->requestvb;
2342
netsnmp_table_request_info* table_info = netsnmp_extract_table_info (request);
2344
if (NULL == table_info) {
2345
snmp_log (LOG_ERR, "pgmReceiverTable_handler: empty table request info.\n");
2349
switch (table_info->colnum) {
2351
case COLUMN_PGMRECEIVERDATABYTESRECEIVED:
2353
const unsigned data_bytes = peer->cumulative_stats[PGM_PC_RECEIVER_DATA_BYTES_RECEIVED];
2354
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2355
(const u_char*)&data_bytes, sizeof(data_bytes) );
2359
case COLUMN_PGMRECEIVERDATAMSGSRECEIVED:
2361
const unsigned data_msgs = peer->cumulative_stats[PGM_PC_RECEIVER_DATA_MSGS_RECEIVED];
2362
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2363
(const u_char*)&data_msgs, sizeof(data_msgs) );
2368
case COLUMN_PGMRECEIVERNAKSSENT:
2370
const unsigned naks_sent = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SENT];
2371
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2372
(const u_char*)&naks_sent, sizeof(naks_sent) );
2377
case COLUMN_PGMRECEIVERNAKSRETRANSMITTED:
2379
const unsigned naks_resent = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_RETRANSMITTED];
2380
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2381
(const u_char*)&naks_resent, sizeof(naks_resent) );
2386
case COLUMN_PGMRECEIVERNAKFAILURES:
2388
const unsigned nak_failures = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_FAILED];
2389
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2390
(const u_char*)&nak_failures, sizeof(nak_failures) );
2394
case COLUMN_PGMRECEIVERBYTESRECEIVED:
2396
const unsigned bytes_received = peer->cumulative_stats[PGM_PC_RECEIVER_BYTES_RECEIVED];
2397
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2398
(const u_char*)&bytes_received, sizeof(bytes_received) );
2403
case COLUMN_PGMRECEIVERNAKSSUPPRESSED:
2405
const unsigned naks_suppressed = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SUPPRESSED];
2406
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2407
(const u_char*)&naks_suppressed, sizeof(naks_suppressed) );
2411
/* bogus: same as source checksum errors */
2412
case COLUMN_PGMRECEIVERCKSUMERRORS:
2414
const unsigned cksum_errors = sock->cumulative_stats[PGM_PC_SOURCE_CKSUM_ERRORS];
2415
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2416
(const u_char*)&cksum_errors, sizeof(cksum_errors) );
2420
case COLUMN_PGMRECEIVERMALFORMEDSPMS:
2422
const unsigned malformed_spms = peer->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_SPMS];
2423
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2424
(const u_char*)&malformed_spms, sizeof(malformed_spms) );
2428
case COLUMN_PGMRECEIVERMALFORMEDODATA:
2430
const unsigned malformed_odata = peer->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_ODATA];
2431
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2432
(const u_char*)&malformed_odata, sizeof(malformed_odata) );
2436
case COLUMN_PGMRECEIVERMALFORMEDRDATA:
2438
const unsigned malformed_rdata = peer->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_RDATA];
2439
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2440
(const u_char*)&malformed_rdata, sizeof(malformed_rdata) );
2444
case COLUMN_PGMRECEIVERMALFORMEDNCFS:
2446
const unsigned malformed_ncfs = peer->cumulative_stats[PGM_PC_RECEIVER_MALFORMED_NCFS];
2447
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2448
(const u_char*)&malformed_ncfs, sizeof(malformed_ncfs) );
2452
case COLUMN_PGMRECEIVERPACKETSDISCARDED:
2454
const unsigned packets_discarded = peer->cumulative_stats[PGM_PC_RECEIVER_PACKETS_DISCARDED];
2455
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2456
(const u_char*)&packets_discarded, sizeof(packets_discarded) );
2460
case COLUMN_PGMRECEIVERLOSSES:
2462
const unsigned losses = window->cumulative_losses;
2463
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2464
(const u_char*)&losses, sizeof(losses) );
2468
case COLUMN_PGMRECEIVERBYTESDELIVEREDTOAPP:
2470
const unsigned bytes_delivered = window->bytes_delivered;
2471
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2472
(const u_char*)&bytes_delivered, sizeof(bytes_delivered) );
2476
case COLUMN_PGMRECEIVERMSGSDELIVEREDTOAPP:
2478
const unsigned msgs_delivered = window->msgs_delivered;
2479
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2480
(const u_char*)&msgs_delivered, sizeof(msgs_delivered) );
2484
case COLUMN_PGMRECEIVERDUPSPMS:
2486
const unsigned dup_spms = peer->cumulative_stats[PGM_PC_RECEIVER_DUP_SPMS];
2487
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2488
(const u_char*)&dup_spms, sizeof(dup_spms) );
2492
case COLUMN_PGMRECEIVERDUPDATAS:
2494
const unsigned dup_data = peer->cumulative_stats[PGM_PC_RECEIVER_DUP_DATAS];
2495
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2496
(const u_char*)&dup_data, sizeof(dup_data) );
2501
case COLUMN_PGMRECEIVERDUPPARITIES:
2503
const unsigned dup_parity = 0;
2504
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2505
(const u_char*)&dup_parity, sizeof(dup_parity) );
2509
/* COLUMN_PGMRECEIVERPARITYNAKPACKETSSENT + COLUMN_PGMRECEIVERSELECTIVENAKPACKETSSENT */
2510
case COLUMN_PGMRECEIVERNAKPACKETSSENT:
2512
const unsigned nak_packets = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAK_PACKETS_SENT];
2513
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2514
(const u_char*)&nak_packets, sizeof(nak_packets) );
2519
case COLUMN_PGMRECEIVERPARITYNAKPACKETSSENT:
2521
const unsigned parity_naks = 0;
2522
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2523
(const u_char*)&parity_naks, sizeof(parity_naks) );
2527
case COLUMN_PGMRECEIVERSELECTIVENAKPACKETSSENT:
2529
const unsigned nak_packets = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAK_PACKETS_SENT];
2530
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2531
(const u_char*)&nak_packets, sizeof(nak_packets) );
2536
case COLUMN_PGMRECEIVERPARITYNAKSSENT:
2538
const unsigned parity_naks = 0;
2539
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2540
(const u_char*)&parity_naks, sizeof(parity_naks) );
2544
case COLUMN_PGMRECEIVERSELECTIVENAKSSENT:
2546
const unsigned naks_sent = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SENT];
2547
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2548
(const u_char*)&naks_sent, sizeof(naks_sent) );
2553
case COLUMN_PGMRECEIVERPARITYNAKSRETRANSMITTED:
2555
const unsigned parity_resent = 0;
2556
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2557
(const u_char*)&parity_resent, sizeof(parity_resent) );
2561
case COLUMN_PGMRECEIVERSELECTIVENAKSRETRANSMITTED:
2563
const unsigned naks_resent = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_RETRANSMITTED];
2564
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2565
(const u_char*)&naks_resent, sizeof(naks_resent) );
2569
/* COLUMN_PGMRECEIVERPARITYNAKSFAILED + COLUMN_PGMRECEIVERSELECTIVENAKSFAILED */
2570
case COLUMN_PGMRECEIVERNAKSFAILED:
2572
const unsigned naks_failed = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_FAILED];
2573
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2574
(const u_char*)&naks_failed, sizeof(naks_failed) );
2579
case COLUMN_PGMRECEIVERPARITYNAKSFAILED:
2581
const unsigned parity_failed = 0;
2582
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2583
(const u_char*)&parity_failed, sizeof(parity_failed) );
2587
case COLUMN_PGMRECEIVERSELECTIVENAKSFAILED:
2589
const unsigned naks_failed = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_FAILED];
2590
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2591
(const u_char*)&naks_failed, sizeof(naks_failed) );
2595
case COLUMN_PGMRECEIVERNAKSFAILEDRXWADVANCED:
2597
const unsigned rxw_failed = peer->cumulative_stats[PGM_PC_RECEIVER_NAKS_FAILED_RXW_ADVANCED];
2598
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2599
(const u_char*)&rxw_failed, sizeof(rxw_failed) );
2603
case COLUMN_PGMRECEIVERNAKSFALEDNCFRETRIESEXCEEDED:
2605
const unsigned ncf_retries = peer->cumulative_stats[PGM_PC_RECEIVER_NAKS_FAILED_NCF_RETRIES_EXCEEDED];
2606
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2607
(const u_char*)&ncf_retries, sizeof(ncf_retries) );
2611
case COLUMN_PGMRECEIVERNAKSFAILEDDATARETRIESEXCEEDED:
2613
const unsigned data_retries = peer->cumulative_stats[PGM_PC_RECEIVER_NAKS_FAILED_DATA_RETRIES_EXCEEDED];
2614
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2615
(const u_char*)&data_retries, sizeof(data_retries) );
2619
/* FIXED: 0 - absolutely no idea what this means */
2620
case COLUMN_PGMRECEIVERNAKSFAILEDGENEXPIRED:
2622
const unsigned happy_pandas = 0;
2623
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2624
(const u_char*)&happy_pandas, sizeof(happy_pandas) );
2628
case COLUMN_PGMRECEIVERNAKFAILURESDELIVERED:
2630
const unsigned delivered = peer->cumulative_stats[PGM_PC_RECEIVER_NAK_FAILURES_DELIVERED];
2631
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2632
(const u_char*)&delivered, sizeof(delivered) );
2637
case COLUMN_PGMRECEIVERPARITYNAKSSUPPRESSED:
2639
const unsigned suppressed = 0;
2640
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2641
(const u_char*)&suppressed, sizeof(suppressed) );
2645
case COLUMN_PGMRECEIVERSELECTIVENAKSSUPPRESSED:
2647
const unsigned suppressed = peer->cumulative_stats[PGM_PC_RECEIVER_SELECTIVE_NAKS_SUPPRESSED];
2648
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2649
(const u_char*)&suppressed, sizeof(suppressed) );
2653
case COLUMN_PGMRECEIVERNAKERRORS:
2655
const unsigned malformed_naks = peer->cumulative_stats[PGM_PC_RECEIVER_NAK_ERRORS];
2656
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2657
(const u_char*)&malformed_naks, sizeof(malformed_naks) );
2662
case COLUMN_PGMRECEIVEROUTSTANDINGPARITYNAKS:
2664
const unsigned outstanding_parity = 0;
2665
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2666
(const u_char*)&outstanding_parity, sizeof(outstanding_parity) );
2670
case COLUMN_PGMRECEIVEROUTSTANDINGSELECTIVENAKS:
2672
const unsigned outstanding_selective = window->nak_backoff_queue.length +
2673
window->wait_ncf_queue.length +
2674
window->wait_data_queue.length;
2675
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2676
(const u_char*)&outstanding_selective, sizeof(outstanding_selective) );
2680
case COLUMN_PGMRECEIVERLASTACTIVITY:
2683
unsigned uint_value;
2684
time_t time_t_value;
2686
pgm_time_since_epoch (&peer->last_packet, &last_activity.time_t_value);
2687
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2688
(const u_char*)&last_activity.uint_value, sizeof(last_activity.uint_value) );
2692
case COLUMN_PGMRECEIVERNAKSVCTIMEMIN:
2694
const unsigned min_repair_time = window->min_fill_time;
2695
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2696
(const u_char*)&min_repair_time, sizeof(min_repair_time) );
2700
case COLUMN_PGMRECEIVERNAKSVCTIMEMEAN:
2702
const unsigned mean_repair_time = peer->cumulative_stats[PGM_PC_RECEIVER_NAK_SVC_TIME_MEAN];
2703
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2704
(const u_char*)&mean_repair_time, sizeof(mean_repair_time) );
2708
case COLUMN_PGMRECEIVERNAKSVCTIMEMAX:
2710
const unsigned max_repair_time = window->max_fill_time;
2711
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2712
(const u_char*)&max_repair_time, sizeof(max_repair_time) );
2716
case COLUMN_PGMRECEIVERNAKFAILTIMEMIN:
2718
const unsigned min_fail_time = peer->min_fail_time;
2719
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2720
(const u_char*)&min_fail_time, sizeof(min_fail_time) );
2724
case COLUMN_PGMRECEIVERNAKFAILTIMEMEAN:
2726
const unsigned mean_fail_time = peer->cumulative_stats[PGM_PC_RECEIVER_NAK_FAIL_TIME_MEAN];
2727
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2728
(const u_char*)&mean_fail_time, sizeof(mean_fail_time) );
2732
case COLUMN_PGMRECEIVERNAKFAILTIMEMAX:
2734
const unsigned max_fail_time = peer->max_fail_time;
2735
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2736
(const u_char*)&max_fail_time, sizeof(max_fail_time) );
2740
case COLUMN_PGMRECEIVERNAKTRANSMITMIN:
2742
const unsigned min_transmit_count = window->min_nak_transmit_count;
2743
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2744
(const u_char*)&min_transmit_count, sizeof(min_transmit_count) );
2748
case COLUMN_PGMRECEIVERNAKTRANSMITMEAN:
2750
const unsigned mean_transmit_count = peer->cumulative_stats[PGM_PC_RECEIVER_TRANSMIT_MEAN];
2751
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2752
(const u_char*)&mean_transmit_count, sizeof(mean_transmit_count) );
2756
case COLUMN_PGMRECEIVERNAKTRANSMITMAX:
2758
const unsigned max_transmit_count = window->max_nak_transmit_count;
2759
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2760
(const u_char*)&max_transmit_count, sizeof(max_transmit_count) );
2764
case COLUMN_PGMRECEIVERACKSSENT:
2766
const unsigned acks_sent = peer->cumulative_stats[PGM_PC_RECEIVER_ACKS_SENT];
2767
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2768
(const u_char*)&acks_sent, sizeof(acks_sent) );
2772
case COLUMN_PGMRECEIVERRXWTRAIL:
2774
const unsigned rxw_trail = window->rxw_trail;
2775
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2776
(const u_char*)&rxw_trail, sizeof(rxw_trail) );
2780
case COLUMN_PGMRECEIVERRXWLEAD:
2782
const unsigned rxw_lead = window->lead;
2783
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2784
(const u_char*)&rxw_lead, sizeof(rxw_lead) );
2789
case COLUMN_PGMRECEIVERNAKFAILURESLASTINTERVAL:
2790
case COLUMN_PGMRECEIVERLASTINTERVALNAKFAILURES:
2792
const unsigned failures = 0;
2793
snmp_set_var_typed_value (var, ASN_COUNTER, /* ASN_COUNTER32 */
2794
(const u_char*)&failures, sizeof(failures) );
2799
snmp_log (LOG_ERR, "pgmReceiverTable_handler: unknown column.\n");
2805
case MODE_SET_RESERVE1:
2807
snmp_log (LOG_ERR, "pgmReceiverTable_handler: unsupported mode.\n");
2812
return SNMP_ERR_NOERROR;
2821
send_pgmStart_trap (void)
2823
pgm_debug ("send_pgmStart_trap ()");
2825
netsnmp_variable_list *var_list = NULL;
2826
static const oid pgmStart_oid[] = { 1,3,6,1,3,112,2,0,1 };
2829
* Set the snmpTrapOid.0 value
2831
snmp_varlist_add_variable (&var_list,
2832
snmptrap_oid, OID_LENGTH( snmptrap_oid ),
2834
(const u_char*)pgmStart_oid, sizeof(pgmStart_oid));
2836
* Add any extra (optional) objects here
2840
* Send the trap to the list of configured destinations
2843
send_v2trap (var_list);
2844
snmp_free_varbind (var_list);
2845
return SNMP_ERR_NOERROR;
2850
send_pgmStop_trap (void)
2852
pgm_debug ("send_pgmStop_trap ()");
2854
netsnmp_variable_list *var_list = NULL;
2855
static const oid pgmStop_oid[] = { 1,3,6,1,3,112,2,0,2 };
2858
* Set the snmpTrapOid.0 value
2860
snmp_varlist_add_variable (&var_list,
2861
snmptrap_oid, OID_LENGTH(snmptrap_oid),
2863
(const u_char*)pgmStop_oid, sizeof(pgmStop_oid));
2867
* Add any extra (optional) objects here
2871
* Send the trap to the list of configured destinations
2874
send_v2trap (var_list);
2875
snmp_free_varbind (var_list);
2876
return SNMP_ERR_NOERROR;
2881
send_pgmNewSourceTrap_trap (void)
2883
pgm_debug ("send_pgmNewSourceTrap_trap ()");
2885
netsnmp_variable_list *var_list = NULL;
2886
static const oid pgmNewSourceTrap_oid[] = { 1,3,6,1,3,112,2,0,3 };
2887
static const oid pgmSourceSourceGsi_oid[] = { 1,3,6,1,3,112,1,2,100,2,1,6, /* insert index here */ };
2888
static const oid pgmSourceSourcePortNumber_oid[] = { 1,3,6,1,3,112,1,2,100,2,1,7, /* insert index here */ };
2891
* Set the snmpTrapOid.0 value
2893
snmp_varlist_add_variable (&var_list,
2894
snmptrap_oid, OID_LENGTH(snmptrap_oid),
2896
(const u_char*)pgmNewSourceTrap_oid, sizeof(pgmNewSourceTrap_oid));
2898
* Add any objects from the trap definition
2900
snmp_varlist_add_variable (&var_list,
2901
pgmSourceSourceGsi_oid, OID_LENGTH(pgmSourceSourceGsi_oid),
2903
/* Set an appropriate value for pgmSourceSourceGsi */
2905
snmp_varlist_add_variable (&var_list,
2906
pgmSourceSourcePortNumber_oid, OID_LENGTH(pgmSourceSourcePortNumber_oid),
2908
/* Set an appropriate value for pgmSourceSourcePortNumber */
2911
* Add any extra (optional) objects here
2915
* Send the trap to the list of configured destinations
2918
send_v2trap (var_list);
2919
snmp_free_varbind (var_list);
2920
return SNMP_ERR_NOERROR;
2925
send_pgmClosedSourceTrap_trap (void)
2927
pgm_debug ("send_pgmClosedSourceTrap_trap ()");
2929
netsnmp_variable_list *var_list = NULL;
2930
static const oid pgmClosedSourceTrap_oid[] = { 1,3,6,1,3,112,2,0,4 };
2931
static const oid pgmSourceSourceGsi_oid[] = { 1,3,6,1,3,112,1,2,100,2,1,6, /* insert index here */ };
2932
static const oid pgmSourceSourcePortNumber_oid[] = { 1,3,6,1,3,112,1,2,100,2,1,7, /* insert index here */ };
2935
* Set the snmpTrapOid.0 value
2937
snmp_varlist_add_variable (&var_list,
2938
snmptrap_oid, OID_LENGTH(snmptrap_oid),
2940
(const u_char*)pgmClosedSourceTrap_oid, sizeof(pgmClosedSourceTrap_oid));
2942
* Add any objects from the trap definition
2944
snmp_varlist_add_variable (&var_list,
2945
pgmSourceSourceGsi_oid, OID_LENGTH(pgmSourceSourceGsi_oid),
2947
/* Set an appropriate value for pgmSourceSourceGsi */
2949
snmp_varlist_add_variable (&var_list,
2950
pgmSourceSourcePortNumber_oid, OID_LENGTH(pgmSourceSourcePortNumber_oid),
2952
/* Set an appropriate value for pgmSourceSourcePortNumber */
2955
* Add any extra (optional) objects here
2959
* Send the trap to the list of configured destinations
2962
send_v2trap (var_list);
2963
snmp_free_varbind (var_list);
2964
return SNMP_ERR_NOERROR;
2969
send_pgmNewReceiverTrap_trap (void)
2971
pgm_debug ("send_pgmNewReceiverTrap_trap ()");
2973
netsnmp_variable_list *var_list = NULL;
2974
static const oid pgmNewReceiverTrap_oid[] = { 1,3,6,1,3,112,2,0,5 };
2975
static const oid pgmReceiverSourceGsi_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,8, /* insert index here */ };
2976
static const oid pgmReceiverSourcePortNumber_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,9, /* insert index here */ };
2977
static const oid pgmReceiverUniqueInstance_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,10, /* insert index here */ };
2980
* Set the snmpTrapOid.0 value
2982
snmp_varlist_add_variable (&var_list,
2983
snmptrap_oid, OID_LENGTH(snmptrap_oid),
2985
(const u_char*)pgmNewReceiverTrap_oid, sizeof(pgmNewReceiverTrap_oid));
2987
* Add any objects from the trap definition
2989
snmp_varlist_add_variable (&var_list,
2990
pgmReceiverSourceGsi_oid, OID_LENGTH(pgmReceiverSourceGsi_oid),
2992
/* Set an appropriate value for pgmReceiverSourceGsi */
2994
snmp_varlist_add_variable (&var_list,
2995
pgmReceiverSourcePortNumber_oid, OID_LENGTH(pgmReceiverSourcePortNumber_oid),
2997
/* Set an appropriate value for pgmReceiverSourcePortNumber */
2999
snmp_varlist_add_variable (&var_list,
3000
pgmReceiverUniqueInstance_oid, OID_LENGTH(pgmReceiverUniqueInstance_oid),
3002
/* Set an appropriate value for pgmReceiverUniqueInstance */
3005
* Add any extra (optional) objects here
3009
* Send the trap to the list of configured destinations
3012
send_v2trap (var_list);
3013
snmp_free_varbind (var_list);
3014
return SNMP_ERR_NOERROR;
3019
send_pgmClosedReceiverTrap_trap (void)
3021
pgm_debug ("send_pgmClosedReceiverTrap_trap ()");
3023
netsnmp_variable_list *var_list = NULL;
3024
static const oid pgmClosedReceiverTrap_oid[] = { 1,3,6,1,3,112,2,0,6 };
3025
static const oid pgmReceiverSourceGsi_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,8, /* insert index here */ };
3026
static const oid pgmReceiverSourcePortNumber_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,9, /* insert index here */ };
3027
static const oid pgmReceiverUniqueInstance_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,10, /* insert index here */ };
3030
* Set the snmpTrapOid.0 value
3032
snmp_varlist_add_variable (&var_list,
3033
snmptrap_oid, OID_LENGTH(snmptrap_oid),
3035
(const u_char*)pgmClosedReceiverTrap_oid, sizeof(pgmClosedReceiverTrap_oid));
3037
* Add any objects from the trap definition
3039
snmp_varlist_add_variable (&var_list,
3040
pgmReceiverSourceGsi_oid, OID_LENGTH(pgmReceiverSourceGsi_oid),
3042
/* Set an appropriate value for pgmReceiverSourceGsi */
3044
snmp_varlist_add_variable (&var_list,
3045
pgmReceiverSourcePortNumber_oid, OID_LENGTH(pgmReceiverSourcePortNumber_oid),
3047
/* Set an appropriate value for pgmReceiverSourcePortNumber */
3049
snmp_varlist_add_variable (&var_list,
3050
pgmReceiverUniqueInstance_oid, OID_LENGTH(pgmReceiverUniqueInstance_oid),
3052
/* Set an appropriate value for pgmReceiverUniqueInstance */
3055
* Add any extra (optional) objects here
3059
* Send the trap to the list of configured destinations
3062
send_v2trap (var_list);
3063
snmp_free_varbind (var_list);
3064
return SNMP_ERR_NOERROR;
3069
send_pgmNakFailuresTrap_trap (void)
3071
pgm_debug ("send_pgmNakFailuresTrap_trap ()");
3073
netsnmp_variable_list *var_list = NULL;
3074
static const oid pgmNakFailuresTrap_oid[] = { 1,3,6,1,3,112,2,0,7 };
3075
static const oid pgmReceiverSourceGsi_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,8, /* insert index here */ };
3076
static const oid pgmReceiverSourcePortNumber_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,9, /* insert index here */ };
3077
static const oid pgmReceiverUniqueInstance_oid[] = { 1,3,6,1,3,112,1,3,100,2,1,10, /* insert index here */ };
3078
static const oid pgmReceiverNakFailureThresholdTimer_oid[] = { 1,3,6,1,3,112,1,3,100,3,1,14, /* insert index here */ };
3079
static const oid pgmReceiverNakFailureThreshold_oid[] = { 1,3,6,1,3,112,1,3,100,3,1,15, /* insert index here */ };
3080
static const oid pgmReceiverNakFailuresLastInterval_oid[] = { 1,3,6,1,3,112,1,3,100,4,1,56, /* insert index here */ };
3081
static const oid pgmReceiverLastIntervalNakFailures_oid[] = { 1,3,6,1,3,112,1,3,100,4,1,57, /* insert index here */ };
3084
* Set the snmpTrapOid.0 value
3086
snmp_varlist_add_variable (&var_list,
3087
snmptrap_oid, OID_LENGTH(snmptrap_oid),
3089
(const u_char*)pgmNakFailuresTrap_oid, sizeof(pgmNakFailuresTrap_oid));
3091
* Add any objects from the trap definition
3093
snmp_varlist_add_variable (&var_list,
3094
pgmReceiverSourceGsi_oid, OID_LENGTH(pgmReceiverSourceGsi_oid),
3096
/* Set an appropriate value for pgmReceiverSourceGsi */
3098
snmp_varlist_add_variable (&var_list,
3099
pgmReceiverSourcePortNumber_oid, OID_LENGTH(pgmReceiverSourcePortNumber_oid),
3101
/* Set an appropriate value for pgmReceiverSourcePortNumber */
3103
snmp_varlist_add_variable (&var_list,
3104
pgmReceiverUniqueInstance_oid, OID_LENGTH(pgmReceiverUniqueInstance_oid),
3106
/* Set an appropriate value for pgmReceiverUniqueInstance */
3108
snmp_varlist_add_variable (&var_list,
3109
pgmReceiverNakFailureThresholdTimer_oid, OID_LENGTH(pgmReceiverNakFailureThresholdTimer_oid),
3111
/* Set an appropriate value for pgmReceiverNakFailureThresholdTimer */
3113
snmp_varlist_add_variable (&var_list,
3114
pgmReceiverNakFailureThreshold_oid, OID_LENGTH(pgmReceiverNakFailureThreshold_oid),
3116
/* Set an appropriate value for pgmReceiverNakFailureThreshold */
3118
snmp_varlist_add_variable (&var_list,
3119
pgmReceiverNakFailuresLastInterval_oid, OID_LENGTH(pgmReceiverNakFailuresLastInterval_oid),
3121
/* Set an appropriate value for pgmReceiverNakFailuresLastInterval */
3123
snmp_varlist_add_variable (&var_list,
3124
pgmReceiverLastIntervalNakFailures_oid, OID_LENGTH(pgmReceiverLastIntervalNakFailures_oid),
3126
/* Set an appropriate value for pgmReceiverLastIntervalNakFailures */
3129
* Add any extra (optional) objects here
3133
* Send the trap to the list of configured destinations
3136
send_v2trap (var_list);
3137
snmp_free_varbind (var_list);
3138
return SNMP_ERR_NOERROR;
3143
send_pgmNewDlrSourceTrap_trap (void)
3145
pgm_debug ("send_pgmNewDlrSourceTrap_trap ()");
3147
netsnmp_variable_list *var_list = NULL;
3148
static const oid pgmNewDlrSourceTrap_oid[] = { 1,3,6,1,3,112,2,0,8 };
3149
static const oid pgmDlrSourceSourceGsi_oid[] = { 1,3,6,1,3,112,1,4,100,2,1,4, /* insert index here */ };
3150
static const oid pgmDlrSourceSourcePortNumber_oid[] = { 1,3,6,1,3,112,1,4,100,2,1,5, /* insert index here */ };
3153
* Set the snmpTrapOid.0 value
3155
snmp_varlist_add_variable (&var_list,
3156
snmptrap_oid, OID_LENGTH(snmptrap_oid),
3158
(const u_char*)pgmNewDlrSourceTrap_oid, sizeof(pgmNewDlrSourceTrap_oid));
3160
* Add any objects from the trap definition
3162
snmp_varlist_add_variable (&var_list,
3163
pgmDlrSourceSourceGsi_oid, OID_LENGTH(pgmDlrSourceSourceGsi_oid),
3165
/* Set an appropriate value for pgmDlrSourceSourceGsi */
3167
snmp_varlist_add_variable (&var_list,
3168
pgmDlrSourceSourcePortNumber_oid, OID_LENGTH(pgmDlrSourceSourcePortNumber_oid),
3170
/* Set an appropriate value for pgmDlrSourceSourcePortNumber */
3173
* Add any extra (optional) objects here
3177
* Send the trap to the list of configured destinations
3180
send_v2trap (var_list);
3181
snmp_free_varbind (var_list);
3182
return SNMP_ERR_NOERROR;
3187
send_pgmClosedDlrSourceTrap_trap (void)
3189
pgm_debug ("send_pgmClosedDlrSourceTrap_trap ()");
3191
netsnmp_variable_list *var_list = NULL;
3192
static const oid pgmClosedDlrSourceTrap_oid[] = { 1,3,6,1,3,112,2,0,9 };
3193
static const oid pgmDlrSourceSourceGsi_oid[] = { 1,3,6,1,3,112,1,4,100,2,1,4, /* insert index here */ };
3194
static const oid pgmDlrSourceSourcePortNumber_oid[] = { 1,3,6,1,3,112,1,4,100,2,1,5, /* insert index here */ };
3197
* Set the snmpTrapOid.0 value
3199
snmp_varlist_add_variable (&var_list,
3200
snmptrap_oid, OID_LENGTH(snmptrap_oid),
3202
(const u_char*)pgmClosedDlrSourceTrap_oid, sizeof(pgmClosedDlrSourceTrap_oid));
3205
* Add any objects from the trap definition
3207
snmp_varlist_add_variable (&var_list,
3208
pgmDlrSourceSourceGsi_oid, OID_LENGTH(pgmDlrSourceSourceGsi_oid),
3210
/* Set an appropriate value for pgmDlrSourceSourceGsi */
3212
snmp_varlist_add_variable (&var_list,
3213
pgmDlrSourceSourcePortNumber_oid, OID_LENGTH(pgmDlrSourceSourcePortNumber_oid),
3215
/* Set an appropriate value for pgmDlrSourceSourcePortNumber */
3218
* Add any extra (optional) objects here
3222
* Send the trap to the list of configured destinations
3225
send_v2trap (var_list);
3226
snmp_free_varbind (var_list);
3227
return SNMP_ERR_NOERROR;