#include <sys/time.h>
#include <sys/resource.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <inttypes.h>
#include <limits.h>
#include <unistd.h>
#include <fcntl.h>
#include <cmocka.h>
#include <amxc/amxc_macros.h>
#include <amxc/amxc.h>
#include <amxp/amxp_signal.h>
#include <amxp/amxp_slot.h>
#include <amxp/amxp_connection.h>
#include "test_connection.h"
Go to the source code of this file.
|
static int | fds [2] |
|
static char * | el_data = "Some Data" |
|
◆ connection_check_signal()
static void connection_check_signal |
( |
const char *const |
sig_name, |
|
|
const amxc_var_t *const |
data, |
|
|
UNUSED void *const |
priv |
|
) |
| |
|
static |
Definition at line 88 of file test_connection.c.
91 uint32_t data_type = amxc_var_type_of(data);
92 uint32_t data_value = GET_UINT32(data, NULL);
94 check_expected(sig_name);
95 check_expected(data_type);
96 check_expected(data_value);
◆ reader()
◆ test_can_add_connection()
void test_can_add_connection |
( |
UNUSED void ** |
state | ) |
|
Definition at line 121 of file test_connection.c.
#define AMXP_CONNECTION_CUSTOM
int amxp_connection_add(int fd, amxp_fd_cb_t reader, const char *uri, uint32_t type, void *priv)
Adds a file descriptor (fd) to the list of fds that must be watched.
amxc_llist_t * amxp_connection_get_listeners(void)
Get of the current listen sockets of the application.
amxc_llist_t * amxp_connection_get_connections(void)
Get a list of the current connections of the application.
static void reader(UNUSED int fd, UNUSED void *priv)
static void connection_check_signal(const char *const sig_name, const amxc_var_t *const data, UNUSED void *const priv)
◆ test_can_add_listener()
void test_can_add_listener |
( |
UNUSED void ** |
state | ) |
|
◆ test_can_add_wait_write_connection()
void test_can_add_wait_write_connection |
( |
UNUSED void ** |
state | ) |
|
Definition at line 141 of file test_connection.c.
int amxp_connection_wait_write(int fd, amxp_fd_cb_t can_write_cb)
Adds a watcher to check if a fd is ready for write.
static void writer(UNUSED int fd, UNUSED void *priv)
◆ test_can_fetch_connection()
void test_can_fetch_connection |
( |
UNUSED void ** |
state | ) |
|
Definition at line 131 of file test_connection.c.
134 assert_non_null(con);
135 assert_int_equal(con->
fd,
fds[0]);
137 assert_string_equal(con->
uri,
"test://localhost:1700");
amxp_connection_t * amxp_connection_get(int fd)
Gets the connection data for a file descriptor.
◆ test_can_fetch_listener()
void test_can_fetch_listener |
( |
UNUSED void ** |
state | ) |
|
Definition at line 213 of file test_connection.c.
216 assert_non_null(con);
217 assert_int_equal(con->
fd,
fds[0]);
219 assert_string_equal(con->
uri,
"test://localhost:1700");
◆ test_can_iterate_connections()
void test_can_iterate_connections |
( |
UNUSED void ** |
state | ) |
|
Definition at line 159 of file test_connection.c.
171 assert_non_null(con);
172 assert_int_equal(con->
fd,
fds[0]);
174 assert_string_equal(con->
uri,
"test://localhost:1700");
176 assert_non_null(con);
#define AMXP_CONNECTION_BUS
amxp_connection_t * amxp_connection_get_next(amxp_connection_t *con, uint32_t type)
Gets the next connection data for a file descriptor.
amxp_connection_t * amxp_connection_get_first(uint32_t type)
Gets the first connection of the given type.
◆ test_can_remove_connection()
void test_can_remove_connection |
( |
UNUSED void ** |
state | ) |
|
Definition at line 181 of file test_connection.c.
int amxp_connection_remove(int fd)
Removes the fd from the connection list.
◆ test_can_remove_listener()
void test_can_remove_listener |
( |
UNUSED void ** |
state | ) |
|
◆ test_can_store_event_loop_data()
void test_can_store_event_loop_data |
( |
UNUSED void ** |
state | ) |
|
Definition at line 151 of file test_connection.c.
int amxp_connection_set_el_data(int fd, void *el_data)
Sets event-loop data.
◆ test_connection_setup()
int test_connection_setup |
( |
UNUSED void ** |
state | ) |
|
Definition at line 99 of file test_connection.c.
100 assert_int_equal(pipe(
fds), 0);
int amxp_signal_read(void)
Reads from the amxp signal file descriptor.
int amxp_slot_connect(amxp_signal_mngr_t *const sig_mngr, const char *const sig_name, const char *const expression, amxp_slot_fn_t fn, void *const priv)
Connects a slot (function) to a named signal of a signal manager.
◆ test_connection_teardown()
int test_connection_teardown |
( |
UNUSED void ** |
state | ) |
|
Definition at line 114 of file test_connection.c.
void amxp_slot_disconnect_all(amxp_slot_fn_t fn)
Disconnects a slot from all signals it was connected to.
◆ writer()
◆ el_data
char* el_data = "Some Data" |
|
static |
◆ fds