--- libaitmqtt/inc/mqttapi.h 2012/06/29 08:22:49 1.2.4.1 +++ libaitmqtt/inc/mqttapi.h 2012/07/03 08:57:04 1.4 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: mqttapi.h,v 1.2.4.1 2012/06/29 08:22:49 misho Exp $ +* $Id: mqttapi.h,v 1.4 2012/07/03 08:57:04 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -72,9 +72,11 @@ typedef struct { * @sock = Client socket from accept() * @buf = Message buffer * @timeout = timeout + * @nb = Non block socket * return: NULL error or !=NULL allocated server handle */ -mqtt_srv_t *mqtt_srv_cliInit(int sock, mqtt_msg_t * __restrict buf, unsigned short timeout); +mqtt_srv_t *mqtt_srv_cliInit(int sock, mqtt_msg_t * __restrict buf, + unsigned short timeout, int nb); /* * mqtt_srv_Fini() Finish MQTT server side support for clients * @@ -127,6 +129,16 @@ int mqtt_srv_Listen(int sock, int maxconn, int nb); * return: -1 error, 0 host is alive, 1 timeout session or 2 broken session */ int mqtt_KeepAlive(int sock, unsigned short ka, unsigned char tries); +/* + * mqtt_WillMessage() - Publish WILL message + * + * @sock = connected socket + * @ka = keep alive timeout + * @topic = will topic + * @data = will message + * return: -1 error, 1 timeout, 2 not ack or 0 ok + */ +int mqtt_WillMessage(int sock, unsigned short ka, const char *topic, const char *data); #ifdef API_CLIENT_SIDE