UNSOLVED

Kili1

updated

16 years ago

K

Kili1

9 Posts

0

2314

May 18th, 2011 07:00

SNMP GetNext for MAC address

I have many different versions of an SNMP tool that can getNext values.

My problem is on MAC addresses. Below is an example of the MAC address result. It parses fine but the translation .... not sure how to get it to get it to work. And, I need to use ASL not perl for this.

apMAC-->\X-00-\X-16-

If I do a hexToString the result is still -->

apMAC-->\X-00-\X-16-

The code segment I am using to getNext is below with the hexToString in there.

      result = tm->snmpActGetNext(snmp, agent, oid)?IGNORE;

      result = tm->snmpActGetNext(agent, oid, snmpTimeout, snmpRetry, snmpPolicy, snmpFormat)?IGNORE;

      curOID = result[0];

      tempVal = string(getOID[0]);

      if (tempVal == "MacAddrTable")

            {

              getResult = hexToString(result[2]);

              FIX_MAC(getResult);

            }

FIX_MAC(getResult) {

   input=getResult;

    MAC:{

      m1:{char char}
      m2:{char char}
      m3:{char char}
      m4:{char char}
      m5:{char char}
      m6:{char char}
      }
  do {
   MAC = m1."-".m2."-".m3."-".m4."-".m5."-".m6;
   return MAC;
  }
}

  • Kili1

    9 Posts

    622

    0

    Posted January 26th, 2012 01:00

    I guess I should have given the full return info for the MAC - It does some of the hex values correct for the first part then changes to ASCII then back to hex format. So is there a way to convert ASCII character back to a number so I can turn it into hex?

    MAC-->\X00\X0F$f\X8BP
    MAC-->\X00\X0F$f\X8B`
    MAC-->\X00\X0F$f\X8Bp
    MAC-->\X00\X0F$f\X8B\X90
    MAC-->\X00\X0F$f\X8CÐ
    MAC-->\X00\X0F$f\X8Cà
    MAC-->\X00\X0F$f\X8Cð

  • bkuhhirte

    52 Posts

    620

    0

    Posted June 29th, 2012 09:00

    If you wanted it originally as a hex value, why run the "hexToString()" to begin with?

    Regards,

    Bill