|
|
|
@ -1,6 +1,9 @@ |
|
|
|
|
#ifndef __CW_H |
|
|
|
|
#define __CW_H |
|
|
|
|
|
|
|
|
|
#include <arpa/inet.h> |
|
|
|
|
|
|
|
|
|
#include "bstr.h" |
|
|
|
|
#include "mbag.h" |
|
|
|
|
#include "conn.h" |
|
|
|
|
#include "action.h" |
|
|
|
@ -12,14 +15,7 @@ |
|
|
|
|
* @{ |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
extern int cw_read_wtp_descriptor(mbag_t mbag, struct conn *conn, |
|
|
|
|
struct cw_action_in *a, uint8_t * data, int len); |
|
|
|
|
|
|
|
|
|
extern int cw_read_wtp_descriptor_7(mbag_t mbag, struct conn *conn, |
|
|
|
|
struct cw_action_in *a, uint8_t * data, int len); |
|
|
|
|
|
|
|
|
|
extern int cw_read_wtp_descriptor_versions(mbag_t mbag, uint8_t * data, |
|
|
|
|
int len); |
|
|
|
|
|
|
|
|
|
/* Use some macros from LWAPP */ |
|
|
|
|
|
|
|
|
@ -29,7 +25,7 @@ extern int cw_read_wtp_descriptor_versions(mbag_t mbag, uint8_t * data, |
|
|
|
|
*/ |
|
|
|
|
#define cw_put_byte lw_put_byte |
|
|
|
|
/**
|
|
|
|
|
* Put a word to an output buffee. |
|
|
|
|
* Put a word to an output buffer. |
|
|
|
|
* see #lw_put_word |
|
|
|
|
*/ |
|
|
|
|
#define cw_put_word lw_put_word |
|
|
|
@ -38,6 +34,37 @@ extern int cw_read_wtp_descriptor_versions(mbag_t mbag, uint8_t * data, |
|
|
|
|
#define cw_put_bstr lw_put_bstr |
|
|
|
|
#define cw_put_bstr16 lw_put_bstr16 |
|
|
|
|
|
|
|
|
|
#define cw_set_dword lw_set_dword |
|
|
|
|
|
|
|
|
|
#define cw_get_byte lw_get_byte |
|
|
|
|
#define cw_get_word lw_get_word |
|
|
|
|
#define cw_get_dword lw_get_dword |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static inline int cw_put_version(uint8_t * dst, uint16_t subelem_id, bstrv_t v) |
|
|
|
|
{ |
|
|
|
|
uint8_t *d = dst; |
|
|
|
|
d += cw_put_dword(d, bstrv_get_vendor_id(v)); |
|
|
|
|
d += cw_put_dword(d, (subelem_id << 16) | bstrv_len(v)); |
|
|
|
|
d += cw_put_data(d, bstrv_data(v), bstrv_len(v)); |
|
|
|
|
return d - dst; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern int cw_read_wtp_descriptor(mbag_t mbag, struct conn *conn, |
|
|
|
|
struct cw_action_in *a, uint8_t * data, int len); |
|
|
|
|
|
|
|
|
|
extern int cw_read_wtp_descriptor_7(mbag_t mbag, struct conn *conn, |
|
|
|
|
struct cw_action_in *a, uint8_t * data, int len); |
|
|
|
|
|
|
|
|
|
extern int cw_read_wtp_descriptor_versions(mbag_t mbag, uint8_t * data, |
|
|
|
|
int len); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*@} |
|
|
|
|