Cking
Junior Member level 1
opc_stat_local
static void
aodv_rte_local_stats_reg (void)
{
/** Initializes the local statistic handles **/
FIN (aodv_rte_local_stats_reg (void));
/* Allocate memory for the structure that stores */
/* all the statistic handles */
local_stat_handle_ptr = (AodvT_Local_Stathandles*) op_prg_mem_alloc (sizeof (AodvT_Local_Stathandles));
/* Register each of the local statistic */
local_stat_handle_ptr->route_discovery_time_shandle = op_stat_reg ("AODV.Route Discovery Time", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->pkt_queue_size_shandle = op_stat_reg ("AODV.Packet Queue Size", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->num_pkts_discard_shandle = op_stat_reg ("AODV.Total Packets Dropped", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->route_table_size_shandle = op_stat_reg ("AODV.Route Table Size", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->num_hops_shandle = op_stat_reg ("AODV.Number of Hops per Route", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->rte_traf_rcvd_bps_shandle = op_stat_reg ("AODV.Routing Traffic Received (bits/sec)", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->rte_traf_rcvd_pps_shandle = op_stat_reg ("AODV.Routing Traffic Received (pkts/sec)", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->rte_traf_sent_bps_shandle = op_stat_reg ("AODV.Routing Traffic Sent (bits/sec)", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->rte_traf_sent_pps_shandle = op_stat_reg ("AODV.Routing Traffic Sent (pkts/sec)", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->total_requests_sent_shandle = op_stat_reg ("AODV.Total Route Requests Sent", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->total_replies_sent_shandle = op_stat_reg ("AODV.Total Route Replies Sent", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->total_replies_sent_from_dest_shandle = op_stat_reg ("AODV.Total Replies Sent from Destination", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->total_cached_replies_sent_shandle = op_stat_reg ("AODV.Total Cached Replies Sent", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->total_route_errors_sent_shandle = op_stat_reg ("AODV.Total Route Errors Sent", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->total_requests_fwd_shandle = op_stat_reg ("AODV.Total Route Requests Forwarded", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
FOUT;
}
this is procedure in aodv, the sentence bolded is hard for me to catch.
i think there is no need to allocate memory in advance.
what do you think?
static void
aodv_rte_local_stats_reg (void)
{
/** Initializes the local statistic handles **/
FIN (aodv_rte_local_stats_reg (void));
/* Allocate memory for the structure that stores */
/* all the statistic handles */
local_stat_handle_ptr = (AodvT_Local_Stathandles*) op_prg_mem_alloc (sizeof (AodvT_Local_Stathandles));
/* Register each of the local statistic */
local_stat_handle_ptr->route_discovery_time_shandle = op_stat_reg ("AODV.Route Discovery Time", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->pkt_queue_size_shandle = op_stat_reg ("AODV.Packet Queue Size", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->num_pkts_discard_shandle = op_stat_reg ("AODV.Total Packets Dropped", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->route_table_size_shandle = op_stat_reg ("AODV.Route Table Size", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->num_hops_shandle = op_stat_reg ("AODV.Number of Hops per Route", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->rte_traf_rcvd_bps_shandle = op_stat_reg ("AODV.Routing Traffic Received (bits/sec)", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->rte_traf_rcvd_pps_shandle = op_stat_reg ("AODV.Routing Traffic Received (pkts/sec)", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->rte_traf_sent_bps_shandle = op_stat_reg ("AODV.Routing Traffic Sent (bits/sec)", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->rte_traf_sent_pps_shandle = op_stat_reg ("AODV.Routing Traffic Sent (pkts/sec)", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->total_requests_sent_shandle = op_stat_reg ("AODV.Total Route Requests Sent", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->total_replies_sent_shandle = op_stat_reg ("AODV.Total Route Replies Sent", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->total_replies_sent_from_dest_shandle = op_stat_reg ("AODV.Total Replies Sent from Destination", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->total_cached_replies_sent_shandle = op_stat_reg ("AODV.Total Cached Replies Sent", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->total_route_errors_sent_shandle = op_stat_reg ("AODV.Total Route Errors Sent", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
local_stat_handle_ptr->total_requests_fwd_shandle = op_stat_reg ("AODV.Total Route Requests Forwarded", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
FOUT;
}
this is procedure in aodv, the sentence bolded is hard for me to catch.
i think there is no need to allocate memory in advance.
what do you think?