- type_end = strrchr(counter_name, '_');
-
- if ((type_end != NULL) &&
- (strncmp(counter_name, "rx_", strlen("rx_")) == 0)) {
- if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
- sstrncpy(vl.type, "if_rx_errors", sizeof(vl.type));
- } else if (strncmp(type_end, "_dropped", strlen("_dropped")) == 0) {
- sstrncpy(vl.type, "if_rx_dropped", sizeof(vl.type));
- } else if (strncmp(type_end, "_bytes", strlen("_bytes")) == 0) {
- sstrncpy(vl.type, "if_rx_octets", sizeof(vl.type));
- } else if (strncmp(type_end, "_packets", strlen("_packets")) == 0) {
- sstrncpy(vl.type, "if_rx_packets", sizeof(vl.type));
- } else if (strncmp(type_end, "_placement", strlen("_placement")) == 0) {
- sstrncpy(vl.type, "if_rx_errors", sizeof(vl.type));
- } else if (strncmp(type_end, "_buff", strlen("_buff")) == 0) {
- sstrncpy(vl.type, "if_rx_errors", sizeof(vl.type));
- } else {
- /* Does not fit obvious type: use a more generic one */
- sstrncpy(vl.type, "derive", sizeof(vl.type));
- }
-
- } else if ((type_end != NULL) &&
- (strncmp(counter_name, "tx_", strlen("tx_"))) == 0) {
- if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
- sstrncpy(vl.type, "if_tx_errors", sizeof(vl.type));
- } else if (strncmp(type_end, "_dropped", strlen("_dropped")) == 0) {
- sstrncpy(vl.type, "if_tx_dropped", sizeof(vl.type));
- } else if (strncmp(type_end, "_bytes", strlen("_bytes")) == 0) {
- sstrncpy(vl.type, "if_tx_octets", sizeof(vl.type));
- } else if (strncmp(type_end, "_packets", strlen("_packets")) == 0) {
- sstrncpy(vl.type, "if_tx_packets", sizeof(vl.type));
- } else {
- /* Does not fit obvious type: use a more generic one */
- sstrncpy(vl.type, "derive", sizeof(vl.type));
- }
- } else if ((type_end != NULL) &&
- (strncmp(counter_name, "flow_", strlen("flow_"))) == 0) {
-
- if (strncmp(type_end, "_filters", strlen("_filters")) == 0) {
- sstrncpy(vl.type, "operations", sizeof(vl.type));
- } else if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
- sstrncpy(vl.type, "errors", sizeof(vl.type));
- } else if (strncmp(type_end, "_filters", strlen("_filters")) == 0) {
- sstrncpy(vl.type, "filter_result", sizeof(vl.type));
- }
- } else if ((type_end != NULL) &&
- (strncmp(counter_name, "mac_", strlen("mac_"))) == 0) {
- if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
- sstrncpy(vl.type, "errors", sizeof(vl.type));
- }
- } else {
- /* Does not fit obvious type, or strrchr error:
- * use a more generic type */
- sstrncpy(vl.type, "derive", sizeof(vl.type));
- }