| 1 |
#ifndef AWS_MQTT_PRIVATE_FIXED_HEADER_H |
| 2 |
#define AWS_MQTT_PRIVATE_FIXED_HEADER_H |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#include <aws/common/byte_buf.h> |
| 10 |
|
| 11 |
#include <aws/mqtt/mqtt.h> |
| 12 |
|
| 13 |
|
| 14 |
enum aws_mqtt_packet_type { |
| 15 |
|
| 16 |
AWS_MQTT_PACKET_CONNECT = 1, |
| 17 |
AWS_MQTT_PACKET_CONNACK, |
| 18 |
AWS_MQTT_PACKET_PUBLISH, |
| 19 |
AWS_MQTT_PACKET_PUBACK, |
| 20 |
AWS_MQTT_PACKET_PUBREC, |
| 21 |
AWS_MQTT_PACKET_PUBREL, |
| 22 |
AWS_MQTT_PACKET_PUBCOMP, |
| 23 |
AWS_MQTT_PACKET_SUBSCRIBE, |
| 24 |
AWS_MQTT_PACKET_SUBACK, |
| 25 |
AWS_MQTT_PACKET_UNSUBSCRIBE, |
| 26 |
AWS_MQTT_PACKET_UNSUBACK, |
| 27 |
AWS_MQTT_PACKET_PINGREQ, |
| 28 |
AWS_MQTT_PACKET_PINGRESP, |
| 29 |
AWS_MQTT_PACKET_DISCONNECT, |
| 30 |
|
| 31 |
}; |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
struct aws_mqtt_fixed_header { |
| 37 |
enum aws_mqtt_packet_type packet_type; |
| 38 |
size_t remaining_length; |
| 39 |
uint8_t flags; |
| 40 |
}; |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
AWS_MQTT_API enum aws_mqtt_packet_type aws_mqtt_get_packet_type(const uint8_t *buffer); |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
AWS_MQTT_API bool aws_mqtt_packet_has_flags(const struct aws_mqtt_fixed_header *header); |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
AWS_MQTT_API int aws_mqtt_fixed_header_encode(struct aws_byte_buf *buf, const struct aws_mqtt_fixed_header *header); |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
AWS_MQTT_API int aws_mqtt_fixed_header_decode(struct aws_byte_cursor *cur, struct aws_mqtt_fixed_header *header); |
| 61 |
|
| 62 |
AWS_MQTT_API int aws_mqtt311_decode_remaining_length(struct aws_byte_cursor *cur, size_t *remaining_length_out); |
| 63 |
|
| 64 |
#endif |