Rename Mongoose constants: NS_ -> MG_, NSF_ -> MG_F_

PUBLISHED_FROM=c9cc54df1883aa17606de2b1ffb30f0cd687d037
This commit is contained in:
Sergey Lyubka authored and Sergey Lyubka committed 2015-09-21 15:19:34 +01:00
1 parent 32ab35f61f
commit e1dd3f06fe
41 files changed
+887 -883

No files matched your search

+2 -2
View File
@@ -1,6 +1,6 @@
PROG = mqtt_client
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. -pthread -DNS_ENABLE_SSL -lssl -lcrypto $(CFLAGS_EXTRA)
CFLAGS = -W -Wall -I../.. -pthread -DMG_ENABLE_SSL -lssl -lcrypto $(CFLAGS_EXTRA)
all: $(PROG)
@@ -8,7 +8,7 @@ $(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /DNS_ENABLE_SSL /MD /Fe$@
cl $(SOURCES) /I../.. /DMG_ENABLE_SSL /MD /Fe$@
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
+9 -9
View File
@@ -26,30 +26,30 @@ static void ev_handler(struct mg_connection *nc, int ev, void *p) {
(void) nc;
#if 0
if (ev != NS_POLL)
if (ev != MG_EV_POLL)
printf("USER HANDLER GOT %d\n", ev);
#endif
switch (ev) {
case NS_CONNECT:
case MG_EV_CONNECT:
mg_set_protocol_mqtt(nc);
mg_send_mqtt_handshake(nc, "dummy");
break;
case NS_MQTT_CONNACK:
if (msg->connack_ret_code != NS_MQTT_CONNACK_ACCEPTED) {
case MG_EV_MQTT_CONNACK:
if (msg->connack_ret_code != MG_EV_MQTT_CONNACK_ACCEPTED) {
printf("Got mqtt connection error: %d\n", msg->connack_ret_code);
exit(1);
}
printf("Subscribing to '/stuff'\n");
mg_mqtt_subscribe(nc, topic_expressions, sizeof(topic_expressions)/sizeof(*topic_expressions), 42);
break;
case NS_MQTT_PUBACK:
case MG_EV_MQTT_PUBACK:
printf("Message publishing acknowledged (msg_id: %d)\n", msg->message_id);
break;
case NS_MQTT_SUBACK:
case MG_EV_MQTT_SUBACK:
printf("Subscription acknowledged, forwarding to '/test'\n");
break;
case NS_MQTT_PUBLISH:
case MG_EV_MQTT_PUBLISH:
{
#if 0
char hex[1024] = {0};
@@ -60,10 +60,10 @@ static void ev_handler(struct mg_connection *nc, int ev, void *p) {
#endif
printf("Forwarding to /test\n");
mg_mqtt_publish(nc, "/test", 65, NS_MQTT_QOS(0), msg->payload.p, msg->payload.len);
mg_mqtt_publish(nc, "/test", 65, MG_MQTT_QOS(0), msg->payload.p, msg->payload.len);
}
break;
case NS_CLOSE:
case MG_EV_CLOSE:
printf("Connection closed\n");
exit(1);
}