socks5.c
changeset 114 813867884159
equal deleted inserted replaced
113:cb5adb25ad87 114:813867884159
       
     1 /*
       
     2  * socks5.c
       
     3  *
       
     4  * Copyrigth (C) 2010 Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
       
     5  *
       
     6  * This program is free software; you can redistribute it and/or modify
       
     7  * it under the terms of the GNU General Public License as published by
       
     8  * the Free Software Foundation; either version 2 of the License, or (at
       
     9  * your option) any later version.
       
    10  *
       
    11  * This program is distributed in the hope that it will be useful, but
       
    12  * WITHOUT ANY WARRANTY; without even the implied warranty of
       
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    14  * General Public License for more details.
       
    15  *
       
    16  * You should have received a copy of the GNU General Public License
       
    17  * along with this program; if not, write to the Free Software
       
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
       
    19  * USA
       
    20  */
       
    21 
       
    22 #include "config.h"
       
    23 
       
    24 #include <glib.h>
       
    25 
       
    26 #include <mcabber/xmpp.h>
       
    27 #include <mcabber/modules.h>
       
    28 #include <mcabber/utils.h>
       
    29 #include <mcabber/xmpp_helper.h>
       
    30 #include <mcabber/logprint.h>
       
    31 #include <mcabber/hooks.h>
       
    32 
       
    33 #include <jingle/jingle.h>
       
    34 #include <jingle/check.h>
       
    35 #include <jingle/register.h>
       
    36 
       
    37 #include "socks5.h"
       
    38 
       
    39 gconstpointer jingle_socks5_check(JingleContent *cn, GError **err);
       
    40 gboolean jingle_socks5_cmp(gconstpointer data1, gconstpointer data2);
       
    41 void jingle_socks5_tomessage(gconstpointer data, LmMessageNode *node);
       
    42 const gchar* jingle_socks5_xmlns(void);
       
    43 gconstpointer jingle_socks5_new(void);
       
    44 void jingle_socks5_send(session_content *sc, const gchar *to, gconstpointer data, gchar *buf, gsize size);
       
    45 
       
    46 static void jingle_socks5_init(void);
       
    47 static void jingle_socks5_uninit(void);
       
    48 
       
    49 const gchar *deps[] = { "jingle", NULL };
       
    50 
       
    51 static JingleTransportFuncs funcs = {
       
    52   jingle_socks5_xmlns,
       
    53   jingle_socks5_check,
       
    54   jingle_socks5_tomessage,
       
    55   jingle_socks5_cmp,
       
    56   jingle_socks5_new,
       
    57   jingle_socks5_send
       
    58 };
       
    59 
       
    60 module_info_t  info_jingle_inbandbytestream = {
       
    61   .branch          = MCABBER_BRANCH,
       
    62   .api             = MCABBER_API_VERSION,
       
    63   .version         = PROJECT_VERSION,
       
    64   .description     = "Jingle In Band Bytestream (XEP-0261)\n",
       
    65   .requires        = deps,
       
    66   .init            = jingle_socks5_init,
       
    67   .uninit          = jingle_socks5_uninit,
       
    68   .next            = NULL,
       
    69 };
       
    70 
       
    71 
       
    72 const gchar* jingle_socks5_xmlns(void)
       
    73 {
       
    74   return NS_JINGLE_TRANSPORT_SOCKS5;
       
    75 }
       
    76 
       
    77 static void jingle_socks5_init(void)
       
    78 {
       
    79   jingle_register_transport(NS_JINGLE_TRANSPORT_SOCKS5, &funcs,
       
    80                             JINGLE_TRANSPORT_STREAMING,
       
    81                             JINGLE_TRANSPORT_MEDIUM);
       
    82   xmpp_add_feature(NS_JINGLE_TRANSPORT_SOCKS5);
       
    83 }
       
    84 
       
    85 static void jingle_socks5_uninit(void)
       
    86 {
       
    87   xmpp_del_feature(NS_JINGLE_TRANSPORT_SOCKS5);
       
    88   jingle_unregister_transport(NS_JINGLE_TRANSPORT_SOCKS5);
       
    89 }