[101] | 1 | /*
|
---|
| 2 | * TOPPERS ECHONET Lite Communication Middleware
|
---|
| 3 | *
|
---|
| 4 | * Copyright (C) 2015 Cores Co., Ltd. Japan
|
---|
| 5 | *
|
---|
| 6 | * ãLì ÒÍCȺÌ(1)`(4)Ìðð½·êÉÀèC{\tgEF
|
---|
| 7 | * Ai{\tgEFAðüϵ½àÌðÜÞDȺ¯¶jðgpE¡»Eü
|
---|
| 8 | * ÏEÄzziȺCpÆÄÔj·é±Æð³Åø·éD
|
---|
| 9 | * (1) {\tgEFAð\[XR[hÌ`Åp·éêÉÍCãLÌì
|
---|
| 10 | * \¦C±Ìpð¨æѺL̳ÛØKèªC»ÌÜÜÌ`Å\[
|
---|
| 11 | * XR[hÉÜÜêÄ¢é±ÆD
|
---|
| 12 | * (2) {\tgEFAðCCu`®ÈÇC¼Ì\tgEFAJÉg
|
---|
| 13 | * pÅ«é`ÅÄzz·éêÉÍCÄzzɺ¤hL
|
---|
| 14 | gip
|
---|
| 15 | * Ò}j
|
---|
| 16 | AÈÇjÉCãLÌì \¦C±Ìpð¨æѺL
|
---|
| 17 | * ̳ÛØKèðfÚ·é±ÆD
|
---|
| 18 | * (3) {\tgEFAðC@íÉgÝÞÈÇC¼Ì\tgEFAJÉg
|
---|
| 19 | * pÅ«È¢`ÅÄzz·éêÉÍCÌ¢¸ê©Ìðð½·±
|
---|
| 20 | * ÆD
|
---|
| 21 | * (a) Äzzɺ¤hL
|
---|
| 22 | gipÒ}j
|
---|
| 23 | AÈÇjÉCãLÌ
|
---|
| 24 | * ì \¦C±Ìpð¨æѺL̳ÛØKèðfÚ·é±ÆD
|
---|
| 25 | * (b) ÄzzÌ`ÔðCÊÉèßéû@ÉæÁÄCTOPPERSvWFNgÉ
|
---|
| 26 | * ñ·é±ÆD
|
---|
| 27 | * (4) {\tgEFAÌpÉæè¼ÚIܽÍÔÚIɶ¶é¢©Èé¹
|
---|
| 28 | * Q©çàCãLì Ò¨æÑTOPPERSvWFNgðÆÓ·é±ÆD
|
---|
| 29 | * ܽC{\tgEFAÌ[UܽÍGh[U©çÌ¢©Èé
|
---|
| 30 | * RÉîÿ©çàCãLì Ò¨æÑTOPPERSvWFNgð
|
---|
| 31 | * ÆÓ·é±ÆD
|
---|
| 32 | *
|
---|
| 33 | * {\tgEFAÍC³ÛØÅñ³êÄ¢éàÌÅ éDãLì Ò¨
|
---|
| 34 | * æÑTOPPERSvWFNgÍC{\tgEFAÉÖµÄCÁèÌgpÚI
|
---|
| 35 | * ÉηéK«àÜßÄC¢©ÈéÛØàsíÈ¢DܽC{\tgEF
|
---|
| 36 | * AÌpÉæè¼ÚIܽÍÔÚIɶ¶½¢©Èé¹QÉÖµÄàC»
|
---|
| 37 | * ÌÓCðíÈ¢D
|
---|
| 38 | *
|
---|
| 39 | * @(#) $Id: wamp.c 101 2015-06-02 15:37:23Z coas-nagasima $
|
---|
| 40 | */
|
---|
| 41 |
|
---|
| 42 | #include <string.h>
|
---|
| 43 | #include "wamp.h"
|
---|
| 44 | #include "kernel_cfg.h"
|
---|
| 45 | #include "fbs_string.h"
|
---|
| 46 | #include "main.h"
|
---|
| 47 |
|
---|
| 48 | /* p[XG[iè`ÌÝj */
|
---|
| 49 | const char parse_error[] = "com.sonycsl.kadecot.plugin.echonetlite.error.parse_error";
|
---|
| 50 | /* ³øÈNGXgiè`ÌÝj */
|
---|
| 51 | const char invalid_request[] = "com.sonycsl.kadecot.plugin.echonetlite.error.invalid_request";
|
---|
| 52 | /* ¶ÝµÈ¢\bhiè`ÌÝj */
|
---|
| 53 | const char method_not_found[] = "com.sonycsl.kadecot.plugin.echonetlite.error.method_not_found";
|
---|
| 54 | /* echo objectª¶ÝµÈ¢,@JSONArray`®ÉÈÁĢȢ */
|
---|
| 55 | const char invalid_params[] = "com.sonycsl.kadecot.plugin.echonetlite.error.invalid_params";
|
---|
| 56 | /* ^CAEg¶, R[obNª@null*/
|
---|
| 57 | const char internal_error[] = "com.sonycsl.kadecot.plugin.echonetlite.error.internal_error";
|
---|
| 58 |
|
---|
| 59 | static void wamp_idle_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 60 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 61 | static void wamp_code_push_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 62 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 63 | static void wamp_code_pop_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 64 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 65 | static void wamp_param_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 66 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 67 | static void wamp_nomore_param_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 68 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 69 | static void wamp_id_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 70 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 71 | static void wamp_list_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 72 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 73 | static void wamp_dict_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 74 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 75 | static void wamp_uri_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 76 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 77 | static void wamp_int_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 78 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 79 | static void wamp_string_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 80 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 81 |
|
---|
| 82 | static void wamp_proc_hello_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 83 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 84 | static void wamp_proc_welcome_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 85 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 86 | static void wamp_proc_abort_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 87 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 88 | static void wamp_proc_challenge_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 89 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 90 | static void wamp_proc_authenticate_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 91 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 92 | static void wamp_proc_goodbye_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 93 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 94 | static void wamp_proc_error_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 95 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 96 | static void wamp_proc_publish_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 97 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 98 | static void wamp_proc_published_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 99 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 100 | static void wamp_proc_subscribe_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 101 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 102 | static void wamp_proc_subscribed_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 103 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 104 | static void wamp_proc_unsubscribe_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 105 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 106 | static void wamp_proc_unsubscribed_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 107 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 108 | static void wamp_proc_event_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 109 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 110 | static void wamp_proc_call_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 111 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 112 | static void wamp_proc_cancel_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 113 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 114 | static void wamp_proc_result_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 115 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 116 | static void wamp_proc_register_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 117 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 118 | static void wamp_proc_registered_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 119 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 120 | static void wamp_proc_unregister_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 121 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 122 | static void wamp_proc_unregistered_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 123 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 124 | static void wamp_proc_invocation_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 125 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 126 | static void wamp_proc_interrupt_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 127 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 128 | static void wamp_proc_yield_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 129 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 130 |
|
---|
| 131 | static void wamp_param_handler(struct wamp_state *s, jsonsl_action_t action,
|
---|
| 132 | wamp_param_state_t param, const char *value);
|
---|
| 133 |
|
---|
| 134 | void wamp_error(wamp_state_t *s);
|
---|
| 135 | void wamp_error_type(wamp_state_t *s, const char *value);
|
---|
| 136 | void wamp_error_request_id(wamp_state_t *s, const char *value);
|
---|
| 137 | void wamp_error_details(wamp_state_t *s, const char *value);
|
---|
| 138 | void wamp_error_details_param(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 139 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 140 | void wamp_error_uri(wamp_state_t *s, const char *value);
|
---|
| 141 | void wamp_error_arguments(wamp_state_t *s, const char *value);
|
---|
| 142 | void wamp_error_arguments_param(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 143 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 144 | void wamp_error_argumentskw(wamp_state_t *s, const char *value);
|
---|
| 145 | void wamp_error_argumentskw_param(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 146 | struct jsonsl_state_st *state, const char *buf);
|
---|
| 147 | static void wamp_error_close(wamp_state_t *s);
|
---|
| 148 |
|
---|
| 149 | void wamp_init(wamp_state_t *s)
|
---|
| 150 | {
|
---|
| 151 | jsonsl_t jsn;
|
---|
| 152 |
|
---|
| 153 | memset(s, 0, sizeof(wamp_state_t));
|
---|
| 154 | s->jsn_buf_pos = -1;
|
---|
| 155 |
|
---|
| 156 | jsn = jsonsl_new((jsonsl_t)&s->jsn, JSN_NLEVELS);
|
---|
| 157 | jsn->data = s;
|
---|
| 158 | jsn->error_callback = wamp_error_callback;
|
---|
| 159 | jsn->action_callback = wamp_state_callback;
|
---|
| 160 | jsonsl_enable_all_callbacks(jsn);
|
---|
| 161 |
|
---|
| 162 | s->router.s = s;
|
---|
| 163 | s->client.s = s;
|
---|
| 164 | s->broker.s = s;
|
---|
| 165 | s->dealer.s = s;
|
---|
| 166 | s->publisher.s = s;
|
---|
| 167 | s->subscriber.s = s;
|
---|
| 168 | s->caller.s = s;
|
---|
| 169 | s->callee.s = s;
|
---|
| 170 | s->param_handler = wamp_param_handler;
|
---|
| 171 |
|
---|
| 172 | wamp_dealer_init(&s->dealer);
|
---|
| 173 | }
|
---|
| 174 |
|
---|
| 175 | void wamp_put_msg(wamp_state_t *s, ECN_FBS_ID msg, ID wbsid)
|
---|
| 176 | {
|
---|
| 177 | ECN_FBS_SSIZE_T len, pos;
|
---|
| 178 | uint8_t data;
|
---|
| 179 |
|
---|
| 180 | s->wbsid = wbsid;
|
---|
| 181 |
|
---|
| 182 | len = _ecn_fbs_get_datalen(msg);
|
---|
| 183 |
|
---|
| 184 | for (pos = 0; pos < len; pos++) {
|
---|
| 185 | data = _ecn_fbs_peek(msg, pos);
|
---|
| 186 |
|
---|
| 187 | if ((s->jsn_buf_pos >= 0) && (s->jsn_buf_pos < sizeof(s->jsn_buf)))
|
---|
| 188 | s->jsn_buf[s->jsn_buf_pos++] = data;
|
---|
| 189 | jsonsl_feed((jsonsl_t)s->jsn, &data, 1);
|
---|
| 190 | }
|
---|
| 191 | }
|
---|
| 192 |
|
---|
| 193 | void wamp_state_callback(jsonsl_t jsn, jsonsl_action_t action,
|
---|
| 194 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 195 | {
|
---|
| 196 | wamp_state_t *s = (wamp_state_t *)jsn->data;
|
---|
| 197 | /*syslog(7, "@%5ld '%c' L%d %c%s",
|
---|
| 198 | jsn->pos,
|
---|
| 199 | *buf,
|
---|
| 200 | state->level,
|
---|
| 201 | action,
|
---|
| 202 | jsonsl_strtype(state->type));*/
|
---|
| 203 |
|
---|
| 204 | switch (action) {
|
---|
| 205 | case JSONSL_ACTION_PUSH:
|
---|
| 206 | switch (state->type) {
|
---|
| 207 | case JSONSL_T_SPECIAL:
|
---|
| 208 | s->jsn_buf[0] = *buf;
|
---|
| 209 | s->jsn_buf_pos = 1;
|
---|
| 210 | break;
|
---|
| 211 | case JSONSL_T_STRING:
|
---|
| 212 | case JSONSL_T_HKEY:
|
---|
| 213 | s->jsn_buf_pos = 0;
|
---|
| 214 | break;
|
---|
| 215 | default:
|
---|
| 216 | s->jsn_buf_pos = -1;
|
---|
| 217 | }
|
---|
| 218 | break;
|
---|
| 219 | case JSONSL_ACTION_POP:
|
---|
| 220 | switch (state->type) {
|
---|
| 221 | case JSONSL_T_SPECIAL:
|
---|
| 222 | case JSONSL_T_STRING:
|
---|
| 223 | case JSONSL_T_HKEY:
|
---|
| 224 | s->jsn_buf_pos--;
|
---|
| 225 | if (s->jsn_buf_pos < sizeof(s->jsn_buf)) {
|
---|
| 226 | s->jsn_buf[s->jsn_buf_pos] = '\0';
|
---|
| 227 | }
|
---|
| 228 | break;
|
---|
| 229 | default:
|
---|
| 230 | s->jsn_buf[0] = '\0';
|
---|
| 231 | break;
|
---|
| 232 | }
|
---|
| 233 | s->jsn_buf_pos = -1;
|
---|
| 234 | break;
|
---|
| 235 | default:
|
---|
| 236 | s->jsn_buf_pos = -1;
|
---|
| 237 | break;
|
---|
| 238 | }
|
---|
| 239 |
|
---|
| 240 | switch (s->state) {
|
---|
| 241 | case WAMP_PARSE_STATE_IDLE:
|
---|
| 242 | wamp_idle_parse_state(s, action, state, buf);
|
---|
| 243 | break;
|
---|
| 244 | case WAMP_PARSE_STATE_CODE_PUSH:
|
---|
| 245 | wamp_code_push_parse_state(s, action, state, buf);
|
---|
| 246 | break;
|
---|
| 247 | case WAMP_PARSE_STATE_CODE_POP:
|
---|
| 248 | wamp_code_pop_parse_state(s, action, state, buf);
|
---|
| 249 | break;
|
---|
| 250 | case WAMP_PARSE_STATE_ID_PUSH:
|
---|
| 251 | wamp_id_parse_state(s, action, state, buf);
|
---|
| 252 | break;
|
---|
| 253 | case WAMP_PARSE_STATE_LIST_PUSH:
|
---|
| 254 | wamp_list_parse_state(s, action, state, buf);
|
---|
| 255 | break;
|
---|
| 256 | case WAMP_PARSE_STATE_DICT_PUSH:
|
---|
| 257 | wamp_dict_parse_state(s, action, state, buf);
|
---|
| 258 | break;
|
---|
| 259 | case WAMP_PARSE_STATE_URI_PUSH:
|
---|
| 260 | wamp_uri_parse_state(s, action, state, buf);
|
---|
| 261 | break;
|
---|
| 262 | case WAMP_PARSE_STATE_INT_PUSH:
|
---|
| 263 | wamp_int_parse_state(s, action, state, buf);
|
---|
| 264 | break;
|
---|
| 265 | case WAMP_PARSE_STATE_STRING_PUSH:
|
---|
| 266 | wamp_string_parse_state(s, action, state, buf);
|
---|
| 267 | break;
|
---|
| 268 | case WAMP_PARSE_STATE_PARAM:
|
---|
| 269 | wamp_param_parse_state(s, action, state, buf);
|
---|
| 270 | break;
|
---|
| 271 | case WAMP_PARSE_STATE_NOMORE_PARAM:
|
---|
| 272 | wamp_nomore_param_parse_state(s, action, state, buf);
|
---|
| 273 | break;
|
---|
| 274 | default:
|
---|
| 275 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 276 | break;
|
---|
| 277 | }
|
---|
| 278 |
|
---|
| 279 | if (s->state == WAMP_PARSE_STATE_ERROR) {
|
---|
| 280 | /* WAMPbZ[WÌÅã¾Á½ç */
|
---|
| 281 | if ((state->level == 1) && (action == JSONSL_ACTION_POP)
|
---|
| 282 | && (state->type == JSONSL_T_LIST)) {
|
---|
| 283 | s->message_close_handler(s);
|
---|
| 284 | }
|
---|
| 285 | else {
|
---|
| 286 | s->param_handler(s, JSONSL_ACTION_ERROR, s->prmst, NULL);
|
---|
| 287 | }
|
---|
| 288 | jsonsl_reset((jsonsl_t)s->jsn);
|
---|
| 289 | s->state = WAMP_PARSE_STATE_IDLE;
|
---|
| 290 | }
|
---|
| 291 | }
|
---|
| 292 |
|
---|
| 293 | int wamp_error_callback(jsonsl_t jsn, jsonsl_error_t err,
|
---|
| 294 | struct jsonsl_state_st *state, char *errat)
|
---|
| 295 | {
|
---|
| 296 | return 0;
|
---|
| 297 | }
|
---|
| 298 |
|
---|
| 299 | static void wamp_idle_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 300 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 301 | {
|
---|
| 302 | /* WAMPbZ[WÌ檾Á½ç */
|
---|
| 303 | if ((state->level == 1) && (action == JSONSL_ACTION_PUSH)
|
---|
| 304 | && (state->type == JSONSL_T_LIST)) {
|
---|
| 305 | /* bZ[WR[hæ¾JnóÔÉÚé */
|
---|
| 306 | s->state = WAMP_PARSE_STATE_CODE_PUSH;
|
---|
| 307 | }
|
---|
| 308 | }
|
---|
| 309 |
|
---|
| 310 | static void wamp_code_push_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 311 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 312 | {
|
---|
| 313 | /* bZ[WR[hÌæ¾Jn */
|
---|
| 314 | if ((action == JSONSL_ACTION_PUSH)
|
---|
| 315 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 316 | /* bZ[WR[hæ¾óÔÉÚé */
|
---|
| 317 | s->state = WAMP_PARSE_STATE_CODE_POP;
|
---|
| 318 | }
|
---|
| 319 | else
|
---|
| 320 | /* bZ[WR[hªæ¾Å«È¯êÎG[ */
|
---|
| 321 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 322 | }
|
---|
| 323 |
|
---|
| 324 | static void wamp_code_pop_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 325 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 326 | {
|
---|
| 327 | int code;
|
---|
| 328 | wamp_parse_state_t prsst = WAMP_PARSE_STATE_ERROR;
|
---|
| 329 |
|
---|
| 330 | /* bZ[WR[hªæ¾Å« */
|
---|
| 331 | if ((action == JSONSL_ACTION_POP)
|
---|
| 332 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 333 | /* bZ[WR[hðæ¾ */
|
---|
| 334 | code = atoi(s->jsn_buf);
|
---|
| 335 | switch (code) {
|
---|
| 336 | /* [HELLO, Realm|uri, Details|dict] */
|
---|
| 337 | case WAMP_CODE_HELLO:
|
---|
| 338 | wamp_router_hello(&s->router);
|
---|
| 339 | s->proc_handler = wamp_proc_hello_state;
|
---|
| 340 | s->message_close_handler = wamp_router_hello_close;
|
---|
| 341 | s->prmst = WAMP_PARAM_STATE_REALM_URI;
|
---|
| 342 | prsst = WAMP_PARSE_STATE_URI_PUSH;
|
---|
| 343 | break;
|
---|
| 344 | /* [WELCOME, Session|id, Details|dict] */
|
---|
| 345 | case WAMP_CODE_WELCOME:
|
---|
| 346 | wamp_client_welcome(&s->client);
|
---|
| 347 | s->proc_handler = wamp_proc_welcome_state;
|
---|
| 348 | s->message_close_handler = wamp_client_welcome_close;
|
---|
| 349 | s->prmst = WAMP_PARAM_STATE_SESSION_ID;
|
---|
| 350 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 351 | break;
|
---|
| 352 | /* [ABORT, Details|dict, Reason|uri] */
|
---|
| 353 | case WAMP_CODE_ABORT:
|
---|
| 354 | wamp_client_abort(&s->client);
|
---|
| 355 | s->proc_handler = wamp_proc_abort_state;
|
---|
| 356 | s->message_close_handler = wamp_client_abort_close;
|
---|
| 357 | s->prmst = WAMP_PARAM_STATE_DETAILS_DICT;
|
---|
| 358 | prsst = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 359 | break;
|
---|
| 360 | /* [CHALLENGE, AuthMethod|string, Extra|dict] */
|
---|
| 361 | case WAMP_CODE_CHALLENGE:
|
---|
| 362 | wamp_client_challenge(&s->client);
|
---|
| 363 | s->proc_handler = wamp_proc_challenge_state;
|
---|
| 364 | s->message_close_handler = wamp_client_challenge_close;
|
---|
| 365 | s->prmst = WAMP_PARAM_STATE_AUTHMETHOD_STRING;
|
---|
| 366 | prsst = WAMP_PARSE_STATE_STRING_PUSH;
|
---|
| 367 | break;
|
---|
| 368 | /* [AUTHENTICATE, Signature|string, Extra|dict] */
|
---|
| 369 | case WAMP_CODE_AUTHENTICATE:
|
---|
| 370 | wamp_router_authenticate(&s->router);
|
---|
| 371 | s->proc_handler = wamp_proc_authenticate_state;
|
---|
| 372 | s->message_close_handler = wamp_router_authenticate_close;
|
---|
| 373 | s->prmst = WAMP_PARAM_STATE_SIGNATURE_STRING;
|
---|
| 374 | prsst = WAMP_PARSE_STATE_STRING_PUSH;
|
---|
| 375 | break;
|
---|
| 376 | /* [GOODBYE, Details|dict, Reason|uri] */
|
---|
| 377 | case WAMP_CODE_GOODBYE:
|
---|
| 378 | wamp_router_goodbye(&s->router);
|
---|
| 379 | s->proc_handler = wamp_proc_goodbye_state;
|
---|
| 380 | s->message_close_handler = wamp_router_goodbye_close;
|
---|
| 381 | s->prmst = WAMP_PARAM_STATE_DETAILS_DICT;
|
---|
| 382 | prsst = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 383 | break;
|
---|
| 384 | /* [ERROR, REQUEST.Type|int, REQUEST.Request|id, Details|dict, Error|uri, Arguments|list, ArgumentsKw|dict] */
|
---|
| 385 | case WAMP_CODE_ERROR:
|
---|
| 386 | wamp_error(s);
|
---|
| 387 | s->proc_handler = wamp_proc_error_state;
|
---|
| 388 | s->message_close_handler = wamp_error_close;
|
---|
| 389 | s->prmst = WAMP_PARAM_STATE_TYPE_INT;
|
---|
| 390 | prsst = WAMP_PARSE_STATE_INT_PUSH;
|
---|
| 391 | break;
|
---|
| 392 | /* [PUBLISH, Request|id, Options|dict, Topic|uri, Arguments|list, ArgumentsKw|dict] */
|
---|
| 393 | case WAMP_CODE_PUBLISH:
|
---|
| 394 | wamp_broker_publish(&s->broker);
|
---|
| 395 | s->proc_handler = wamp_proc_publish_state;
|
---|
| 396 | s->message_close_handler = wamp_broker_publish_close;
|
---|
| 397 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 398 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 399 | break;
|
---|
| 400 | /* [PUBLISHED, PUBLISH.Request|id, Publication|id] */
|
---|
| 401 | case WAMP_CODE_PUBLISHED:
|
---|
| 402 | wamp_publisher_published(&s->publisher);
|
---|
| 403 | s->proc_handler = wamp_proc_published_state;
|
---|
| 404 | s->message_close_handler = wamp_publisher_published_close;
|
---|
| 405 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 406 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 407 | break;
|
---|
| 408 | /* [SUBSCRIBE, Request|id, Options|dict, Topic|uri] */
|
---|
| 409 | case WAMP_CODE_SUBSCRIBE:
|
---|
| 410 | wamp_broker_subscribe(&s->broker);
|
---|
| 411 | s->proc_handler = wamp_proc_subscribe_state;
|
---|
| 412 | s->message_close_handler = wamp_broker_subscribe_close;
|
---|
| 413 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 414 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 415 | break;
|
---|
| 416 | /* [SUBSCRIBED, SUBSCRIBE.Request|id, Subscription|id] */
|
---|
| 417 | case WAMP_CODE_SUBSCRIBED:
|
---|
| 418 | wamp_subscriber_subscribed(&s->subscriber);
|
---|
| 419 | s->proc_handler = wamp_proc_subscribed_state;
|
---|
| 420 | s->message_close_handler = wamp_subscriber_subscribed_close;
|
---|
| 421 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 422 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 423 | break;
|
---|
| 424 | /* [UNSUBSCRIBE, Request|id, SUBSCRIBED.Subscription|id] */
|
---|
| 425 | case WAMP_CODE_UNSUBSCRIBE:
|
---|
| 426 | wamp_broker_unsubscribe(&s->broker);
|
---|
| 427 | s->proc_handler = wamp_proc_unsubscribe_state;
|
---|
| 428 | s->message_close_handler = wamp_broker_unsubscribe_close;
|
---|
| 429 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 430 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 431 | break;
|
---|
| 432 | /* [UNSUBSCRIBED, UNSUBSCRIBE.Request|id] */
|
---|
| 433 | case WAMP_CODE_UNSUBSCRIBED:
|
---|
| 434 | wamp_subscriber_unsubscribed(&s->subscriber);
|
---|
| 435 | s->proc_handler = wamp_proc_unsubscribed_state;
|
---|
| 436 | s->message_close_handler = wamp_subscriber_unsubscribed_close;
|
---|
| 437 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 438 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 439 | break;
|
---|
| 440 | /* [EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict, PUBLISH.Arguments|list, PUBLISH.ArgumentsKw|dict] */
|
---|
| 441 | case WAMP_CODE_EVENT:
|
---|
| 442 | wamp_subscriber_event(&s->subscriber);
|
---|
| 443 | s->proc_handler = wamp_proc_event_state;
|
---|
| 444 | s->message_close_handler = wamp_subscriber_event_close;
|
---|
| 445 | s->prmst = WAMP_PARAM_STATE_SUBSCRIPTION_ID;
|
---|
| 446 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 447 | break;
|
---|
| 448 | /* [CALL, Request|id, Options|dict, Procedure|uri, Arguments|list, ArgumentsKw|dict] */
|
---|
| 449 | case WAMP_CODE_CALL:
|
---|
| 450 | wamp_dealer_call(&s->dealer);
|
---|
| 451 | s->proc_handler = wamp_proc_call_state;
|
---|
| 452 | s->message_close_handler = wamp_dealer_call_close;
|
---|
| 453 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 454 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 455 | break;
|
---|
| 456 | /* [CANCEL, CALL.Request|id, Options|dict] */
|
---|
| 457 | case WAMP_CODE_CANCEL:
|
---|
| 458 | wamp_dealer_cansel(&s->dealer);
|
---|
| 459 | s->proc_handler = wamp_proc_cancel_state;
|
---|
| 460 | s->message_close_handler = wamp_dealer_cansel_close;
|
---|
| 461 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 462 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 463 | break;
|
---|
| 464 | /* [RESULT, CALL.Request|id, Details|dict, YIELD.Arguments|list, YIELD.ArgumentsKw|dict] */
|
---|
| 465 | case WAMP_CODE_RESULT:
|
---|
| 466 | wamp_caller_result(&s->caller);
|
---|
| 467 | s->proc_handler = wamp_proc_result_state;
|
---|
| 468 | s->message_close_handler = wamp_caller_result_close;
|
---|
| 469 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 470 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 471 | break;
|
---|
| 472 | /* [REGISTER, Request|id, Options|dict, Procedure|uri] */
|
---|
| 473 | case WAMP_CODE_REGISTER:
|
---|
| 474 | wamp_dealer_register(&s->dealer);
|
---|
| 475 | s->proc_handler = wamp_proc_register_state;
|
---|
| 476 | s->message_close_handler = wamp_dealer_register_close;
|
---|
| 477 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 478 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 479 | break;
|
---|
| 480 | /* [REGISTERED, REGISTER.Request|id, Registration|id] */
|
---|
| 481 | case WAMP_CODE_REGISTERED:
|
---|
| 482 | wamp_callee_registered(&s->callee);
|
---|
| 483 | s->proc_handler = wamp_proc_registered_state;
|
---|
| 484 | s->message_close_handler = wamp_callee_registered_close;
|
---|
| 485 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 486 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 487 | break;
|
---|
| 488 | /* [UNREGISTER, Request|id, REGISTERED.Registration|id] */
|
---|
| 489 | case WAMP_CODE_UNREGISTER:
|
---|
| 490 | wamp_dealer_unregister(&s->dealer);
|
---|
| 491 | s->proc_handler = wamp_proc_unregister_state;
|
---|
| 492 | s->message_close_handler = wamp_dealer_unregister_close;
|
---|
| 493 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 494 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 495 | break;
|
---|
| 496 | /* [UNREGISTERED, UNREGISTER.Request|id] */
|
---|
| 497 | case WAMP_CODE_UNREGISTERED:
|
---|
| 498 | wamp_callee_unregistered(&s->callee);
|
---|
| 499 | s->proc_handler = wamp_proc_unregistered_state;
|
---|
| 500 | s->message_close_handler = wamp_callee_unregistered_close;
|
---|
| 501 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 502 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 503 | break;
|
---|
| 504 | /* [INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict, CALL.Arguments|list, CALL.ArgumentsKw|dict] */
|
---|
| 505 | case WAMP_CODE_INVOCATION:
|
---|
| 506 | wamp_callee_invocation(&s->callee);
|
---|
| 507 | s->proc_handler = wamp_proc_invocation_state;
|
---|
| 508 | s->message_close_handler = wamp_callee_invocation_close;
|
---|
| 509 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 510 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 511 | break;
|
---|
| 512 | /* [INTERRUPT, INVOCATION.Request|id, Options|dict] */
|
---|
| 513 | case WAMP_CODE_INTERRUPT:
|
---|
| 514 | wamp_callee_interrupt(&s->callee);
|
---|
| 515 | s->proc_handler = wamp_proc_interrupt_state;
|
---|
| 516 | s->message_close_handler = wamp_callee_interrupt_close;
|
---|
| 517 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 518 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 519 | break;
|
---|
| 520 | /* [YIELD, INVOCATION.Request|id, Options|dict, Arguments|list, ArgumentsKw|dict] */
|
---|
| 521 | case WAMP_CODE_YIELD:
|
---|
| 522 | wamp_dealer_yield(&s->dealer);
|
---|
| 523 | s->proc_handler = wamp_proc_yield_state;
|
---|
| 524 | s->message_close_handler = wamp_dealer_yield_close;
|
---|
| 525 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 526 | prsst = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 527 | break;
|
---|
| 528 | default:
|
---|
| 529 | s->proc_handler = NULL;
|
---|
| 530 | break;
|
---|
| 531 | }
|
---|
| 532 |
|
---|
| 533 | /* mÁÄ¢ébZ[WR[h¾Á½ç */
|
---|
| 534 | if (s->proc_handler != NULL) {
|
---|
| 535 | /* p[^æ¾óÔÉÚé */
|
---|
| 536 | s->code = (wamp_code_t)code;
|
---|
| 537 | }
|
---|
| 538 | }
|
---|
| 539 |
|
---|
| 540 | /* bZ[WR[hªæ¾Å«È¯êÎG[ */
|
---|
| 541 | s->state = prsst;
|
---|
| 542 | }
|
---|
| 543 |
|
---|
| 544 | static void wamp_id_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 545 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 546 | {
|
---|
| 547 | /* bZ[WR[hÌæ¾Jn */
|
---|
| 548 | if ((action == JSONSL_ACTION_PUSH)
|
---|
| 549 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 550 | s->param_handler(s, action, s->prmst, NULL);
|
---|
| 551 | /* bZ[WR[hæ¾óÔÉÚé */
|
---|
| 552 | s->state = WAMP_PARSE_STATE_PARAM;
|
---|
| 553 | }
|
---|
| 554 | else
|
---|
| 555 | /* bZ[WR[hªæ¾Å«È¯êÎG[ */
|
---|
| 556 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 557 | }
|
---|
| 558 |
|
---|
| 559 | static void wamp_list_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 560 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 561 | {
|
---|
| 562 | /* bZ[WR[hÌæ¾Jn */
|
---|
| 563 | if ((action == JSONSL_ACTION_PUSH)
|
---|
| 564 | && (state->type == JSONSL_T_LIST)) {
|
---|
| 565 | s->param_handler(s, action, s->prmst, NULL);
|
---|
| 566 | /* bZ[WR[hæ¾óÔÉÚé */
|
---|
| 567 | s->state = WAMP_PARSE_STATE_PARAM;
|
---|
| 568 | }
|
---|
| 569 | else
|
---|
| 570 | /* bZ[WR[hªæ¾Å«È¯êÎG[ */
|
---|
| 571 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 572 | }
|
---|
| 573 |
|
---|
| 574 | static void wamp_dict_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 575 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 576 | {
|
---|
| 577 | /* bZ[WR[hÌæ¾Jn */
|
---|
| 578 | if ((action == JSONSL_ACTION_PUSH)
|
---|
| 579 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 580 | s->param_handler(s, action, s->prmst, NULL);
|
---|
| 581 | /* bZ[WR[hæ¾óÔÉÚé */
|
---|
| 582 | s->state = WAMP_PARSE_STATE_PARAM;
|
---|
| 583 | }
|
---|
| 584 | else
|
---|
| 585 | /* bZ[WR[hªæ¾Å«È¯êÎG[ */
|
---|
| 586 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 587 | }
|
---|
| 588 |
|
---|
| 589 | static void wamp_uri_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 590 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 591 | {
|
---|
| 592 | /* bZ[WR[hÌæ¾Jn */
|
---|
| 593 | if ((action == JSONSL_ACTION_PUSH)
|
---|
| 594 | && (state->type == JSONSL_T_STRING)) {
|
---|
| 595 | s->param_handler(s, action, s->prmst, NULL);
|
---|
| 596 | /* bZ[WR[hæ¾óÔÉÚé */
|
---|
| 597 | s->state = WAMP_PARSE_STATE_PARAM;
|
---|
| 598 | }
|
---|
| 599 | else
|
---|
| 600 | /* bZ[WR[hªæ¾Å«È¯êÎG[ */
|
---|
| 601 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 602 | }
|
---|
| 603 |
|
---|
| 604 | static void wamp_int_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 605 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 606 | {
|
---|
| 607 | /* bZ[WR[hÌæ¾Jn */
|
---|
| 608 | if ((action == JSONSL_ACTION_PUSH)
|
---|
| 609 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 610 | s->param_handler(s, action, s->prmst, NULL);
|
---|
| 611 | /* bZ[WR[hæ¾óÔÉÚé */
|
---|
| 612 | s->state = WAMP_PARSE_STATE_PARAM;
|
---|
| 613 | }
|
---|
| 614 | else
|
---|
| 615 | /* bZ[WR[hªæ¾Å«È¯êÎG[ */
|
---|
| 616 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 617 | }
|
---|
| 618 |
|
---|
| 619 | static void wamp_string_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 620 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 621 | {
|
---|
| 622 | /* bZ[WR[hÌæ¾Jn */
|
---|
| 623 | if ((action == JSONSL_ACTION_PUSH)
|
---|
| 624 | && (state->type == JSONSL_T_STRING)) {
|
---|
| 625 | s->param_handler(s, action, s->prmst, NULL);
|
---|
| 626 | /* bZ[WR[hæ¾óÔÉÚé */
|
---|
| 627 | s->state = WAMP_PARSE_STATE_PARAM;
|
---|
| 628 | }
|
---|
| 629 | else
|
---|
| 630 | /* bZ[WR[hªæ¾Å«È¯êÎG[ */
|
---|
| 631 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 632 | }
|
---|
| 633 |
|
---|
| 634 | static void wamp_param_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 635 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 636 | {
|
---|
| 637 | /* R[h²ÆÌðÀs */
|
---|
| 638 | s->proc_handler(s, action, state, buf);
|
---|
| 639 |
|
---|
| 640 | /* WAMPbZ[WÌö¾Á½ç */
|
---|
| 641 | if ((state->level == 1) && (action == JSONSL_ACTION_POP)
|
---|
| 642 | && (state->type == JSONSL_T_LIST)) {
|
---|
| 643 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 644 | s->message_close_handler(s);
|
---|
| 645 | jsonsl_reset((jsonsl_t)s->jsn);
|
---|
| 646 | /* Ò@óÔÉÚé */
|
---|
| 647 | s->state = WAMP_PARSE_STATE_IDLE;
|
---|
| 648 | }
|
---|
| 649 | }
|
---|
| 650 |
|
---|
| 651 | static void wamp_nomore_param_parse_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 652 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 653 | {
|
---|
| 654 | /* WAMPbZ[WÌö¾Á½ç */
|
---|
| 655 | if ((state->level == 1) && (action == JSONSL_ACTION_POP)
|
---|
| 656 | && (state->type == JSONSL_T_LIST)) {
|
---|
| 657 | s->message_close_handler(s);
|
---|
| 658 | jsonsl_reset((jsonsl_t)s->jsn);
|
---|
| 659 | /* Ò@óÔÉÚé */
|
---|
| 660 | s->state = WAMP_PARSE_STATE_IDLE;
|
---|
| 661 | }
|
---|
| 662 | else
|
---|
| 663 | /* bZ[WR[hªæ¾Å«È¯êÎG[ */
|
---|
| 664 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 665 | }
|
---|
| 666 |
|
---|
| 667 | /*
|
---|
| 668 | * [HELLO, Realm|uri, Details|dict]
|
---|
| 669 | */
|
---|
| 670 | static void wamp_proc_hello_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 671 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 672 | {
|
---|
| 673 | switch (s->prmst) {
|
---|
| 674 | case WAMP_PARAM_STATE_REALM_URI:
|
---|
| 675 | if ((action == JSONSL_ACTION_POP)
|
---|
| 676 | && (state->type == JSONSL_T_STRING)) {
|
---|
| 677 | wamp_router_hello_realm(&s->router, s->jsn_buf);
|
---|
| 678 | s->prmst = WAMP_PARAM_STATE_DETAILS_DICT;
|
---|
| 679 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 680 | }
|
---|
| 681 | else
|
---|
| 682 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 683 | break;
|
---|
| 684 | case WAMP_PARAM_STATE_DETAILS_DICT:
|
---|
| 685 | if (state->level == 2) {
|
---|
| 686 | if ((action == JSONSL_ACTION_POP)
|
---|
| 687 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 688 | wamp_router_hello_details(&s->router);
|
---|
| 689 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 690 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 691 | }
|
---|
| 692 | else
|
---|
| 693 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 694 | }
|
---|
| 695 | else {
|
---|
| 696 | wamp_router_hello_details_param(&s->router, action, state, buf);
|
---|
| 697 | }
|
---|
| 698 | break;
|
---|
| 699 | default:
|
---|
| 700 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 701 | break;
|
---|
| 702 | }
|
---|
| 703 | }
|
---|
| 704 |
|
---|
| 705 | /*
|
---|
| 706 | * [WELCOME, Session|id, Details|dict]
|
---|
| 707 | */
|
---|
| 708 | static void wamp_proc_welcome_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 709 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 710 | {
|
---|
| 711 | switch (s->prmst) {
|
---|
| 712 | case WAMP_PARAM_STATE_SESSION_ID:
|
---|
| 713 | if ((action == JSONSL_ACTION_POP)
|
---|
| 714 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 715 | wamp_client_welcome_client_id(&s->client, s->jsn_buf);
|
---|
| 716 | s->prmst = WAMP_PARAM_STATE_DETAILS_DICT;
|
---|
| 717 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 718 | }
|
---|
| 719 | else
|
---|
| 720 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 721 | break;
|
---|
| 722 | case WAMP_PARAM_STATE_DETAILS_DICT:
|
---|
| 723 | if (state->level == 2) {
|
---|
| 724 | if ((action == JSONSL_ACTION_POP)
|
---|
| 725 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 726 | wamp_client_welcome_details(&s->client, s->jsn_buf);
|
---|
| 727 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 728 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 729 | }
|
---|
| 730 | else
|
---|
| 731 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 732 | }
|
---|
| 733 | else {
|
---|
| 734 | wamp_client_welcome_details_param(&s->client, action, state, buf);
|
---|
| 735 | }
|
---|
| 736 | break;
|
---|
| 737 | default:
|
---|
| 738 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 739 | break;
|
---|
| 740 | }
|
---|
| 741 | }
|
---|
| 742 |
|
---|
| 743 | /*
|
---|
| 744 | * [ABORT, Details|dict, Reason|uri]
|
---|
| 745 | */
|
---|
| 746 | static void wamp_proc_abort_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 747 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 748 | {
|
---|
| 749 | switch (s->prmst) {
|
---|
| 750 | case WAMP_PARAM_STATE_DETAILS_DICT:
|
---|
| 751 | if (state->level == 2) {
|
---|
| 752 | if ((action == JSONSL_ACTION_POP)
|
---|
| 753 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 754 | wamp_client_abort_details(&s->client, s->jsn_buf);
|
---|
| 755 | s->prmst = WAMP_PARAM_STATE_REASON_URI;
|
---|
| 756 | s->state = WAMP_PARSE_STATE_URI_PUSH;
|
---|
| 757 | }
|
---|
| 758 | else
|
---|
| 759 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 760 | }
|
---|
| 761 | else {
|
---|
| 762 | wamp_client_abort_details_param(&s->client, action, state, buf);
|
---|
| 763 | }
|
---|
| 764 | break;
|
---|
| 765 | case WAMP_PARAM_STATE_REASON_URI:
|
---|
| 766 | if ((action == JSONSL_ACTION_POP)
|
---|
| 767 | && (state->type == JSONSL_T_STRING)) {
|
---|
| 768 | wamp_client_abort_reason(&s->client, s->jsn_buf);
|
---|
| 769 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 770 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 771 | }
|
---|
| 772 | else
|
---|
| 773 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 774 | break;
|
---|
| 775 | default:
|
---|
| 776 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 777 | break;
|
---|
| 778 | }
|
---|
| 779 | }
|
---|
| 780 |
|
---|
| 781 | /*
|
---|
| 782 | * [CHALLENGE, AuthMethod|string, Extra|dict]
|
---|
| 783 | */
|
---|
| 784 | static void wamp_proc_challenge_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 785 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 786 | {
|
---|
| 787 | switch (s->prmst) {
|
---|
| 788 | case WAMP_PARAM_STATE_AUTHMETHOD_STRING:
|
---|
| 789 | if ((action == JSONSL_ACTION_POP)
|
---|
| 790 | && (state->type == JSONSL_T_STRING)) {
|
---|
| 791 | wamp_client_challenge_authmethod(&s->client, s->jsn_buf);
|
---|
| 792 | s->prmst = WAMP_PARAM_STATE_EXTRA_DICT;
|
---|
| 793 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 794 | }
|
---|
| 795 | else
|
---|
| 796 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 797 | break;
|
---|
| 798 | case WAMP_PARAM_STATE_EXTRA_DICT:
|
---|
| 799 | if (state->level == 2) {
|
---|
| 800 | if ((action == JSONSL_ACTION_POP)
|
---|
| 801 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 802 | wamp_client_challenge_extra(&s->client, s->jsn_buf);
|
---|
| 803 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 804 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 805 | }
|
---|
| 806 | else
|
---|
| 807 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 808 | }
|
---|
| 809 | else {
|
---|
| 810 | wamp_client_challenge_extra_param(&s->client, action, state, buf);
|
---|
| 811 | }
|
---|
| 812 | break;
|
---|
| 813 | default:
|
---|
| 814 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 815 | break;
|
---|
| 816 | }
|
---|
| 817 | }
|
---|
| 818 |
|
---|
| 819 | /*
|
---|
| 820 | * [AUTHENTICATE, Signature|string, Extra|dict]
|
---|
| 821 | */
|
---|
| 822 | static void wamp_proc_authenticate_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 823 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 824 | {
|
---|
| 825 | switch (s->prmst) {
|
---|
| 826 | case WAMP_PARAM_STATE_SIGNATURE_STRING:
|
---|
| 827 | if ((action == JSONSL_ACTION_POP)
|
---|
| 828 | && (state->type == JSONSL_T_STRING)) {
|
---|
| 829 | wamp_router_authenticate_signature(&s->router, s->jsn_buf);
|
---|
| 830 | s->prmst = WAMP_PARAM_STATE_EXTRA_DICT;
|
---|
| 831 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 832 | }
|
---|
| 833 | else
|
---|
| 834 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 835 | break;
|
---|
| 836 | case WAMP_PARAM_STATE_EXTRA_DICT:
|
---|
| 837 | if (state->level == 2) {
|
---|
| 838 | if ((action == JSONSL_ACTION_POP)
|
---|
| 839 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 840 | wamp_router_authenticate_extra(&s->router, s->jsn_buf);
|
---|
| 841 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 842 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 843 | }
|
---|
| 844 | else
|
---|
| 845 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 846 | }
|
---|
| 847 | else {
|
---|
| 848 | wamp_router_authenticate_extra_param(&s->router, action, state, buf);
|
---|
| 849 | }
|
---|
| 850 | break;
|
---|
| 851 | default:
|
---|
| 852 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 853 | break;
|
---|
| 854 | }
|
---|
| 855 | }
|
---|
| 856 |
|
---|
| 857 | /*
|
---|
| 858 | * [GOODBYE, Details|dict, Reason|uri]
|
---|
| 859 | */
|
---|
| 860 | static void wamp_proc_goodbye_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 861 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 862 | {
|
---|
| 863 | switch (s->prmst) {
|
---|
| 864 | case WAMP_PARAM_STATE_DETAILS_DICT:
|
---|
| 865 | if (state->level == 2) {
|
---|
| 866 | if ((action == JSONSL_ACTION_POP)
|
---|
| 867 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 868 | wamp_router_goodbye_details(&s->router);
|
---|
| 869 | s->prmst = WAMP_PARAM_STATE_REASON_URI;
|
---|
| 870 | s->state = WAMP_PARSE_STATE_URI_PUSH;
|
---|
| 871 | }
|
---|
| 872 | else
|
---|
| 873 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 874 | }
|
---|
| 875 | else {
|
---|
| 876 | wamp_router_goodbye_details_param(&s->router, action, state, buf);
|
---|
| 877 | }
|
---|
| 878 | break;
|
---|
| 879 | case WAMP_PARAM_STATE_REASON_URI:
|
---|
| 880 | if ((action == JSONSL_ACTION_POP)
|
---|
| 881 | && (state->type == JSONSL_T_STRING)) {
|
---|
| 882 | wamp_router_goodbye_reason(&s->router, s->jsn_buf);
|
---|
| 883 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 884 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 885 | }
|
---|
| 886 | else
|
---|
| 887 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 888 | break;
|
---|
| 889 | default:
|
---|
| 890 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 891 | break;
|
---|
| 892 | }
|
---|
| 893 | }
|
---|
| 894 |
|
---|
| 895 | /*
|
---|
| 896 | * [ERROR, REQUEST.Type|int, REQUEST.Request|id, Details|dict, Error|uri, Arguments|list, ArgumentsKw|dict]
|
---|
| 897 | */
|
---|
| 898 | static void wamp_proc_error_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 899 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 900 | {
|
---|
| 901 | switch (s->prmst) {
|
---|
| 902 | case WAMP_PARAM_STATE_TYPE_INT:
|
---|
| 903 | if ((action == JSONSL_ACTION_POP)
|
---|
| 904 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 905 | wamp_error_type(s, s->jsn_buf);
|
---|
| 906 | s->prmst = WAMP_PARAM_STATE_REQUEST_ID;
|
---|
| 907 | s->state = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 908 | }
|
---|
| 909 | else
|
---|
| 910 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 911 | break;
|
---|
| 912 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 913 | if ((action == JSONSL_ACTION_POP)
|
---|
| 914 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 915 | wamp_error_request_id(s, s->jsn_buf);
|
---|
| 916 | s->prmst = WAMP_PARAM_STATE_DETAILS_DICT;
|
---|
| 917 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 918 | }
|
---|
| 919 | else
|
---|
| 920 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 921 | break;
|
---|
| 922 | case WAMP_PARAM_STATE_DETAILS_DICT:
|
---|
| 923 | if (state->level == 2) {
|
---|
| 924 | if ((action == JSONSL_ACTION_POP)
|
---|
| 925 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 926 | wamp_error_details(s, s->jsn_buf);
|
---|
| 927 | s->prmst = WAMP_PARAM_STATE_ERROR_URI;
|
---|
| 928 | s->state = WAMP_PARSE_STATE_URI_PUSH;
|
---|
| 929 | }
|
---|
| 930 | else
|
---|
| 931 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 932 | }
|
---|
| 933 | else {
|
---|
| 934 | wamp_error_details_param(s, action, state, buf);
|
---|
| 935 | }
|
---|
| 936 | break;
|
---|
| 937 | case WAMP_PARAM_STATE_ERROR_URI:
|
---|
| 938 | if ((action == JSONSL_ACTION_POP)
|
---|
| 939 | && (state->type == JSONSL_T_STRING)) {
|
---|
| 940 | wamp_error_uri(s, s->jsn_buf);
|
---|
| 941 | s->prmst = WAMP_PARAM_STATE_ARGUMENTS_LIST;
|
---|
| 942 | s->state = WAMP_PARSE_STATE_LIST_PUSH;
|
---|
| 943 | }
|
---|
| 944 | else
|
---|
| 945 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 946 | break;
|
---|
| 947 | case WAMP_PARAM_STATE_ARGUMENTS_LIST:
|
---|
| 948 | if (state->level == 2) {
|
---|
| 949 | if ((action == JSONSL_ACTION_POP)
|
---|
| 950 | && (state->type == JSONSL_T_LIST)) {
|
---|
| 951 | wamp_error_arguments(s, s->jsn_buf);
|
---|
| 952 | s->prmst = WAMP_PARAM_STATE_ARGUMENTSKW_DICT;
|
---|
| 953 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 954 | }
|
---|
| 955 | else
|
---|
| 956 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 957 | }
|
---|
| 958 | else {
|
---|
| 959 | wamp_error_arguments_param(s, action, state, buf);
|
---|
| 960 | }
|
---|
| 961 | break;
|
---|
| 962 | case WAMP_PARAM_STATE_ARGUMENTSKW_DICT:
|
---|
| 963 | if (state->level == 2) {
|
---|
| 964 | if ((action == JSONSL_ACTION_POP)
|
---|
| 965 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 966 | wamp_error_argumentskw(s, s->jsn_buf);
|
---|
| 967 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 968 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 969 | }
|
---|
| 970 | else
|
---|
| 971 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 972 | }
|
---|
| 973 | else {
|
---|
| 974 | wamp_error_argumentskw_param(s, action, state, buf);
|
---|
| 975 | }
|
---|
| 976 | break;
|
---|
| 977 | default:
|
---|
| 978 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 979 | break;
|
---|
| 980 | }
|
---|
| 981 | }
|
---|
| 982 |
|
---|
| 983 | /*
|
---|
| 984 | * [PUBLISH, Request|id, Options|dict, Topic|uri, Arguments|list, ArgumentsKw|dict]
|
---|
| 985 | */
|
---|
| 986 | static void wamp_proc_publish_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 987 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 988 | {
|
---|
| 989 | switch (s->prmst) {
|
---|
| 990 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 991 | if ((action == JSONSL_ACTION_POP)
|
---|
| 992 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 993 | wamp_broker_publish_request_id(&s->broker, s->jsn_buf);
|
---|
| 994 | s->prmst = WAMP_PARAM_STATE_OPTIONS_DICT;
|
---|
| 995 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 996 | }
|
---|
| 997 | else
|
---|
| 998 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 999 | break;
|
---|
| 1000 | case WAMP_PARAM_STATE_OPTIONS_DICT:
|
---|
| 1001 | if (state->level == 2) {
|
---|
| 1002 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1003 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1004 | wamp_broker_publish_options(&s->broker, s->jsn_buf);
|
---|
| 1005 | s->prmst = WAMP_PARAM_STATE_TOPIC_URI;
|
---|
| 1006 | s->state = WAMP_PARSE_STATE_URI_PUSH;
|
---|
| 1007 | }
|
---|
| 1008 | else
|
---|
| 1009 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1010 | }
|
---|
| 1011 | else {
|
---|
| 1012 | wamp_broker_publish_options_param(&s->broker, action, state, buf);
|
---|
| 1013 | }
|
---|
| 1014 | break;
|
---|
| 1015 | case WAMP_PARAM_STATE_TOPIC_URI:
|
---|
| 1016 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1017 | && (state->type == JSONSL_T_STRING)) {
|
---|
| 1018 | wamp_broker_publish_topic(&s->broker, s->jsn_buf);
|
---|
| 1019 | s->prmst = WAMP_PARAM_STATE_ARGUMENTS_LIST;
|
---|
| 1020 | s->state = WAMP_PARSE_STATE_LIST_PUSH;
|
---|
| 1021 | }
|
---|
| 1022 | else
|
---|
| 1023 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1024 | break;
|
---|
| 1025 | case WAMP_PARAM_STATE_ARGUMENTS_LIST:
|
---|
| 1026 | if (state->level == 2) {
|
---|
| 1027 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1028 | && (state->type == JSONSL_T_LIST)) {
|
---|
| 1029 | wamp_broker_publish_arguments(&s->broker, s->jsn_buf);
|
---|
| 1030 | s->prmst = WAMP_PARAM_STATE_ARGUMENTSKW_DICT;
|
---|
| 1031 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 1032 | }
|
---|
| 1033 | else
|
---|
| 1034 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1035 | }
|
---|
| 1036 | else {
|
---|
| 1037 | wamp_broker_publish_arguments_param(&s->broker, action, state, buf);
|
---|
| 1038 | }
|
---|
| 1039 | break;
|
---|
| 1040 | case WAMP_PARAM_STATE_ARGUMENTSKW_DICT:
|
---|
| 1041 | if (state->level == 2) {
|
---|
| 1042 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1043 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1044 | wamp_broker_publish_argumentskw(&s->broker, s->jsn_buf);
|
---|
| 1045 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1046 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1047 | }
|
---|
| 1048 | else
|
---|
| 1049 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1050 | }
|
---|
| 1051 | else {
|
---|
| 1052 | wamp_broker_publish_argumentskw_param(&s->broker, action, state, buf);
|
---|
| 1053 | }
|
---|
| 1054 | break;
|
---|
| 1055 | default:
|
---|
| 1056 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1057 | break;
|
---|
| 1058 | }
|
---|
| 1059 | }
|
---|
| 1060 |
|
---|
| 1061 | /*
|
---|
| 1062 | * [PUBLISHED, PUBLISH.Request|id, Publication|id]
|
---|
| 1063 | */
|
---|
| 1064 | static void wamp_proc_published_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1065 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1066 | {
|
---|
| 1067 | switch (s->prmst) {
|
---|
| 1068 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 1069 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1070 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1071 | wamp_publisher_published_request_id(&s->publisher, s->jsn_buf);
|
---|
| 1072 | s->prmst = WAMP_PARAM_STATE_PUBLICATION_ID;
|
---|
| 1073 | s->state = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 1074 | }
|
---|
| 1075 | else
|
---|
| 1076 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1077 | break;
|
---|
| 1078 | case WAMP_PARAM_STATE_PUBLICATION_ID:
|
---|
| 1079 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1080 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1081 | wamp_publisher_published_publication_id(&s->publisher, s->jsn_buf);
|
---|
| 1082 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1083 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1084 | }
|
---|
| 1085 | else
|
---|
| 1086 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1087 | break;
|
---|
| 1088 | default:
|
---|
| 1089 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1090 | break;
|
---|
| 1091 | }
|
---|
| 1092 | }
|
---|
| 1093 |
|
---|
| 1094 | /*
|
---|
| 1095 | * [SUBSCRIBE, Request|id, Options|dict, Topic|uri]
|
---|
| 1096 | */
|
---|
| 1097 | static void wamp_proc_subscribe_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1098 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1099 | {
|
---|
| 1100 | switch (s->prmst) {
|
---|
| 1101 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 1102 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1103 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1104 | wamp_broker_subscribe_request_id(&s->broker, s->jsn_buf);
|
---|
| 1105 | s->prmst = WAMP_PARAM_STATE_OPTIONS_DICT;
|
---|
| 1106 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 1107 | }
|
---|
| 1108 | else
|
---|
| 1109 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1110 | break;
|
---|
| 1111 | case WAMP_PARAM_STATE_OPTIONS_DICT:
|
---|
| 1112 | if (state->level == 2) {
|
---|
| 1113 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1114 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1115 | wamp_broker_subscribe_options(&s->broker);
|
---|
| 1116 | s->prmst = WAMP_PARAM_STATE_TOPIC_URI;
|
---|
| 1117 | s->state = WAMP_PARSE_STATE_URI_PUSH;
|
---|
| 1118 | }
|
---|
| 1119 | else
|
---|
| 1120 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1121 | }
|
---|
| 1122 | else {
|
---|
| 1123 | wamp_broker_subscribe_options_param(&s->broker, action, state, buf);
|
---|
| 1124 | }
|
---|
| 1125 | break;
|
---|
| 1126 | case WAMP_PARAM_STATE_TOPIC_URI:
|
---|
| 1127 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1128 | && (state->type == JSONSL_T_STRING)) {
|
---|
| 1129 | wamp_broker_subscribe_topic(&s->broker, s->jsn_buf);
|
---|
| 1130 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1131 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1132 | }
|
---|
| 1133 | else
|
---|
| 1134 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1135 | break;
|
---|
| 1136 | default:
|
---|
| 1137 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1138 | break;
|
---|
| 1139 | }
|
---|
| 1140 | }
|
---|
| 1141 |
|
---|
| 1142 | /*
|
---|
| 1143 | * [SUBSCRIBED, SUBSCRIBE.Request|id, Subscription|id]
|
---|
| 1144 | */
|
---|
| 1145 | static void wamp_proc_subscribed_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1146 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1147 | {
|
---|
| 1148 | switch (s->prmst) {
|
---|
| 1149 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 1150 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1151 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1152 | wamp_subscriber_subscribed_request_id(&s->subscriber, s->jsn_buf);
|
---|
| 1153 | s->prmst = WAMP_PARAM_STATE_SUBSCRIPTION_ID;
|
---|
| 1154 | s->state = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 1155 | }
|
---|
| 1156 | else
|
---|
| 1157 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1158 | break;
|
---|
| 1159 | case WAMP_PARAM_STATE_SUBSCRIPTION_ID:
|
---|
| 1160 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1161 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1162 | wamp_subscriber_subscribed_subscription_id(&s->subscriber, s->jsn_buf);
|
---|
| 1163 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1164 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1165 | }
|
---|
| 1166 | else
|
---|
| 1167 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1168 | break;
|
---|
| 1169 | default:
|
---|
| 1170 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1171 | break;
|
---|
| 1172 | }
|
---|
| 1173 | }
|
---|
| 1174 |
|
---|
| 1175 | /*
|
---|
| 1176 | * [UNSUBSCRIBE, Request|id, SUBSCRIBED.Subscription|id]
|
---|
| 1177 | */
|
---|
| 1178 | static void wamp_proc_unsubscribe_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1179 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1180 | {
|
---|
| 1181 | switch (s->prmst) {
|
---|
| 1182 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 1183 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1184 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1185 | wamp_broker_unsubscribe_request_id(&s->broker, s->jsn_buf);
|
---|
| 1186 | s->prmst = WAMP_PARAM_STATE_SUBSCRIPTION_ID;
|
---|
| 1187 | s->state = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 1188 | }
|
---|
| 1189 | else
|
---|
| 1190 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1191 | break;
|
---|
| 1192 | case WAMP_PARAM_STATE_SUBSCRIPTION_ID:
|
---|
| 1193 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1194 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1195 | wamp_broker_unsubscribe_subscription_id(&s->broker, s->jsn_buf);
|
---|
| 1196 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1197 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1198 | }
|
---|
| 1199 | else
|
---|
| 1200 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1201 | break;
|
---|
| 1202 | default:
|
---|
| 1203 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1204 | break;
|
---|
| 1205 | }
|
---|
| 1206 | }
|
---|
| 1207 |
|
---|
| 1208 | /*
|
---|
| 1209 | * [UNSUBSCRIBED, UNSUBSCRIBE.Request|id]
|
---|
| 1210 | */
|
---|
| 1211 | static void wamp_proc_unsubscribed_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1212 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1213 | {
|
---|
| 1214 | switch (s->prmst) {
|
---|
| 1215 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 1216 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1217 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1218 | wamp_subscriber_unsubscribed_request_id(&s->subscriber, s->jsn_buf);
|
---|
| 1219 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1220 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1221 | }
|
---|
| 1222 | else
|
---|
| 1223 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1224 | break;
|
---|
| 1225 | default:
|
---|
| 1226 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1227 | break;
|
---|
| 1228 | }
|
---|
| 1229 | }
|
---|
| 1230 |
|
---|
| 1231 | /*
|
---|
| 1232 | * [EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict, PUBLISH.Arguments|list, PUBLISH.ArgumentsKw|dict]
|
---|
| 1233 | */
|
---|
| 1234 | static void wamp_proc_event_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1235 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1236 | {
|
---|
| 1237 | switch (s->prmst) {
|
---|
| 1238 | case WAMP_PARAM_STATE_SUBSCRIPTION_ID:
|
---|
| 1239 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1240 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1241 | wamp_subscriber_event_subscription_id(&s->subscriber, s->jsn_buf);
|
---|
| 1242 | s->prmst = WAMP_PARAM_STATE_PUBLICATION_ID;
|
---|
| 1243 | s->state = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 1244 | }
|
---|
| 1245 | else
|
---|
| 1246 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1247 | break;
|
---|
| 1248 | case WAMP_PARAM_STATE_PUBLICATION_ID:
|
---|
| 1249 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1250 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1251 | wamp_subscriber_event_publication_id(&s->subscriber, s->jsn_buf);
|
---|
| 1252 | s->prmst = WAMP_PARAM_STATE_DETAILS_DICT;
|
---|
| 1253 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 1254 | }
|
---|
| 1255 | else
|
---|
| 1256 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1257 | break;
|
---|
| 1258 | case WAMP_PARAM_STATE_DETAILS_DICT:
|
---|
| 1259 | if (state->level == 2) {
|
---|
| 1260 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1261 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1262 | wamp_subscriber_event_details(&s->subscriber, s->jsn_buf);
|
---|
| 1263 | s->prmst = WAMP_PARAM_STATE_ARGUMENTS_LIST;
|
---|
| 1264 | s->state = WAMP_PARSE_STATE_LIST_PUSH;
|
---|
| 1265 | }
|
---|
| 1266 | else
|
---|
| 1267 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1268 | }
|
---|
| 1269 | else {
|
---|
| 1270 | wamp_subscriber_event_details_param(&s->subscriber, action, state, buf);
|
---|
| 1271 | }
|
---|
| 1272 | break;
|
---|
| 1273 | case WAMP_PARAM_STATE_ARGUMENTS_LIST:
|
---|
| 1274 | if (state->level == 2) {
|
---|
| 1275 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1276 | && (state->type == JSONSL_T_LIST)) {
|
---|
| 1277 | wamp_subscriber_event_arguments(&s->subscriber, s->jsn_buf);
|
---|
| 1278 | s->prmst = WAMP_PARAM_STATE_ARGUMENTSKW_DICT;
|
---|
| 1279 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 1280 | }
|
---|
| 1281 | else
|
---|
| 1282 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1283 | }
|
---|
| 1284 | else {
|
---|
| 1285 | wamp_subscriber_event_arguments_param(&s->subscriber, action, state, buf);
|
---|
| 1286 | }
|
---|
| 1287 | break;
|
---|
| 1288 | case WAMP_PARAM_STATE_ARGUMENTSKW_DICT:
|
---|
| 1289 | if (state->level == 2) {
|
---|
| 1290 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1291 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1292 | wamp_subscriber_event_argumentskw(&s->subscriber, s->jsn_buf);
|
---|
| 1293 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1294 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1295 | }
|
---|
| 1296 | else
|
---|
| 1297 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1298 | }
|
---|
| 1299 | else {
|
---|
| 1300 | wamp_subscriber_event_argumentskw_param(&s->subscriber, action, state, buf);
|
---|
| 1301 | }
|
---|
| 1302 | break;
|
---|
| 1303 | default:
|
---|
| 1304 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1305 | break;
|
---|
| 1306 | }
|
---|
| 1307 | }
|
---|
| 1308 |
|
---|
| 1309 | /*
|
---|
| 1310 | * [CALL, Request|id, Options|dict, Procedure|uri, Arguments|list, ArgumentsKw|dict]
|
---|
| 1311 | */
|
---|
| 1312 | static void wamp_proc_call_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1313 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1314 | {
|
---|
| 1315 | switch (s->prmst) {
|
---|
| 1316 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 1317 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1318 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1319 | wamp_dealer_call_request_id(&s->dealer, s->jsn_buf);
|
---|
| 1320 | s->prmst = WAMP_PARAM_STATE_OPTIONS_DICT;
|
---|
| 1321 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 1322 | }
|
---|
| 1323 | else
|
---|
| 1324 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1325 | break;
|
---|
| 1326 | case WAMP_PARAM_STATE_OPTIONS_DICT:
|
---|
| 1327 | if (state->level == 2) {
|
---|
| 1328 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1329 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1330 | wamp_dealer_call_options(&s->dealer, s->jsn_buf);
|
---|
| 1331 | s->prmst = WAMP_PARAM_STATE_PROCEDURE_URI;
|
---|
| 1332 | s->state = WAMP_PARSE_STATE_URI_PUSH;
|
---|
| 1333 | }
|
---|
| 1334 | else
|
---|
| 1335 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1336 | }
|
---|
| 1337 | else {
|
---|
| 1338 | wamp_dealer_call_options_param(&s->dealer, action, state, buf);
|
---|
| 1339 | }
|
---|
| 1340 | break;
|
---|
| 1341 | case WAMP_PARAM_STATE_PROCEDURE_URI:
|
---|
| 1342 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1343 | && (state->type == JSONSL_T_STRING)) {
|
---|
| 1344 | wamp_dealer_call_procedure(&s->dealer, s->jsn_buf);
|
---|
| 1345 | s->prmst = WAMP_PARAM_STATE_ARGUMENTS_LIST;
|
---|
| 1346 | s->state = WAMP_PARSE_STATE_LIST_PUSH;
|
---|
| 1347 | }
|
---|
| 1348 | else
|
---|
| 1349 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1350 | break;
|
---|
| 1351 | case WAMP_PARAM_STATE_ARGUMENTS_LIST:
|
---|
| 1352 | if (state->level == 2) {
|
---|
| 1353 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1354 | && (state->type == JSONSL_T_LIST)) {
|
---|
| 1355 | wamp_dealer_call_arguments(&s->dealer, s->jsn_buf);
|
---|
| 1356 | s->prmst = WAMP_PARAM_STATE_ARGUMENTSKW_DICT;
|
---|
| 1357 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 1358 | }
|
---|
| 1359 | else
|
---|
| 1360 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1361 | }
|
---|
| 1362 | else {
|
---|
| 1363 | wamp_dealer_call_argumentskw_param(&s->dealer, action, state, buf);
|
---|
| 1364 | }
|
---|
| 1365 | break;
|
---|
| 1366 | case WAMP_PARAM_STATE_ARGUMENTSKW_DICT:
|
---|
| 1367 | if (state->level == 2) {
|
---|
| 1368 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1369 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1370 | wamp_dealer_call_argumentskw(&s->dealer, s->jsn_buf);
|
---|
| 1371 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1372 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1373 | }
|
---|
| 1374 | else
|
---|
| 1375 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1376 | }
|
---|
| 1377 | else {
|
---|
| 1378 | wamp_dealer_call_argumentskw_param(&s->dealer, action, state, buf);
|
---|
| 1379 | }
|
---|
| 1380 | break;
|
---|
| 1381 | default:
|
---|
| 1382 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1383 | break;
|
---|
| 1384 | }
|
---|
| 1385 | }
|
---|
| 1386 |
|
---|
| 1387 | /*
|
---|
| 1388 | * [CANCEL, CALL.Request|id, Options|dict]
|
---|
| 1389 | */
|
---|
| 1390 | static void wamp_proc_cancel_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1391 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1392 | {
|
---|
| 1393 | switch (s->prmst) {
|
---|
| 1394 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 1395 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1396 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1397 | wamp_dealer_cansel_request_id(&s->dealer, s->jsn_buf);
|
---|
| 1398 | s->prmst = WAMP_PARAM_STATE_OPTIONS_DICT;
|
---|
| 1399 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 1400 | }
|
---|
| 1401 | else
|
---|
| 1402 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1403 | break;
|
---|
| 1404 | case WAMP_PARAM_STATE_OPTIONS_DICT:
|
---|
| 1405 | if (state->level == 2) {
|
---|
| 1406 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1407 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1408 | wamp_dealer_cansel_options(&s->dealer, s->jsn_buf);
|
---|
| 1409 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1410 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1411 | }
|
---|
| 1412 | else
|
---|
| 1413 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1414 | }
|
---|
| 1415 | else {
|
---|
| 1416 | wamp_dealer_cansel_options_param(&s->dealer, action, state, buf);
|
---|
| 1417 | }
|
---|
| 1418 | break;
|
---|
| 1419 | default:
|
---|
| 1420 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1421 | break;
|
---|
| 1422 | }
|
---|
| 1423 | }
|
---|
| 1424 |
|
---|
| 1425 | /*
|
---|
| 1426 | * [RESULT, CALL.Request|id, Details|dict, YIELD.Arguments|list, YIELD.ArgumentsKw|dict]
|
---|
| 1427 | */
|
---|
| 1428 | static void wamp_proc_result_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1429 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1430 | {
|
---|
| 1431 | switch (s->prmst) {
|
---|
| 1432 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 1433 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1434 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1435 | wamp_caller_result_request_id(&s->caller, s->jsn_buf);
|
---|
| 1436 | s->prmst = WAMP_PARAM_STATE_DETAILS_DICT;
|
---|
| 1437 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 1438 | }
|
---|
| 1439 | else
|
---|
| 1440 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1441 | break;
|
---|
| 1442 | case WAMP_PARAM_STATE_DETAILS_DICT:
|
---|
| 1443 | if (state->level == 2) {
|
---|
| 1444 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1445 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1446 | wamp_caller_result_details(&s->caller, s->jsn_buf);
|
---|
| 1447 | s->prmst = WAMP_PARAM_STATE_ARGUMENTS_LIST;
|
---|
| 1448 | s->state = WAMP_PARSE_STATE_LIST_PUSH;
|
---|
| 1449 | }
|
---|
| 1450 | else
|
---|
| 1451 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1452 | }
|
---|
| 1453 | else {
|
---|
| 1454 | wamp_caller_result_details_param(&s->caller, action, state, buf);
|
---|
| 1455 | }
|
---|
| 1456 | break;
|
---|
| 1457 | case WAMP_PARAM_STATE_ARGUMENTS_LIST:
|
---|
| 1458 | if (state->level == 2) {
|
---|
| 1459 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1460 | && (state->type == JSONSL_T_LIST)) {
|
---|
| 1461 | wamp_caller_result_arguments(&s->caller, s->jsn_buf);
|
---|
| 1462 | s->prmst = WAMP_PARAM_STATE_ARGUMENTSKW_DICT;
|
---|
| 1463 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 1464 | }
|
---|
| 1465 | else
|
---|
| 1466 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1467 | }
|
---|
| 1468 | else {
|
---|
| 1469 | wamp_caller_result_arguments_param(&s->caller, action, state, buf);
|
---|
| 1470 | }
|
---|
| 1471 | break;
|
---|
| 1472 | case WAMP_PARAM_STATE_ARGUMENTSKW_DICT:
|
---|
| 1473 | if (state->level == 2) {
|
---|
| 1474 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1475 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1476 | wamp_caller_result_argumentskw(&s->caller, s->jsn_buf);
|
---|
| 1477 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1478 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1479 | }
|
---|
| 1480 | else
|
---|
| 1481 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1482 | }
|
---|
| 1483 | else {
|
---|
| 1484 | wamp_caller_result_argumentskw_param(&s->caller, action, state, buf);
|
---|
| 1485 | }
|
---|
| 1486 | break;
|
---|
| 1487 | default:
|
---|
| 1488 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1489 | break;
|
---|
| 1490 | }
|
---|
| 1491 | }
|
---|
| 1492 |
|
---|
| 1493 | /*
|
---|
| 1494 | * [REGISTER, Request|id, Options|dict, Procedure|uri]
|
---|
| 1495 | */
|
---|
| 1496 | static void wamp_proc_register_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1497 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1498 | {
|
---|
| 1499 | switch (s->prmst) {
|
---|
| 1500 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 1501 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1502 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1503 | wamp_dealer_register_request_id(&s->dealer, s->jsn_buf);
|
---|
| 1504 | s->prmst = WAMP_PARAM_STATE_OPTIONS_DICT;
|
---|
| 1505 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 1506 | }
|
---|
| 1507 | else
|
---|
| 1508 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1509 | break;
|
---|
| 1510 | case WAMP_PARAM_STATE_OPTIONS_DICT:
|
---|
| 1511 | if (state->level == 2) {
|
---|
| 1512 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1513 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1514 | wamp_dealer_register_options(&s->dealer, s->jsn_buf);
|
---|
| 1515 | s->prmst = WAMP_PARAM_STATE_PROCEDURE_URI;
|
---|
| 1516 | s->state = WAMP_PARSE_STATE_URI_PUSH;
|
---|
| 1517 | }
|
---|
| 1518 | else
|
---|
| 1519 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1520 | }
|
---|
| 1521 | else {
|
---|
| 1522 | wamp_dealer_register_options_param(&s->dealer, action, state, buf);
|
---|
| 1523 | }
|
---|
| 1524 | break;
|
---|
| 1525 | case WAMP_PARAM_STATE_PROCEDURE_URI:
|
---|
| 1526 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1527 | && (state->type == JSONSL_T_STRING)) {
|
---|
| 1528 | wamp_dealer_register_procedure(&s->dealer, s->jsn_buf);
|
---|
| 1529 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1530 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1531 | }
|
---|
| 1532 | else
|
---|
| 1533 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1534 | break;
|
---|
| 1535 | default:
|
---|
| 1536 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1537 | break;
|
---|
| 1538 | }
|
---|
| 1539 | }
|
---|
| 1540 |
|
---|
| 1541 | /*
|
---|
| 1542 | * [REGISTERED, REGISTER.Request|id, Registration|id]
|
---|
| 1543 | */
|
---|
| 1544 | static void wamp_proc_registered_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1545 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1546 | {
|
---|
| 1547 | switch (s->prmst) {
|
---|
| 1548 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 1549 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1550 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1551 | wamp_callee_registered_request_id(&s->callee, s->jsn_buf);
|
---|
| 1552 | s->prmst = WAMP_PARAM_STATE_REGISTRATION_ID;
|
---|
| 1553 | s->state = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 1554 | }
|
---|
| 1555 | else
|
---|
| 1556 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1557 | break;
|
---|
| 1558 | case WAMP_PARAM_STATE_REGISTRATION_ID:
|
---|
| 1559 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1560 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1561 | wamp_callee_registered_registration_id(&s->callee, s->jsn_buf);
|
---|
| 1562 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1563 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1564 | }
|
---|
| 1565 | else
|
---|
| 1566 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1567 | break;
|
---|
| 1568 | default:
|
---|
| 1569 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1570 | break;
|
---|
| 1571 | }
|
---|
| 1572 | }
|
---|
| 1573 |
|
---|
| 1574 | /*
|
---|
| 1575 | * [UNREGISTER, Request|id, REGISTERED.Registration|id]
|
---|
| 1576 | */
|
---|
| 1577 | static void wamp_proc_unregister_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1578 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1579 | {
|
---|
| 1580 | switch (s->prmst) {
|
---|
| 1581 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 1582 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1583 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1584 | wamp_dealer_unregister_request_id(&s->dealer, s->jsn_buf);
|
---|
| 1585 | s->prmst = WAMP_PARAM_STATE_REGISTRATION_ID;
|
---|
| 1586 | s->state = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 1587 | }
|
---|
| 1588 | else
|
---|
| 1589 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1590 | break;
|
---|
| 1591 | case WAMP_PARAM_STATE_REGISTRATION_ID:
|
---|
| 1592 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1593 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1594 | wamp_dealer_unregister_registration_id(&s->dealer, s->jsn_buf);
|
---|
| 1595 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1596 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1597 | }
|
---|
| 1598 | else
|
---|
| 1599 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1600 | break;
|
---|
| 1601 | default:
|
---|
| 1602 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1603 | break;
|
---|
| 1604 | }
|
---|
| 1605 | }
|
---|
| 1606 |
|
---|
| 1607 | /*
|
---|
| 1608 | * [UNREGISTERED, UNREGISTER.Request|id]
|
---|
| 1609 | */
|
---|
| 1610 | static void wamp_proc_unregistered_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1611 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1612 | {
|
---|
| 1613 | switch (s->prmst) {
|
---|
| 1614 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 1615 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1616 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1617 | wamp_callee_unregistered_request_id(&s->callee, s->jsn_buf);
|
---|
| 1618 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1619 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1620 | }
|
---|
| 1621 | else
|
---|
| 1622 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1623 | break;
|
---|
| 1624 | default:
|
---|
| 1625 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1626 | break;
|
---|
| 1627 | }
|
---|
| 1628 | }
|
---|
| 1629 |
|
---|
| 1630 | /*
|
---|
| 1631 | * [INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict, CALL.Arguments|list, CALL.ArgumentsKw|dict]
|
---|
| 1632 | */
|
---|
| 1633 | static void wamp_proc_invocation_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1634 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1635 | {
|
---|
| 1636 | switch (s->prmst) {
|
---|
| 1637 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 1638 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1639 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1640 | wamp_callee_invocation_request_id(&s->callee, s->jsn_buf);
|
---|
| 1641 | s->prmst = WAMP_PARAM_STATE_REGISTRATION_ID;
|
---|
| 1642 | s->state = WAMP_PARSE_STATE_ID_PUSH;
|
---|
| 1643 | }
|
---|
| 1644 | else
|
---|
| 1645 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1646 | break;
|
---|
| 1647 | case WAMP_PARAM_STATE_REGISTRATION_ID:
|
---|
| 1648 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1649 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1650 | wamp_callee_invocation_registration_id(&s->callee, s->jsn_buf);
|
---|
| 1651 | s->prmst = WAMP_PARAM_STATE_DETAILS_DICT;
|
---|
| 1652 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 1653 | }
|
---|
| 1654 | else
|
---|
| 1655 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1656 | break;
|
---|
| 1657 | case WAMP_PARAM_STATE_DETAILS_DICT:
|
---|
| 1658 | if (state->level == 2) {
|
---|
| 1659 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1660 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1661 | wamp_callee_invocation_details(&s->callee, s->jsn_buf);
|
---|
| 1662 | s->prmst = WAMP_PARAM_STATE_ARGUMENTS_LIST;
|
---|
| 1663 | s->state = WAMP_PARSE_STATE_LIST_PUSH;
|
---|
| 1664 | }
|
---|
| 1665 | else
|
---|
| 1666 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1667 | }
|
---|
| 1668 | else {
|
---|
| 1669 | wamp_callee_invocation_details_param(&s->callee, action, state, buf);
|
---|
| 1670 | }
|
---|
| 1671 | break;
|
---|
| 1672 | case WAMP_PARAM_STATE_ARGUMENTS_LIST:
|
---|
| 1673 | if (state->level == 2) {
|
---|
| 1674 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1675 | && (state->type == JSONSL_T_LIST)) {
|
---|
| 1676 | wamp_callee_invocation_arguments(&s->callee, s->jsn_buf);
|
---|
| 1677 | s->prmst = WAMP_PARAM_STATE_ARGUMENTSKW_DICT;
|
---|
| 1678 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 1679 | }
|
---|
| 1680 | else
|
---|
| 1681 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1682 | }
|
---|
| 1683 | else {
|
---|
| 1684 | wamp_callee_invocation_arguments_param(&s->callee, action, state, buf);
|
---|
| 1685 | }
|
---|
| 1686 | break;
|
---|
| 1687 | case WAMP_PARAM_STATE_ARGUMENTSKW_DICT:
|
---|
| 1688 | if (state->level == 2) {
|
---|
| 1689 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1690 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1691 | wamp_callee_invocation_argumentskw(&s->callee, s->jsn_buf);
|
---|
| 1692 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1693 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1694 | }
|
---|
| 1695 | else
|
---|
| 1696 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1697 | }
|
---|
| 1698 | else {
|
---|
| 1699 | wamp_callee_invocation_argumentskw_param(&s->callee, action, state, buf);
|
---|
| 1700 | }
|
---|
| 1701 | break;
|
---|
| 1702 | default:
|
---|
| 1703 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1704 | break;
|
---|
| 1705 | }
|
---|
| 1706 | }
|
---|
| 1707 |
|
---|
| 1708 | /*
|
---|
| 1709 | * [INTERRUPT, INVOCATION.Request|id, Options|dict]
|
---|
| 1710 | */
|
---|
| 1711 | static void wamp_proc_interrupt_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1712 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1713 | {
|
---|
| 1714 | switch (s->prmst) {
|
---|
| 1715 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 1716 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1717 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1718 | wamp_callee_interrupt_request_id(&s->callee, s->jsn_buf);
|
---|
| 1719 | s->prmst = WAMP_PARAM_STATE_OPTIONS_DICT;
|
---|
| 1720 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 1721 | }
|
---|
| 1722 | else
|
---|
| 1723 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1724 | break;
|
---|
| 1725 | case WAMP_PARAM_STATE_OPTIONS_DICT:
|
---|
| 1726 | if (state->level == 2) {
|
---|
| 1727 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1728 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1729 | wamp_callee_interrupt_options(&s->callee, s->jsn_buf);
|
---|
| 1730 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1731 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1732 | }
|
---|
| 1733 | else
|
---|
| 1734 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1735 | }
|
---|
| 1736 | else {
|
---|
| 1737 | wamp_callee_interrupt_options_param(&s->callee, action, state, buf);
|
---|
| 1738 | }
|
---|
| 1739 | break;
|
---|
| 1740 | default:
|
---|
| 1741 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1742 | break;
|
---|
| 1743 | }
|
---|
| 1744 | }
|
---|
| 1745 |
|
---|
| 1746 | /*
|
---|
| 1747 | * [YIELD, INVOCATION.Request|id, Options|dict, Arguments|list, ArgumentsKw|dict]
|
---|
| 1748 | */
|
---|
| 1749 | static void wamp_proc_yield_state(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1750 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1751 | {
|
---|
| 1752 | switch (s->prmst) {
|
---|
| 1753 | case WAMP_PARAM_STATE_REQUEST_ID:
|
---|
| 1754 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1755 | && (state->type == JSONSL_T_SPECIAL)) {
|
---|
| 1756 | wamp_dealer_yield_request_id(&s->dealer, s->jsn_buf);
|
---|
| 1757 | s->prmst = WAMP_PARAM_STATE_OPTIONS_DICT;
|
---|
| 1758 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 1759 | }
|
---|
| 1760 | else
|
---|
| 1761 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1762 | break;
|
---|
| 1763 | case WAMP_PARAM_STATE_OPTIONS_DICT:
|
---|
| 1764 | if (state->level == 2) {
|
---|
| 1765 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1766 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1767 | wamp_dealer_yield_options(&s->dealer, s->jsn_buf);
|
---|
| 1768 | s->prmst = WAMP_PARAM_STATE_ARGUMENTS_LIST;
|
---|
| 1769 | s->state = WAMP_PARSE_STATE_LIST_PUSH;
|
---|
| 1770 | }
|
---|
| 1771 | else
|
---|
| 1772 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1773 | }
|
---|
| 1774 | else {
|
---|
| 1775 | wamp_dealer_yield_options_param(&s->dealer, action, state, buf);
|
---|
| 1776 | }
|
---|
| 1777 | break;
|
---|
| 1778 | case WAMP_PARAM_STATE_ARGUMENTS_LIST:
|
---|
| 1779 | if (state->level == 2) {
|
---|
| 1780 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1781 | && (state->type == JSONSL_T_LIST)) {
|
---|
| 1782 | wamp_dealer_yield_arguments(&s->dealer, s->jsn_buf);
|
---|
| 1783 | s->prmst = WAMP_PARAM_STATE_ARGUMENTSKW_DICT;
|
---|
| 1784 | s->state = WAMP_PARSE_STATE_DICT_PUSH;
|
---|
| 1785 | }
|
---|
| 1786 | else
|
---|
| 1787 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1788 | }
|
---|
| 1789 | else {
|
---|
| 1790 | wamp_dealer_yield_arguments_param(&s->dealer, action, state, buf);
|
---|
| 1791 | }
|
---|
| 1792 | break;
|
---|
| 1793 | case WAMP_PARAM_STATE_ARGUMENTSKW_DICT:
|
---|
| 1794 | if (state->level == 2) {
|
---|
| 1795 | if ((action == JSONSL_ACTION_POP)
|
---|
| 1796 | && (state->type == JSONSL_T_OBJECT)) {
|
---|
| 1797 | wamp_dealer_yield_argumentskw(&s->dealer, s->jsn_buf);
|
---|
| 1798 | s->prmst = WAMP_PARAM_STATE_NONE;
|
---|
| 1799 | s->state = WAMP_PARSE_STATE_NOMORE_PARAM;
|
---|
| 1800 | }
|
---|
| 1801 | else
|
---|
| 1802 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1803 | }
|
---|
| 1804 | else {
|
---|
| 1805 | wamp_dealer_yield_argumentskw_param(&s->dealer, action, state, buf);
|
---|
| 1806 | }
|
---|
| 1807 | break;
|
---|
| 1808 | default:
|
---|
| 1809 | s->state = WAMP_PARSE_STATE_ERROR;
|
---|
| 1810 | break;
|
---|
| 1811 | }
|
---|
| 1812 | }
|
---|
| 1813 |
|
---|
| 1814 | void wamp_error(wamp_state_t *s)
|
---|
| 1815 | {
|
---|
| 1816 | }
|
---|
| 1817 |
|
---|
| 1818 | void wamp_error_type(wamp_state_t *s, const char *value)
|
---|
| 1819 | {
|
---|
| 1820 | }
|
---|
| 1821 |
|
---|
| 1822 | void wamp_error_request_id(wamp_state_t *s, const char *value)
|
---|
| 1823 | {
|
---|
| 1824 | }
|
---|
| 1825 |
|
---|
| 1826 | void wamp_error_details(wamp_state_t *s, const char *value)
|
---|
| 1827 | {
|
---|
| 1828 | }
|
---|
| 1829 |
|
---|
| 1830 | void wamp_error_details_param(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1831 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1832 | {
|
---|
| 1833 | }
|
---|
| 1834 |
|
---|
| 1835 | void wamp_error_uri(wamp_state_t *s, const char *value)
|
---|
| 1836 | {
|
---|
| 1837 | }
|
---|
| 1838 |
|
---|
| 1839 | void wamp_error_arguments(wamp_state_t *s, const char *value)
|
---|
| 1840 | {
|
---|
| 1841 | }
|
---|
| 1842 |
|
---|
| 1843 | void wamp_error_arguments_param(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1844 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1845 | {
|
---|
| 1846 | }
|
---|
| 1847 |
|
---|
| 1848 | void wamp_error_argumentskw(wamp_state_t *s, const char *value)
|
---|
| 1849 | {
|
---|
| 1850 | }
|
---|
| 1851 |
|
---|
| 1852 | void wamp_error_argumentskw_param(wamp_state_t *s, jsonsl_action_t action,
|
---|
| 1853 | struct jsonsl_state_st *state, const char *buf)
|
---|
| 1854 | {
|
---|
| 1855 | }
|
---|
| 1856 |
|
---|
| 1857 | static void wamp_error_close(wamp_state_t *s)
|
---|
| 1858 | {
|
---|
| 1859 | }
|
---|
| 1860 |
|
---|
| 1861 | static void wamp_param_handler(struct wamp_state *s, jsonsl_action_t action,
|
---|
| 1862 | wamp_param_state_t param, const char *value)
|
---|
| 1863 | {
|
---|
| 1864 | }
|
---|
| 1865 |
|
---|
| 1866 | ER wamp_send_error_res(struct wamp_state *s, wamp_code_t code, int requestId, const char *error)
|
---|
| 1867 | {
|
---|
| 1868 | ECN_FBS_ID buf;
|
---|
| 1869 | ECN_FBS_SSIZE_T pos = 0;
|
---|
| 1870 | ER ret;
|
---|
| 1871 |
|
---|
| 1872 | ret = _ecn_fbs_cre(1, &buf);
|
---|
| 1873 | if (ret != E_OK) {
|
---|
| 1874 | syslog(LOG_WARNING, "_ecn_fbs_cre() result = %d", ret);
|
---|
| 1875 | return ret;
|
---|
| 1876 | }
|
---|
| 1877 |
|
---|
| 1878 | ret = fbs_printf(buf, &pos, "[8,%d,%d,{},\"%s\"]", (int)code, requestId, error);
|
---|
| 1879 | if (ret != E_OK) {
|
---|
| 1880 | syslog(LOG_WARNING, "fbs_printf() result = %d", ret);
|
---|
| 1881 | _ecn_fbs_del(buf);
|
---|
| 1882 | return ret;
|
---|
| 1883 | }
|
---|
| 1884 |
|
---|
| 1885 | return main_send_message(buf, s->wbsid);
|
---|
| 1886 | }
|
---|