# Message Debug Functions

Message debug functions are not needed for proper toolkit operation but they can be useful during development, debugging and testing phases of product development. They are specific to HomePlug AV messages only.

## MMECode

    				char const * MMECode
    				uint16_t MMTYPE
    				uint8_t MSTATUS

Return text that explains the status code for a given Atheros vendor-specific management message. Argument `MMTYPE` is an unsigned integer in the range `0xA000` through `0xAFFF` and must exactly match the `MMTYPE` of the message returning the status code. For example, the `CNF` variant of a message is currently the only variant that has an `MSTATUS` field and so other variants return a default string. The function is declared in mme.h and defined in MMECode.c.

Inclusion of this function can increase application size by 3kb because the text associated with all Atheros vendor-specific management messages and errors are included whether needed or not. Conditional compilation statements are provided internally to suppress the full table with a terse substitute.

Although the Bootloader and firmware share some common Vendor Specific Management Messages, the two programs may return different codes for a given message and error condition. Where there are conflicts, Bootloader codes take precedence over firmware codes because it is unlikely that users will .issue the same messages to a device running firmware.

## MMEMode

    				char const * MMEMode
    				uint16_t MMTYPE

Return the mode of a given management message type as a string. The mode is determined by the two least significant bits of argument `MMTYPE`. The mode string will be one of REQ, CNF, IND or RSP. The function is declared in ihp.h and defined in MMEMode.c.

Most management messages have a request and a confirmation variant while a few have an indication and a response variant. Requests originate from the host and are acknolwedged by a confirmation from the device. Indications originate from a device and are acknowledged by a response from the host.

## MMEName

    				char const * MMEName
    				uint16_t MMTYPE

Return the name associated with a given management message type. The name is the mnemonic used to distinguish one message type from another in the HomePlug AV Specification or Atheros Firwmare Technical Reference Manual. Argument `MMTYPE` is an unsigned integer in the range `0x0000` through `0xAFFF`. The request, confirmation, indication and response variants of a management message will all return the same message name. The function is declared in mme.h and defined in MMEName.c.

## MMEPeek

    				void MMEPeek
    				void const * memory
    				size_t extent
    				FILE *fp

Prints an Atheros vendor-specific management message to stream `fp` in human readable format. Argument `buffer` is the message address and argument `extent` is the message extent in bytes. Output consists of a formatted header showing decoded header. The function is declared in mme.h and defined in MMEPeek.c.