amiws 2.2.1
|
AMI/web-socket functions. More...
#include "amiws.h"
Functions | |
void | amiws_init (struct amiws_config *conf) |
void | amiws_connect_ami_server (struct amiws_conn *conn) |
void | amiws_destroy () |
void | amiws_loop () |
void | ami_ev_handler (struct mg_connection *nc, int ev, void *ev_data) |
char * | amipack_to_json (const char *ami_pack_str, int len, struct amiws_conn *conn) |
void | websock_send (struct mg_connection *nc, const char *json) |
void | websock_ev_handler (struct mg_connection *nc, int ev, void *ev_data) |
void | ami_login (struct mg_connection *nc, struct amiws_conn *conn) |
int | scan_amipack (const char *p, size_t len) |
Variables | |
struct mg_connection * | nc_ws |
AMI/web-socket functions.
amiws – Library with functions for read/create AMI packets Copyright (C) 2017, Stas Kobzar stask.nosp@m.obza.nosp@m.r@mod.nosp@m.ulis.nosp@m..ca
This file is part of amiws.
amiws is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
amiws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with amiws. If not, see http://www.gnu.org/licenses/.
void ami_ev_handler | ( | struct mg_connection * | nc, |
int | ev, | ||
void * | ev_data ) |
Callback function for AMI connections.
nc | Connection structure. |
ev | Event ID |
ev_data | Additional data passed |
void ami_login | ( | struct mg_connection * | nc, |
struct amiws_conn * | conn ) |
Login to AMI server. Send loging Action.
nc | Connection structure. |
conn | AMI connection. |
char * amipack_to_json | ( | const char * | buf, |
int | len, | ||
struct amiws_conn * | conn ) |
Convert AMI packet to JSON string.
buf | AMI packet stream as received from connection |
len | Buffer size |
conn | AMI connection. |
void amiws_connect_ami_server | ( | struct amiws_conn * | conn | ) |
Connect to AMI server.
conn | Connection configuration structure. |
void amiws_destroy | ( | ) |
Destroy connections and free memory.
void amiws_init | ( | struct amiws_config * | conf | ) |
Initialize amiws with given configuration. Will start listening for HTTP and WebSocket and connects to AMI servers.
conf | Configuration structure. |
void amiws_loop | ( | ) |
Main amiws loop step.
int scan_amipack | ( | const char * | pack, |
size_t | len ) |
Scan stream and extract AMI packet separated with CRLF CRLF token. TCP connection is feeding packets as stream and this function will get complete packet.
pack | Char stream received from server. |
len | Stream length |
void websock_ev_handler | ( | struct mg_connection * | nc, |
int | ev, | ||
void * | ev_data ) |
Callback function for HTTP and WebSocket connections.
nc | Connection structure. |
ev | Event ID |
ev_data | Additional data passed |
void websock_send | ( | struct mg_connection * | nc, |
const char * | json ) |
Send JSON string to WebSocket.
nc | Connection structure. |
json | JSON string. |