| 1 |
#include <net-snmp/net-snmp-config.h> |
| 2 |
#include <net-snmp/net-snmp-includes.h> |
| 3 |
#include <net-snmp/agent/net-snmp-agent-includes.h> |
| 4 |
|
| 5 |
#include "sctpScalars_common.h" |
| 6 |
|
| 7 |
#include <stdio.h> |
| 8 |
#include <errno.h> |
| 9 |
#include <stdlib.h> |
| 10 |
#include <unistd.h> |
| 11 |
#include <sys/types.h> |
| 12 |
#include <sys/sysctl.h> |
| 13 |
#include <stdint.h> |
| 14 |
#include <sys/socket.h> |
| 15 |
#include <netinet/in.h> |
| 16 |
#include <netinet/sctp.h> |
| 17 |
#include <netinet/sctp_constants.h> |
| 18 |
|
| 19 |
void |
| 20 |
netsnmp_access_sctp_stats_arch_init(void) |
| 21 |
{ |
| 22 |
} |
| 23 |
|
| 24 |
int |
| 25 |
netsnmp_access_sctp_stats_arch_load(netsnmp_sctp_stats * sctp_stats) |
| 26 |
{ |
| 27 |
struct sctpstat stat; |
| 28 |
size_t len = sizeof(struct sctpstat); |
| 29 |
|
| 30 |
if (sysctlbyname("net.inet.sctp.stats", &stat, &len, NULL, 0) < 0) { |
| 31 |
return(-1); |
| 32 |
} |
| 33 |
memset(sctp_stats, 0, sizeof(netsnmp_sctp_stats)); |
| 34 |
sctp_stats->curr_estab = stat.sctps_currestab; |
| 35 |
sctp_stats->active_estabs = stat.sctps_activeestab; |
| 36 |
sctp_stats->passive_estabs = stat.sctps_passiveestab; |
| 37 |
sctp_stats->aborteds = stat.sctps_aborted; |
| 38 |
sctp_stats->shutdowns = stat.sctps_shutdown; |
| 39 |
sctp_stats->out_of_blues = stat.sctps_outoftheblue; |
| 40 |
sctp_stats->checksum_errors = stat.sctps_checksumerrors; |
| 41 |
sctp_stats->out_ctrl_chunks.low = stat.sctps_outcontrolchunks; |
| 42 |
sctp_stats->out_order_chunks.low = stat.sctps_outorderchunks; |
| 43 |
sctp_stats->out_unorder_chunks.low = stat.sctps_outunorderchunks; |
| 44 |
sctp_stats->in_ctrl_chunks.low = stat.sctps_incontrolchunks; |
| 45 |
sctp_stats->in_order_chunks.low = stat.sctps_inorderchunks; |
| 46 |
sctp_stats->in_unorder_chunks.low = stat.sctps_inunorderchunks; |
| 47 |
sctp_stats->frag_usr_msgs.low = stat.sctps_fragusrmsgs; |
| 48 |
sctp_stats->reasm_usr_msgs.low = stat.sctps_reasmusrmsgs; |
| 49 |
sctp_stats->out_sctp_packs.low = stat.sctps_outpackets; |
| 50 |
sctp_stats->in_sctp_packs.low = stat.sctps_inpackets; |
| 51 |
sctp_stats->discontinuity_time = 0; |
| 52 |
return 0; |
| 53 |
} |
| 54 |
|
| 55 |
void |
| 56 |
netsnmp_access_sctp_params_arch_init(void) |
| 57 |
{ |
| 58 |
} |
| 59 |
|
| 60 |
int |
| 61 |
netsnmp_access_sctp_params_arch_load(netsnmp_sctp_params * sctp_params) |
| 62 |
{ |
| 63 |
size_t len = sizeof(uint32_t); |
| 64 |
|
| 65 |
sctp_params->rto_algorithm = NETSNMP_SCTP_ALGORITHM_VANJ; |
| 66 |
sctp_params->max_assocs = SCTP_MAX_NUM_OF_ASOC; |
| 67 |
if (sysctlbyname("net.inet.sctp.rto_max", |
| 68 |
&sctp_params->rto_max, |
| 69 |
&len, NULL, 0) < 0) { |
| 70 |
return(-1); |
| 71 |
} |
| 72 |
if (sysctlbyname("net.inet.sctp.rto_min", |
| 73 |
&sctp_params->rto_min, |
| 74 |
&len, NULL, 0) < 0) { |
| 75 |
return(-1); |
| 76 |
} |
| 77 |
if (sysctlbyname("net.inet.sctp.rto_initial", |
| 78 |
&sctp_params->rto_initial, |
| 79 |
&len, NULL, 0) < 0) { |
| 80 |
return(-1); |
| 81 |
} |
| 82 |
if (sysctlbyname("net.inet.sctp.valid_cookie_life", |
| 83 |
&sctp_params->val_cookie_life, |
| 84 |
&len, NULL, 0) < 0) { |
| 85 |
return(-1); |
| 86 |
} |
| 87 |
if (sysctlbyname("net.inet.sctp.init_rtx_max", |
| 88 |
&sctp_params->max_init_retr, |
| 89 |
&len, NULL, 0) < 0) { |
| 90 |
return(-1); |
| 91 |
} |
| 92 |
return 0; |
| 93 |
} |