Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New amendement for MQTT over QUIC Sync #145

Merged
merged 6 commits into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/quic/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ client(int type, const char *url, const char *qos, const char *topic, const char
nng_msg * msg;
const char *arg = "CLIENT FOR QUIC";

if ((rv = nng_mqtt_quic_client_open2(&sock, url)) != 0) {
if ((rv = nng_mqtt_quic_client_open(&sock, url)) != 0) {
printf("error in quic client open.\n");
}

Expand Down
31 changes: 30 additions & 1 deletion include/nng/mqtt/mqtt_quic.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,37 @@
#ifdef __cplusplus
extern "C" {
#endif

typedef struct conf_tls conf_tls;
typedef struct conf_quic conf_quic;
struct conf_tls {
bool enable;
char *url; // "tls+nmq-tcp://addr:port"
char *cafile;
char *certfile;
char *keyfile;
char *ca;
char *cert;
char *key;
char *key_password;
bool verify_peer;
bool set_fail; // fail_if_no_peer_cert
};

struct conf_quic {
conf_tls tls;
bool qos_first; // send QoS msg in high priority
bool multi_stream;
uint64_t qkeepalive; //keepalive timeout interval of QUIC transport
uint64_t qconnect_timeout; // HandshakeIdleTimeoutMs of QUIC
uint32_t qdiscon_timeout; // DisconnectTimeoutMs
uint32_t qidle_timeout; // Disconnect after idle
uint8_t qcongestion_control; // congestion control algorithm 1: bbr 0: cubic
};

NNG_DECL int nng_mqtt_quic_client_open(nng_socket *, const char *url);
NNG_DECL int nng_mqtt_quic_client_open2(nng_socket *sock, const char *url);
NNG_DECL int nng_mqtt_quic_client_open_conf(
nng_socket *sock, const char *url, conf_quic *conf);
NNG_DECL int nng_mqtt_quic_set_connect_cb(
nng_socket *, int (*cb)(void *, void *), void *arg);
NNG_DECL int nng_mqtt_quic_set_disconnect_cb(
Expand Down
Loading