31#include "../res/res_aeap/transport.h"
33#define CATEGORY "/res/aeap/transport/"
35#define ADDR "127.0.0.1:8088"
36#define TRANSPORT_URL "ws://" ADDR "/ws"
37#define TRANSPORT_URL_INVALID "ws://" ADDR "/invalid"
38#define TRANSPORT_PROTOCOL "echo"
39#define TRANSPORT_PROTOCOL_INVALID "invalid"
40#define TRANSPORT_TIMEOUT 2000
48 info->name = __func__;
49 info->explicit_only = 0;
51 info->summary =
"test creating an AEAP invalid transport type";
70 info->name = __func__;
71 info->explicit_only = 0;
73 info->summary =
"test creating an AEAP transport";
92 info->name = __func__;
93 info->explicit_only = 0;
95 info->summary =
"test connecting to an AEAP transport";
119 info->name = __func__;
120 info->explicit_only = 0;
122 info->summary =
"test connecting failure for an AEAP transport";
158 info->name = __func__;
159 info->explicit_only = 0;
161 info->summary =
"test binary I/O from an AEAP transport";
174 sizeof(num), &rtype) ==
sizeof(num));
176 ast_test_validate(
test, num == 38);
189 info->name = __func__;
190 info->explicit_only = 0;
192 info->summary =
"test string I/O from an AEAP transport";
205 sizeof(
buf) /
sizeof(
char), &rtype) == 11);
207 ast_test_validate(
test, !strcmp(
buf,
"foo bar baz"));
216 if (!(
http_server = ast_http_test_server_get(
"aeap transport http server",
NULL))) {
248 .
requires =
"res_aeap",
Asterisk main include file. File version handling, generic pbx functions.
Support for Private Asterisk HTTP Servers.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
AST_AEAP_DATA_TYPE
Supported Asterisk external application data types.
@ AST_AEAP_DATA_TYPE_BINARY
@ AST_AEAP_DATA_TYPE_STRING
static int transport_create(void *data)
Create a pjsip transport.
Asterisk external application transport structure to be "derived" by specific transport implementatio...
#define AST_TEST_REGISTER(cb)
#define AST_TEST_UNREGISTER(cb)
#define TRANSPORT_PROTOCOL_INVALID
static int load_module(void)
#define TRANSPORT_URL_INVALID
#define TRANSPORT_TIMEOUT
static int unload_module(void)
AST_TEST_DEFINE(transport_create_invalid)
static struct ast_http_server * http_server
#define TRANSPORT_PROTOCOL
intmax_t aeap_transport_write(struct aeap_transport *transport, const void *buf, intmax_t size, enum AST_AEAP_DATA_TYPE wtype)
Write data to the transport.
int aeap_transport_connect(struct aeap_transport *transport, const char *url, const char *protocol, int timeout)
Connect a transport.
void aeap_transport_destroy(struct aeap_transport *transport)
Destroy a transport.
intmax_t aeap_transport_read(struct aeap_transport *transport, void *buf, intmax_t size, enum AST_AEAP_DATA_TYPE *rtype)
Read data from the transport.
int aeap_transport_is_connected(struct aeap_transport *transport)
Whether or not the transport is in a connected state.
struct aeap_transport * aeap_transport_create(const char *type)
Create an Asterisk external application transport.
struct aeap_transport * aeap_transport_create_and_connect(const char *type, const char *url, const char *protocol, int timeout)
Create an Asterisk external application transport, and connect it.
int aeap_transport_disconnect(struct aeap_transport *transport)
Disconnect a transport.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.