41 enum ast_test_result_state res = AST_TEST_PASS;
46 info->name =
"set_fd_grow";
47 info->category =
"/main/channel/";
48 info->summary =
"channel setting file descriptor with growth test";
50 "Test that setting a file descriptor on a high position of a channel results in -1 set on any new positions";
51 return AST_TEST_NOT_RUN;
56 mock_channel =
ast_channel_alloc(0,
AST_STATE_DOWN, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0,
"TestChannel");
57 ast_test_validate_cleanup(
test, mock_channel, res, done);
63 ast_test_validate_cleanup(
test, ast_channel_fd(mock_channel, pos) == -1, res, done);
75 enum ast_test_result_state res = AST_TEST_PASS;
80 info->name =
"add_fd";
81 info->category =
"/main/channel/";
82 info->summary =
"channel adding file descriptor test";
84 "Test that adding a file descriptor to a channel places it in the expected position";
85 return AST_TEST_NOT_RUN;
90 mock_channel =
ast_channel_alloc(0,
AST_STATE_DOWN, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0,
"TestChannel");
91 ast_test_validate_cleanup(
test, mock_channel, res, done);
97 ast_test_validate_cleanup(
test, ast_channel_fd(mock_channel, pos) == -1, res, done);
105 static int unload_module(
void)
107 AST_TEST_UNREGISTER(set_fd_grow);
108 AST_TEST_UNREGISTER(add_fd);
112 static int load_module(
void)
114 AST_TEST_REGISTER(set_fd_grow);
115 AST_TEST_REGISTER(add_fd);
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
General Asterisk PBX channel definitions.
int ast_channel_fd_add(struct ast_channel *chan, int value)
Add a file descriptor to the channel without a fixed position.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
void ast_channel_set_fd(struct ast_channel *chan, int which, int fd)
int ast_channel_fd_count(const struct ast_channel *chan)
Retrieve the number of file decriptor positions present on the channel.
#define AST_TEST_DEFINE(hdr)
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
Asterisk module definitions.