cleaup of the TCP/TLS socket API:

1) rename 'struct server_args' to 'struct ast_tcptls_session_args', to follow coding guidelines

2) make ast_make_file_from_fd() static and rename it to something that indicates what it really is for (again coding guidelines)

3) rename address variables inside 'struct ast_tcptls_session_args' to be more descriptive (dare i say it... coding guidelines)

4) change ast_tcptls_client_start() to use the new 'remote_address' field of the session args for the destination of the connection, and use the 'local_address' field to bind() the socket to the proper source address, if one is supplied

5) in chan_sip, ensure that we pass in the PP address we are bound to when creating outbound (client) connections, so that our connections will appear from the correct address



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@151101 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2008-10-19 19:11:28 +00:00
parent 6f860c262d
commit 1ddc834b39
6 changed files with 376 additions and 369 deletions

View File

@@ -46,6 +46,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/app.h"
#include "asterisk/utils.h"
#include "asterisk/tcptls.h"
#include "asterisk/astobj2.h"
static const char *app = "ExternalIVR";
@@ -419,7 +420,7 @@ static int app_exec(struct ast_channel *chan, void *data)
}
if (!strncmp(app_args[0], "ivr://", 6)) {
struct server_args ivr_desc = {
struct ast_tcptls_session_args ivr_desc = {
.accept_fd = -1,
.name = "IVR",
};
@@ -438,9 +439,9 @@ static int app_exec(struct ast_channel *chan, void *data)
}
ast_gethostbyname(hostname, &hp);
ivr_desc.sin.sin_family = AF_INET;
ivr_desc.sin.sin_port = htons(port);
memmove(&ivr_desc.sin.sin_addr.s_addr, hp.hp.h_addr, hp.hp.h_length);
ivr_desc.local_address.sin_family = AF_INET;
ivr_desc.local_address.sin_port = htons(port);
memcpy(&ivr_desc.local_address.sin_addr.s_addr, hp.hp.h_addr, hp.hp.h_length);
ser = ast_tcptls_client_start(&ivr_desc);
if (!ser) {