Thanks

Applied


Le 15 juin 09 à 21:56, Mauro Sergio Ferreira Brasil a écrit :

Hi Vadim!

The patch regarding "Issue 2" described below follows attached, can you please have a look on it ? I've tested both conditions here (with and without callback methods registrated) and I had no problems.

Please let me know whether you have any comments and/or disagreements.

Thanks and best regards,
Mauro.




Vadim Lebedev escreveu:

Mauro,

Go ahead submit your patches for review...
The general approach is ok for me

Thanks
Vadim
Le 21 mai 09 à 18:55, Mauro Sergio Ferreira Brasil a écrit :

Hi Vadim!

I've started testing our application with updated QuteCom codes and libraries today and I have already faced some issues that I would like to suggest to you as patches.

Issue 1:

It was regarding two subsequent calls of method "owplConfigEnableHttpTunnel" with the same configuration. The second call causes the addition of a second instance of the same socket type to "owsl_socket_type_list", what will cause failure during some validation that is made further.

I have already fixed the logic inside our codes so this don't happen again but, nevertheless, I think the implementation of this method could be changed in the way a not so drastic event (like calling it twice with same configuration) don't lead to problems on further methods invocation. (On my case, the phone line registration failed.)

The idea is quite simple: remove all itens on the very beggining of this method and let the right itens to be added inside the "if- then-else" block.

Issue 2:

The first registration test I've made was with HTTP tunnel enabled and it failed immediately because the HTTP message format (the headers, in fact) was not what our SIP HTTP tunnel server was expecting to receive. The connection request was sent, but no "200 OK" was got back in response.

To solve this problem I was wondering if it it would be "acceptable" to create call methods that can be registered by an external application in order to provide the HTTP request on expected format.

It would be something like shown bellow: (consider file "owsl_uoh.c")

