diff --git a/include/re_bfcp.h b/include/re_bfcp.h index 8690e12..13a56bf 100644 --- a/include/re_bfcp.h +++ b/include/re_bfcp.h @@ -131,7 +131,7 @@ struct bfcp_floor_reqinfo { size_t frsc; struct bfcp_beneficiary_info bfi; struct bfcp_reqby_info rbi; - uint8_t prio; + enum bfcp_prio prio; char *ppi; }; @@ -148,7 +148,7 @@ struct bfcp_attr { uint16_t bfid; uint16_t floorid; uint16_t freqid; - uint8_t prio; + enum bfcp_prio prio; struct bfcp_reqstat reqstat; struct bfcp_errcode errcode; char *errinfo; diff --git a/src/bfcp/attr.c b/src/bfcp/attr.c index a6bb172..92d060f 100644 --- a/src/bfcp/attr.c +++ b/src/bfcp/attr.c @@ -96,7 +96,8 @@ int bfcp_attr_encode(struct mbuf *mb, bool mand, enum bfcp_attrib type, const struct bfcp_reqby_info *rbi = v; const struct bfcp_floor_reqstat *frs = v; const struct bfcp_overall_reqstat *ors = v; - const unsigned int *num = v; + const uint16_t *u16 = v; + const enum bfcp_prio *prio = v; size_t start, len, i; int err = 0; @@ -111,11 +112,11 @@ int bfcp_attr_encode(struct mbuf *mb, bool mand, enum bfcp_attrib type, case BFCP_BENEFICIARY_ID: case BFCP_FLOOR_ID: case BFCP_FLOOR_REQUEST_ID: - err |= mbuf_write_u16(mb, htons(*num)); + err |= mbuf_write_u16(mb, htons(*u16)); break; case BFCP_PRIORITY: - err |= mbuf_write_u8(mb, *num << 5); + err |= mbuf_write_u8(mb, *prio << 5); err |= mbuf_write_u8(mb, 0x00); break; @@ -598,10 +599,13 @@ static int attr_print(int16_t level, struct re_printf *pf, case BFCP_BENEFICIARY_ID: case BFCP_FLOOR_ID: case BFCP_FLOOR_REQUEST_ID: - case BFCP_PRIORITY: err |= re_hprintf(pf, "%u", v->u16); break; + case BFCP_PRIORITY: + err |= re_hprintf(pf, "%d", v->prio); + break; + case BFCP_REQUEST_STATUS: err |= re_hprintf(pf, "%s (%d), qpos=%u", bfcp_reqstat_name(v->reqstat.stat),