From f5ada2850552560a24e473e02532e75870ab7307 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 3 Mar 2014 16:23:44 -0500 Subject: [PATCH] LP#1268619: websockets: initial C libs api_level support Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- src/libopensrf/osrf_message.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libopensrf/osrf_message.c b/src/libopensrf/osrf_message.c index 364c875..3681dfa 100644 --- a/src/libopensrf/osrf_message.c +++ b/src/libopensrf/osrf_message.c @@ -425,6 +425,9 @@ jsonObject* osrfMessageToJSON( const osrfMessage* msg ) { if (msg->sender_ingress != NULL) jsonObjectSetKey(json, "ingress", jsonNewObject(msg->sender_ingress)); + if (msg->protocol > 0) + jsonObjectSetKey(json, "api_level", jsonNewNumberObject(msg->protocol)); + switch(msg->m_type) { case CONNECT: @@ -620,7 +623,7 @@ static osrfMessage* deserialize_one_message( const jsonObject* obj ) { // Get the protocol, defaulting to zero. int protocol = 0; - tmp = jsonObjectGetKeyConst( obj, "protocol" ); + tmp = jsonObjectGetKeyConst( obj, "api_level" ); if(tmp) { const char* proto = jsonObjectGetString(tmp); if( proto ) { -- 2.43.2