Convert the management error status TLV to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
b654f6c35c
commit
d308df8e27
10
tlv.c
10
tlv.c
|
@ -23,6 +23,7 @@
|
||||||
void tlv_post_recv(struct TLV *tlv)
|
void tlv_post_recv(struct TLV *tlv)
|
||||||
{
|
{
|
||||||
struct management_tlv *mgt;
|
struct management_tlv *mgt;
|
||||||
|
struct management_error_status *mes;
|
||||||
|
|
||||||
switch (tlv->type) {
|
switch (tlv->type) {
|
||||||
case TLV_MANAGEMENT:
|
case TLV_MANAGEMENT:
|
||||||
|
@ -30,6 +31,10 @@ void tlv_post_recv(struct TLV *tlv)
|
||||||
mgt->id = ntohs(mgt->id);
|
mgt->id = ntohs(mgt->id);
|
||||||
break;
|
break;
|
||||||
case TLV_MANAGEMENT_ERROR_STATUS:
|
case TLV_MANAGEMENT_ERROR_STATUS:
|
||||||
|
mes = (struct management_error_status *) tlv;
|
||||||
|
mes->error = ntohs(mes->error);
|
||||||
|
mes->id = ntohs(mes->id);
|
||||||
|
break;
|
||||||
case TLV_ORGANIZATION_EXTENSION:
|
case TLV_ORGANIZATION_EXTENSION:
|
||||||
case TLV_REQUEST_UNICAST_TRANSMISSION:
|
case TLV_REQUEST_UNICAST_TRANSMISSION:
|
||||||
case TLV_GRANT_UNICAST_TRANSMISSION:
|
case TLV_GRANT_UNICAST_TRANSMISSION:
|
||||||
|
@ -49,6 +54,7 @@ void tlv_post_recv(struct TLV *tlv)
|
||||||
void tlv_pre_send(struct TLV *tlv)
|
void tlv_pre_send(struct TLV *tlv)
|
||||||
{
|
{
|
||||||
struct management_tlv *mgt;
|
struct management_tlv *mgt;
|
||||||
|
struct management_error_status *mes;
|
||||||
|
|
||||||
switch (tlv->type) {
|
switch (tlv->type) {
|
||||||
case TLV_MANAGEMENT:
|
case TLV_MANAGEMENT:
|
||||||
|
@ -56,6 +62,10 @@ void tlv_pre_send(struct TLV *tlv)
|
||||||
mgt->id = htons(mgt->id);
|
mgt->id = htons(mgt->id);
|
||||||
break;
|
break;
|
||||||
case TLV_MANAGEMENT_ERROR_STATUS:
|
case TLV_MANAGEMENT_ERROR_STATUS:
|
||||||
|
mes = (struct management_error_status *) tlv;
|
||||||
|
mes->error = htons(mes->error);
|
||||||
|
mes->id = htons(mes->id);
|
||||||
|
break;
|
||||||
case TLV_ORGANIZATION_EXTENSION:
|
case TLV_ORGANIZATION_EXTENSION:
|
||||||
case TLV_REQUEST_UNICAST_TRANSMISSION:
|
case TLV_REQUEST_UNICAST_TRANSMISSION:
|
||||||
case TLV_GRANT_UNICAST_TRANSMISSION:
|
case TLV_GRANT_UNICAST_TRANSMISSION:
|
||||||
|
|
18
tlv.h
18
tlv.h
|
@ -96,6 +96,15 @@ enum management_action {
|
||||||
#define DELAY_MECHANISM 0x6000
|
#define DELAY_MECHANISM 0x6000
|
||||||
#define LOG_MIN_PDELAY_REQ_INTERVAL 0x6001
|
#define LOG_MIN_PDELAY_REQ_INTERVAL 0x6001
|
||||||
|
|
||||||
|
/* Management error ID values */
|
||||||
|
#define RESPONSE_TOO_BIG 0x0001
|
||||||
|
#define NO_SUCH_ID 0x0002
|
||||||
|
#define WRONG_LENGTH 0x0003
|
||||||
|
#define WRONG_VALUE 0x0004
|
||||||
|
#define NOT_SETABLE 0x0005
|
||||||
|
#define NOT_SUPPORTED 0x0006
|
||||||
|
#define GENERAL_ERROR 0xFFFE
|
||||||
|
|
||||||
struct management_tlv {
|
struct management_tlv {
|
||||||
Enumeration16 type;
|
Enumeration16 type;
|
||||||
UInteger16 length;
|
UInteger16 length;
|
||||||
|
@ -103,6 +112,15 @@ struct management_tlv {
|
||||||
Octet data[0];
|
Octet data[0];
|
||||||
} PACKED;
|
} PACKED;
|
||||||
|
|
||||||
|
struct management_error_status {
|
||||||
|
Enumeration16 type;
|
||||||
|
UInteger16 length;
|
||||||
|
Enumeration16 error;
|
||||||
|
Enumeration16 id;
|
||||||
|
Octet reserved[4];
|
||||||
|
Octet data[0];
|
||||||
|
} PACKED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts recognized value sub-fields into host byte order.
|
* Converts recognized value sub-fields into host byte order.
|
||||||
* @param tlv Pointer to a Type Length Value field.
|
* @param tlv Pointer to a Type Length Value field.
|
||||||
|
|
Loading…
Reference in New Issue