static int _owsl_uoh_make_http_request(OWSLSocketInfo_UoH *sock, const char * ip_addr, unsigned short port)
{
    char query[512];
    char buff[2048];
    int nbytes;

    if ( (owsl_http_request_formatters != NULL) &&
(owsl_http_request_formatters->uoh_connect_formatter ! = NULL) )
    {
        // Use external request formatter.
owsl_http_request_formatters->uoh_connect_formatter(query, sizeof(query), sock, ip_addr, port);
    }
    else
    {
snprintf(query, sizeof(query), HTTP_REQUEST_STR, ip_addr, port);
    }

    ....

Registration methods and the main structure that will hold them is not described here, but will be very intuitive. For now, I see a demand to connection request formatting that will be needed for both UOH and UOHS implementations. Maybe this could be extended for the further requests as well.
I still need to validate that.

Thats it!

Is there any possibility of this patch suggestions to be accepted and applied to main QuteCom codes ?

As I've said before, my intention during this migration is to get a final set of codes that are as similar as possible with the current QuteCom codes version.
That's why I'm sending some patch suggestions.

If some of them (or both of them) are not accepted, this will be part of other changes that I have already made here that are specific to our needs.

Thanks and best regards,
Mauro.



--
At.,
<mime-attachment.jpeg>
Technology and Quality on Information
Mauro Sérgio Ferreira Brasil
Coordenador de Projetos e Analista de Sistemas
+ [email protected]
: www.tqi.com.br
( + 55 (34)3291-1700
( + 55 (34)9971-2572 diff -r b9d37dbd4b26 wifo/owsl/src/protocols/ owsl_uoh.c --- a/wifo/owsl/src/protocols/owsl_uoh.c Mon May 25 11:54:53 2009 +0200 +++ b/wifo/owsl/src/protocols/owsl_uoh.c Mon Jun 15 16:27:10 2009 -0300
@@ -433,8 +433,23 @@
        char query[512];
        char buff[2048];
        int nbytes;
+ OWSLHttpRequestFormatters* http_request_formatters = owsl_get_http_request_formatters();

-       snprintf(query, sizeof(query), HTTP_REQUEST_STR, ip_addr, port);
+       if ( (http_request_formatters != NULL) &&
+                       (http_request_formatters->uoh_connect_formatter != 
NULL) )
+       {
+               nbytes = http_request_formatters->uoh_connect_formatter(
+                               query, sizeof(query), (OWSLSocketInfo*)sock, 
ip_addr, port);
+       }
+       else
+       {
+ nbytes = snprintf(query, sizeof(query), HTTP_REQUEST_STR, ip_addr, port);
+       }
+
+       if (nbytes <= 0)
+       {
+               return -1;
+       }

nbytes = send(sock->system_socket, query, (int) strlen(query), MSG_NOSIGNAL);
        if (nbytes <= 0)
diff -r b9d37dbd4b26 wifo/owsl/src/protocols/owsl_uoh_common.c
--- a/wifo/owsl/src/protocols/owsl_uoh_common.c Mon May 25 11:54:53 2009 +0200 +++ b/wifo/owsl/src/protocols/owsl_uoh_common.c Mon Jun 15 16:27:10 2009 -0300
@@ -24,6 +24,9 @@

#include "owsl_base.h"
#include "owsl_uoh_common.h"
+
+static OWSLHttpRequestFormatters* owsl_http_request_formatters = NULL;
+

/* ******************************************************** */
/*          Configuration Parameters management             */
@@ -127,3 +130,19 @@

        return 0;
}
+
+                                                               
+/* ******************************************************** */
+/*                HTTP Header Modifier Callbacks            */
+/* ******************************************************** */
+
+void owsl_set_http_request_formatters(OWSLHttpRequestFormatters* owslHttpRequestFormatters)
+{
+       owsl_http_request_formatters = owslHttpRequestFormatters;
+}
+
+OWSLHttpRequestFormatters* owsl_get_http_request_formatters()
+{
+       return owsl_http_request_formatters;
+}
+
diff -r b9d37dbd4b26 wifo/owsl/src/protocols/owsl_uoh_common.h
--- a/wifo/owsl/src/protocols/owsl_uoh_common.h Mon May 25 11:54:53 2009 +0200 +++ b/wifo/owsl/src/protocols/owsl_uoh_common.h Mon Jun 15 16:27:10 2009 -0300
@@ -93,3 +93,43 @@
int owsl_uoh_common_parameter_set(const OWSLParamKey_UoH *OWSLParamKeyList_UoH, const char * name, const void * value, struct OWList * list);

+
+/* ******************************************************** */
+/*                HTTP Header Modifier Callbacks            */
+/* ******************************************************** */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+struct _OWSLHttpRequestFormatters
+{
+       /*
+ * Place the formatted HTTP content needed to establish the HTTP connection + * with the tunnel server on "connect_headers" and returns the final size of
+        * this content.
+        */
+ int (*uoh_connect_formatter)(char* connect_headers, int connect_headers_size,
+                       OWSLSocketInfo* socket_info, const char* 
remote_server_address,
+                       unsigned short remote_server_port);
+
+       /*
+ * Place the formatted HTTP content needed to establish the HTTP connection + * with the tunnel server on "connect_headers" and returns the final size of
+        * this content.
+        */
+ int (*uohs_connect_formatter)(char* connect_headers, int connect_headers_size,
+                       OWSLSocketInfo* socket_info, const char* 
remote_server_address,
+                       unsigned short remote_server_port);
+};
+
+typedef struct _OWSLHttpRequestFormatters OWSLHttpRequestFormatters;
+
+void owsl_set_http_request_formatters(OWSLHttpRequestFormatters* owslHttpRequestFormatters);
+
+OWSLHttpRequestFormatters* owsl_get_http_request_formatters();
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
diff -r b9d37dbd4b26 wifo/owsl/src/protocols/owsl_uohs.c
--- a/wifo/owsl/src/protocols/owsl_uohs.c Mon May 25 11:54:53 2009 +0200 +++ b/wifo/owsl/src/protocols/owsl_uohs.c Mon Jun 15 16:27:10 2009 -0300
@@ -451,8 +451,23 @@
        char query[512];
        char buff[2048];
        int nbytes;
+ OWSLHttpRequestFormatters* http_request_formatters = owsl_get_http_request_formatters();

-       snprintf(query, sizeof(query), HTTP_REQUEST_STR, ip_addr, port);
+       if ( (http_request_formatters != NULL) &&
+                       (http_request_formatters->uohs_connect_formatter != 
NULL) )
+       {
+               nbytes = http_request_formatters->uohs_connect_formatter(
+                               query, sizeof(query), (OWSLSocketInfo*)sock, 
ip_addr, port);
+       }
+       else
+       {
+ nbytes = snprintf(query, sizeof(query), HTTP_REQUEST_STR, ip_addr, port);
+       }
+
+       if (nbytes <= 0)
+       {
+               return -1;
+       }

        nbytes = SSL_write(sock->ssl_handle, query, (int) strlen(query));
        if (nbytes <= 0)

_______________________________________________
QuteCom-dev mailing list
[email protected]
http://lists.qutecom.org/mailman/listinfo/qutecom-dev

Reply via email to