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