new put_ac_status function, derives security flags from dtls settings in conn object.
FossilOrigin-Name: 538d29d6794eb9388f3edfc50d05ba768f7fd41ce021fa2b8cb98c14ddca5d10
This commit is contained in:
parent
df7dabe526
commit
9aaa12a504
29
src/cw/cw_put_ac_status.c
Normal file
29
src/cw/cw_put_ac_status.c
Normal file
@ -0,0 +1,29 @@
|
||||
#include "cw.h"
|
||||
|
||||
/**
|
||||
* Put an cw_ac_stauts structure to a buffer
|
||||
* @param dst destination buffer
|
||||
* @param s #cw_ac_status to put
|
||||
* @return number of bytes put
|
||||
* This function is only useful (used) in conjunction with
|
||||
* putting AC Descriptor message elements.
|
||||
*/
|
||||
int cw_put_ac_status(uint8_t * dst, struct cw_ac_status *s, struct conn * conn)
|
||||
{
|
||||
uint8_t *d = dst;
|
||||
|
||||
d += cw_put_dword(d, (s->stations << 16) | (s->limit));
|
||||
d += cw_put_dword(d, (s->active_wtps << 16) | (s->max_wtps));
|
||||
|
||||
|
||||
int security = 0;
|
||||
security |= conn->dtls_cert_file ? CW_FLAG_AC_SECURITY_X : 0;
|
||||
security |= conn->dtls_psk ? CW_FLAG_AC_SECURITY_S : 0;
|
||||
|
||||
|
||||
d += cw_put_dword(d,
|
||||
(security << 24) | (s->rmac_field << 16) | (s->dtls_policy));
|
||||
return d - dst;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user