ngx_int_t memstore_ipc_send_publish_status(ngx_int_t dst, ngx_str_t *chid, ngx_int_t status_code, const ngx_str_t *status_line, callback_pt callback, void *privdata) { DBG("IPC: send publish status to %i ch %V", dst, chid); publish_status_data_t data = {str_shm_copy(chid), status_code, status_line, callback, privdata}; if(data.shm_chid == NULL) { return NGX_DECLINED; } return ipc_cmd(publish_status, dst, &data); }
ngx_int_t memstore_ipc_send_delete(ngx_int_t dst, ngx_str_t *chid, callback_pt callback,void *privdata) { delete_data_t data = {str_shm_copy(chid), 0, NULL, 0, callback, privdata}; if(data.shm_chid == NULL) { return NGX_ERROR; } DBG("IPC: send delete to %i ch %V", dst, chid); return ipc_cmd(delete, dst, &data); }
ngx_int_t memstore_ipc_send_delete(ngx_int_t dst, ngx_str_t *chid, callback_pt callback,void *privdata) { delete_data_t data = {str_shm_copy(chid), 0, NULL, 0, callback, privdata}; if(data.shm_chid == NULL) { return NGX_ERROR; } DBG("IPC: send delete to %i ch %V", dst, chid); return ipc_alert(nchan_memstore_get_ipc(), dst, IPC_DELETE, &data, sizeof(data)); }
ngx_int_t memstore_ipc_send_publish_status(ngx_int_t dst, ngx_str_t *chid, ngx_int_t status_code, const ngx_str_t *status_line, callback_pt callback, void *privdata) { DBG("IPC: send publish status to %i ch %V", dst, chid); publish_status_data_t data = {str_shm_copy(chid), status_code, status_line, callback, privdata}; if(data.shm_chid == NULL) { return NGX_DECLINED; } return ipc_alert(nchan_memstore_get_ipc(), dst, IPC_PUBLISH_STATUS, &data, sizeof(data)); }
ngx_int_t memstore_ipc_send_get_group(ngx_int_t dst, ngx_str_t *group_id) { ngx_str_t *shm_id = str_shm_copy(group_id); if(shm_id == NULL) { return NGX_ERROR; } DBG("send GET GROUP to %i %p %V", dst, shm_id, shm_id); ipc_cmd(get_group, dst, &shm_id); return NGX_OK; }
ngx_int_t memstore_ipc_send_memstore_subscriber_keepalive(ngx_int_t dst, ngx_str_t *chid, subscriber_t *sub, memstore_channel_head_t *ch, callback_pt callback, void *privdata) { sub_keepalive_data_t data = {str_shm_copy(chid), sub, ch, 0, callback, privdata}; if(data.shm_chid == NULL) { return NGX_ERROR; } DBG("send SUBSCRIBER KEEPALIVE to %i %V", dst, chid); ipc_cmd(subscriber_keepalive, dst, &data); return NGX_OK; }
ngx_int_t memstore_ipc_send_unsubscribed(ngx_int_t dst, ngx_str_t *chid, void* privdata) { DBG("send unsubscribed to %i %V", dst, chid); unsubscribed_data_t data = {str_shm_copy(chid), privdata}; if(data.shm_chid == NULL) { ERR("Out of shared memory, can't send IPC unsubscribe alert"); return NGX_DECLINED; } return ipc_cmd(unsubscribed, dst, &data); }
ngx_int_t memstore_ipc_send_unsubscribed(ngx_int_t dst, ngx_str_t *chid, void* privdata) { DBG("send unsubscribed to %i %V", dst, chid); unsubscribed_data_t data = {str_shm_copy(chid), privdata}; if(data.shm_chid == NULL) { ERR("Out of shared memory, can't send IPC unsubscribe alert"); return NGX_DECLINED; } return ipc_alert(nchan_memstore_get_ipc(), dst, IPC_UNSUBSCRIBED, &data, sizeof(data)); }
ngx_int_t memstore_ipc_send_get_message(ngx_int_t dst, ngx_str_t *chid, nchan_msg_id_t *msgid, void *privdata) { getmessage_data_t data; if((data.shm_chid= str_shm_copy(chid)) == NULL) { return NGX_ERROR; } data.privdata = privdata; data.d.req.msgid = *msgid; DBG("IPC: send get message from %i ch %V", dst, chid); assert(data.shm_chid->len>1); return ipc_cmd(get_message, dst, &data); }
ngx_int_t memstore_ipc_send_get_channel_info(ngx_int_t dst, ngx_str_t *chid, callback_pt callback, void* privdata) { DBG("send get_channel_info to %i %V", dst, chid); channel_info_data_t data; DEBUG_MEMZERO(&data); if((data.shm_chid = str_shm_copy(chid)) == NULL) { return NGX_ERROR; } data.channel_info = NULL; data.last_msgid = zero_msgid; data.callback = callback; data.privdata = privdata; return ipc_alert(nchan_memstore_get_ipc(), dst, IPC_GET_CHANNEL_INFO, &data, sizeof(data)); }
ngx_int_t memstore_ipc_send_channel_existence_check(ngx_int_t dst, ngx_str_t *chid, nchan_loc_conf_t *cf, callback_pt callback, void* privdata) { DBG("send channel_auth_check to %i %V", dst, chid); channel_authcheck_data_t data; if((data.shm_chid = str_shm_copy(chid)) == NULL) { return NGX_ERROR; } data.auth_ok = 0; data.channel_must_exist = cf->subscribe_only_existing_channel; data.cf = cf; data.max_subscribers = cf->max_channel_subscribers; data.callback = callback; data.privdata = privdata; return ipc_cmd(channel_auth_check, dst, &data); }
ngx_int_t memstore_ipc_send_get_channel_info(ngx_int_t dst, ngx_str_t *chid, nchan_loc_conf_t *cf, callback_pt callback, void* privdata) { DBG("send get_channel_info to %i %V", dst, chid); channel_info_data_t data; DEBUG_MEMZERO(&data); if((data.shm_chid = str_shm_copy(chid)) == NULL) { return NGX_ERROR; } data.channel_info = NULL; data.last_msgid = zero_msgid; data.cf = cf; data.callback = callback; data.privdata = privdata; return ipc_cmd(get_channel_info, dst, &data); }
ngx_int_t memstore_ipc_send_channel_auth_check(ngx_int_t dst, ngx_str_t *chid, nchan_loc_conf_t *cf, callback_pt callback, void* privdata) { DBG("send channel_auth_check to %i %V", dst, chid); channel_authcheck_data_t data; if((data.shm_chid = str_shm_copy(chid)) == NULL) { return NGX_ERROR; } data.auth_ok = 0; data.channel_must_exist = cf->subscribe_only_existing_channel; data.cf = cf; data.max_subscribers = cf->max_channel_subscribers; data.callback = callback; data.privdata = privdata; return ipc_alert(nchan_memstore_get_ipc(), dst, IPC_GET_CHANNEL_AUTHCHECK, &data, sizeof(data)); }
ngx_int_t memstore_ipc_send_subscribe(ngx_int_t dst, ngx_str_t *chid, memstore_channel_head_t *origin_chanhead, nchan_loc_conf_t *cf) { DBG("send subscribe to %i, %V", dst, chid); subscribe_data_t data; DEBUG_MEMZERO(&data); if((data.shm_chid = str_shm_copy(chid)) == NULL) { ERR("Out of shared memory, can't send IPC subscrive alert"); return NGX_DECLINED; } data.shared_channel_data = NULL; data.d.origin_chanhead = origin_chanhead; data.cf = cf; return ipc_cmd(subscribe, dst, &data); }
ngx_int_t memstore_ipc_send_publish_message(ngx_int_t dst, ngx_str_t *chid, nchan_msg_t *shm_msg, nchan_loc_conf_t *cf, callback_pt callback, void *privdata) { publish_data_t data; DEBUG_MEMZERO(&data); DBG("IPC: send publish message to %i ch %V", dst, chid); assert(shm_msg->shared == 1); assert(shm_msg->temp_allocd == 0); assert(chid->data != NULL); data.shm_chid = str_shm_copy(chid); if(data.shm_chid == NULL) { return NGX_DECLINED; } data.shm_msg = shm_msg; data.cf = cf; data.callback = callback; data.callback_privdata = privdata; assert(data.shm_chid->data != NULL); assert(msg_reserve(shm_msg, "publish_message") == NGX_OK); return ipc_cmd(publish_message, dst, &data); }