src/sflow_api.c
static int sfl_dsi_compare(SFLDataSource_instance *pdsi1, SFLDataSource_instance *pdsi2) {
    /* could have used just memcmp(),  but not sure if that would */
    /* give the right answer on little-endian platforms. Safer to be explicit... */
    int cmp = pdsi2->ds_class - pdsi1->ds_class;
    if(cmp == 0) cmp = pdsi2->ds_index - pdsi1->ds_index;
    if(cmp == 0) cmp = pdsi2->ds_instance - pdsi1->ds_instance;
    return cmp;
}
/*_________________---------------------------__________________
  _________________     sfl_dsi_compare       __________________
  -----------------___________________________------------------

  Note that if there is a mixture of ds_classes for this agent, then
  the simple numeric comparison may not be correct - the sort order (for
  the purposes of the SNMP MIB) should really be determined by the OID
  that these numeric ds_class numbers are a shorthand for.  For example,
  ds_class == 0 means ifIndex, which is the oid "1.3.6.1.2.1.2.2.1"
*/


Note that if there is a mixture of ds_classes for this agent, then
the simple numeric comparison may not be correct - the sort order (for
the purposes of the SNMP MIB) should really be determined by the OID
that these numeric ds_class numbers are a shorthand for.
Note that if there is a mixture of ds_classes for this agent then the simple numeric comparison may not be correct - the sort order ( for the purposes of the SNMP MIB ) should really be determined by the OID that these numeric ds_class numbers are a shorthand for .
static int sfl_dsi_compare(SFLDataSource_instance *pdsi1, SFLDataSource_instance *pdsi2) {
    int cmp = pdsi2->ds_class - pdsi1->ds_class;
    if(cmp == 0) cmp = pdsi2->ds_index - pdsi1->ds_index;
    if(cmp == 0) cmp = pdsi2->ds_instance - pdsi1->ds_instance;
    return cmp;
}
static int sfl_dsi_compare ( SFLDataSource_instance * pdsi1 , SFLDataSource_instance * pdsi2 ) { int cmp = pdsi2 -> ds_class - pdsi1 -> ds_class ; if ( cmp == 0 ) cmp = pdsi2 -> ds_index - pdsi1 -> ds_index ; if ( cmp == 0 ) cmp = pdsi2 -> ds_instance - pdsi1 -> ds_instance ; return cmp ; }
_________________---------------------------__________________
_________________     sfl_dsi_compare       __________________
___________________________
_________________ --------------------------- __________________ _________________ sfl_dsi_compare __________________ ___________________________
/* could have used just memcmp(),  but not sure if that would */ /* give the right answer on little-endian platforms. Safer to be explicit... */