mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
Change coding style
This commit is contained in:
parent
f153922759
commit
a35e5b4f9d
5
TODO
5
TODO
@ -1,3 +1,8 @@
|
||||
- New proxy code crashes if an invalid proxy_type setting is used
|
||||
- Remove old socks code
|
||||
- Lots of warnings at least when using socks5
|
||||
- Clean up coding style
|
||||
|
||||
19:36 [IRCNet] [muzzy] more bugs in irssi, apparently the new version: foo splits out,
|
||||
bar joins, bar changes his nick to foo, foo splits again ->
|
||||
Glib warning "is already in split list (how?)" .. :)
|
||||
|
@ -1,18 +1,20 @@
|
||||
/* --*- c -*--
|
||||
* Copyright (C) 2008 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 and/or 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
network-proxy-http.c : irssi
|
||||
|
||||
Copyright (C) 2008 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 and/or 3 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "network-proxy-http.h"
|
||||
@ -25,8 +27,7 @@
|
||||
#include "network.h"
|
||||
#include "network-proxy-priv.h"
|
||||
|
||||
static void
|
||||
network_proxy_http_destroy(struct network_proxy *proxy)
|
||||
static void network_proxy_http_destroy(struct network_proxy *proxy)
|
||||
{
|
||||
struct _network_proxy_http *self = container_of(proxy, struct _network_proxy_http, proxy);
|
||||
|
||||
@ -36,8 +37,7 @@ network_proxy_http_destroy(struct network_proxy *proxy)
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
static struct network_proxy *
|
||||
network_proxy_http_clone(struct network_proxy const *proxy)
|
||||
static struct network_proxy *network_proxy_http_clone(const struct network_proxy *proxy)
|
||||
{
|
||||
struct _network_proxy_http *self = container_of(proxy, struct _network_proxy_http, proxy);
|
||||
struct _network_proxy_http *res;
|
||||
@ -49,8 +49,8 @@ network_proxy_http_clone(struct network_proxy const *proxy)
|
||||
return &res->proxy;
|
||||
}
|
||||
|
||||
static bool
|
||||
send_connect(struct _network_proxy_http *proxy, GIOChannel *ch, char const *address, uint16_t port)
|
||||
static bool send_connect(struct _network_proxy_http *proxy, GIOChannel *ch,
|
||||
const char *address, uint16_t port)
|
||||
{
|
||||
char port_str[6];
|
||||
|
||||
@ -68,8 +68,7 @@ send_connect(struct _network_proxy_http *proxy, GIOChannel *ch, char const *addr
|
||||
return true;
|
||||
}
|
||||
|
||||
static int
|
||||
read_response(struct _network_proxy_http *proxy, GIOChannel *ch)
|
||||
static int read_response(struct _network_proxy_http *proxy, GIOChannel *ch)
|
||||
{
|
||||
GIOStatus status;
|
||||
GString line = { .str = NULL };
|
||||
@ -125,15 +124,14 @@ err:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static GIOChannel *
|
||||
network_proxy_http_connect(struct network_proxy const *proxy, IPADDR const *hint_ip,
|
||||
char const *address, int port)
|
||||
static GIOChannel *network_proxy_http_connect(const struct network_proxy *proxy, const IPADDR *hint_ip,
|
||||
const char *address, int port)
|
||||
{
|
||||
struct _network_proxy_http *self = container_of(proxy, struct _network_proxy_http, proxy);
|
||||
GIOChannel *ch;
|
||||
GIOFlags old_flags;
|
||||
GError *err = NULL;
|
||||
gchar const *line_term;
|
||||
const gchar *line_term;
|
||||
gint line_term_sz;
|
||||
|
||||
if (hint_ip)
|
||||
@ -171,12 +169,9 @@ err:
|
||||
|
||||
net_disconnect(ch);
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
struct network_proxy *
|
||||
_network_proxy_http_create(void)
|
||||
struct network_proxy *_network_proxy_http_create(void)
|
||||
{
|
||||
struct _network_proxy_http *res;
|
||||
|
||||
|
@ -1,19 +1,3 @@
|
||||
/* --*- c -*--
|
||||
* Copyright (C) 2008 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 and/or 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef H_IRSSI_SRC_CORE_PROXY_HTTP_H
|
||||
#define H_IRSSI_SRC_CORE_PROXY_HTTP_H
|
||||
|
||||
@ -21,9 +5,9 @@
|
||||
|
||||
struct _network_proxy_http {
|
||||
struct network_proxy proxy;
|
||||
char const *password;
|
||||
const char *password;
|
||||
};
|
||||
|
||||
struct network_proxy * _network_proxy_http_create(void);
|
||||
struct network_proxy *_network_proxy_http_create(void);
|
||||
|
||||
#endif /* H_IRSSI_SRC_CORE_PROXY_HTTP_H */
|
||||
#endif
|
||||
|
@ -1,19 +1,3 @@
|
||||
/* --*- c -*--
|
||||
* Copyright (C) 2008 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 and/or 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef H_IRSSI_SRC_CORE_PROXY_PRIV_H
|
||||
#define H_IRSSI_SRC_CORE_PROXY_PRIV_H
|
||||
|
||||
@ -26,15 +10,13 @@
|
||||
(type *)( (char *)__mptr - offsetof(type,member) );})
|
||||
|
||||
|
||||
inline static void
|
||||
_network_proxy_create(struct network_proxy *dst)
|
||||
inline static void _network_proxy_create(struct network_proxy *dst)
|
||||
{
|
||||
dst->port = settings_get_int("proxy_port");
|
||||
dst->host = g_strdup(settings_get_str("proxy_address"));
|
||||
}
|
||||
|
||||
inline static void
|
||||
_network_proxy_clone(struct network_proxy *dst, struct network_proxy const *src)
|
||||
inline static void _network_proxy_clone(struct network_proxy *dst, const struct network_proxy *src)
|
||||
{
|
||||
dst->host = g_strdup(src->host);
|
||||
dst->port = src->port;
|
||||
@ -44,16 +26,14 @@ _network_proxy_clone(struct network_proxy *dst, struct network_proxy const *src)
|
||||
dst->clone = src->clone;
|
||||
}
|
||||
|
||||
inline static void
|
||||
_network_proxy_destroy(struct network_proxy *proxy)
|
||||
inline static void _network_proxy_destroy(struct network_proxy *proxy)
|
||||
{
|
||||
g_free((void *)proxy->host);
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline static bool
|
||||
_network_proxy_send_all(GIOChannel *ch, void const *buf, ssize_t len)
|
||||
inline static bool _network_proxy_send_all(GIOChannel *ch, const void *buf, ssize_t len)
|
||||
{
|
||||
GError *err = NULL;
|
||||
gsize written;
|
||||
@ -74,8 +54,7 @@ _network_proxy_send_all(GIOChannel *ch, void const *buf, ssize_t len)
|
||||
return false;
|
||||
}
|
||||
|
||||
inline static bool
|
||||
_network_proxy_recv_all(GIOChannel *ch, void *buf_v, size_t len)
|
||||
inline static bool _network_proxy_recv_all(GIOChannel *ch, void *buf_v, size_t len)
|
||||
{
|
||||
GError *err = NULL;
|
||||
gchar *buf = buf_v;
|
||||
@ -105,8 +84,7 @@ _network_proxy_recv_all(GIOChannel *ch, void *buf_v, size_t len)
|
||||
return false;
|
||||
}
|
||||
|
||||
inline static bool
|
||||
_network_proxy_flush(GIOChannel *ch)
|
||||
inline static bool _network_proxy_flush(GIOChannel *ch)
|
||||
{
|
||||
GError *err = NULL;
|
||||
GIOStatus status;
|
||||
@ -125,4 +103,4 @@ _network_proxy_flush(GIOChannel *ch)
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif /* H_IRSSI_SRC_CORE_PROXY_PRIV_H */
|
||||
#endif
|
||||
|
@ -1,18 +1,20 @@
|
||||
/* --*- c -*--
|
||||
* Copyright (C) 2008 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 and/or 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
network-proxy-simple.c : irssi
|
||||
|
||||
Copyright (C) 2008 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 and/or 3 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "network-proxy-simple.h"
|
||||
@ -20,8 +22,7 @@
|
||||
#include "network-proxy-priv.h"
|
||||
#include "network.h"
|
||||
|
||||
static void
|
||||
network_proxy_simple_destroy(struct network_proxy *proxy)
|
||||
static void network_proxy_simple_destroy(struct network_proxy *proxy)
|
||||
{
|
||||
struct _network_proxy_simple *self = container_of(proxy, struct _network_proxy_simple, proxy);
|
||||
|
||||
@ -34,8 +35,7 @@ network_proxy_simple_destroy(struct network_proxy *proxy)
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
static struct network_proxy *
|
||||
network_proxy_simple_clone(struct network_proxy const *proxy)
|
||||
static struct network_proxy *network_proxy_simple_clone(const struct network_proxy *proxy)
|
||||
{
|
||||
struct _network_proxy_simple *self = container_of(proxy, struct _network_proxy_simple, proxy);
|
||||
struct _network_proxy_simple *res;
|
||||
@ -50,8 +50,7 @@ network_proxy_simple_clone(struct network_proxy const *proxy)
|
||||
return &res->proxy;
|
||||
}
|
||||
|
||||
static GIOChannel *
|
||||
network_proxy_simple_connect(struct network_proxy const *proxy, IPADDR const *hint_ip,
|
||||
static GIOChannel *network_proxy_simple_connect(const struct network_proxy *proxy, const IPADDR *hint_ip,
|
||||
char const *address, int port)
|
||||
{
|
||||
struct _network_proxy_simple *self = container_of(proxy, struct _network_proxy_simple, proxy);
|
||||
@ -64,9 +63,8 @@ network_proxy_simple_connect(struct network_proxy const *proxy, IPADDR const *hi
|
||||
return net_connect(self->proxy.host, self->proxy.port, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
network_proxy_simple_send_string(struct network_proxy const *proxy,
|
||||
struct network_proxy_send_string_info const *info)
|
||||
static void network_proxy_simple_send_string(const struct network_proxy *proxy,
|
||||
const struct network_proxy_send_string_info *info)
|
||||
{
|
||||
struct _network_proxy_simple *self = container_of(proxy, struct _network_proxy_simple, proxy);
|
||||
char *cmd;
|
||||
@ -84,9 +82,8 @@ network_proxy_simple_send_string(struct network_proxy const *proxy,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
network_proxy_simple_send_string_after(struct network_proxy const *proxy,
|
||||
struct network_proxy_send_string_info const *info)
|
||||
static void network_proxy_simple_send_string_after(const struct network_proxy *proxy,
|
||||
const struct network_proxy_send_string_info *info)
|
||||
{
|
||||
struct _network_proxy_simple *self = container_of(proxy, struct _network_proxy_simple, proxy);
|
||||
char *cmd;
|
||||
@ -98,8 +95,7 @@ network_proxy_simple_send_string_after(struct network_proxy const *proxy,
|
||||
}
|
||||
}
|
||||
|
||||
struct network_proxy *
|
||||
_network_proxy_simple_create(void)
|
||||
struct network_proxy *_network_proxy_simple_create(void)
|
||||
{
|
||||
struct _network_proxy_simple *res;
|
||||
|
||||
|
@ -1,19 +1,3 @@
|
||||
/* --*- c -*--
|
||||
* Copyright (C) 2008 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 and/or 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef H_IRSSI_SRC_CORE_PROXY_SIMPLE_H
|
||||
#define H_IRSSI_SRC_CORE_PROXY_SIMPLE_H
|
||||
|
||||
@ -22,11 +6,11 @@
|
||||
struct _network_proxy_simple {
|
||||
struct network_proxy proxy;
|
||||
|
||||
char const *string_after;
|
||||
char const *string;
|
||||
char const *password;
|
||||
const char *string_after;
|
||||
const char *string;
|
||||
const char *password;
|
||||
};
|
||||
|
||||
struct network_proxy * _network_proxy_simple_create(void);
|
||||
struct network_proxy *_network_proxy_simple_create(void);
|
||||
|
||||
#endif /* H_IRSSI_SRC_CORE_PROXY_SIMPLE_H */
|
||||
#endif
|
||||
|
@ -1,18 +1,20 @@
|
||||
/* --*- c -*--
|
||||
* Copyright (C) 2008 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 and/or 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
network-proxy-socks5.c : irssi
|
||||
|
||||
Copyright (C) 2008 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 and/or 3 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "network-proxy-socks5.h"
|
||||
@ -61,8 +63,7 @@ struct server_response
|
||||
uint8_t bnd[];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
static void
|
||||
network_proxy_socks5_destroy(struct network_proxy *proxy)
|
||||
static void network_proxy_socks5_destroy(struct network_proxy *proxy)
|
||||
{
|
||||
struct _network_proxy_socks5 *self = container_of(proxy, struct _network_proxy_socks5, proxy);
|
||||
|
||||
@ -72,8 +73,7 @@ network_proxy_socks5_destroy(struct network_proxy *proxy)
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
static struct network_proxy *
|
||||
network_proxy_socks5_clone(struct network_proxy const *proxy)
|
||||
static struct network_proxy *network_proxy_socks5_clone(const struct network_proxy *proxy)
|
||||
{
|
||||
struct _network_proxy_socks5 *self = container_of(proxy, struct _network_proxy_socks5, proxy);
|
||||
struct _network_proxy_socks5 *res;
|
||||
@ -86,8 +86,7 @@ network_proxy_socks5_clone(struct network_proxy const *proxy)
|
||||
return &res->proxy;
|
||||
}
|
||||
|
||||
static bool
|
||||
socks5_connect_unauthorized(GIOChannel *ch)
|
||||
static bool socks5_connect_unauthorized(GIOChannel *ch)
|
||||
{
|
||||
/* nothing to do here */
|
||||
(void)ch;
|
||||
@ -95,8 +94,7 @@ socks5_connect_unauthorized(GIOChannel *ch)
|
||||
}
|
||||
|
||||
/* TODO: test this method! */
|
||||
static bool
|
||||
socks5_connect_plain(struct _network_proxy_socks5 const *proxy, GIOChannel *ch)
|
||||
static bool socks5_connect_plain(const struct _network_proxy_socks5 *proxy, GIOChannel *ch)
|
||||
{
|
||||
uint8_t ver = 0x01;
|
||||
uint8_t ulen = strlen(proxy->username);
|
||||
@ -126,9 +124,8 @@ socks5_connect_plain(struct _network_proxy_socks5 const *proxy, GIOChannel *ch)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
socks5_connect(struct _network_proxy_socks5 const *proxy, GIOChannel *ch,
|
||||
char const *address, uint16_t port)
|
||||
static bool socks5_connect(const struct _network_proxy_socks5 *proxy, GIOChannel *ch,
|
||||
const char *address, uint16_t port)
|
||||
{
|
||||
bool rc;
|
||||
|
||||
@ -267,15 +264,14 @@ err:
|
||||
}
|
||||
|
||||
|
||||
static GIOChannel *
|
||||
network_proxy_socks5_connect(struct network_proxy const *proxy, IPADDR const *hint_ip,
|
||||
char const *address, int port)
|
||||
static GIOChannel *network_proxy_socks5_connect(const struct network_proxy *proxy, const IPADDR *hint_ip,
|
||||
const char *address, int port)
|
||||
{
|
||||
struct _network_proxy_socks5 *self = container_of(proxy, struct _network_proxy_socks5, proxy);
|
||||
GIOChannel *ch;
|
||||
|
||||
GIOFlags old_flags;
|
||||
gchar const *old_enc;
|
||||
const gchar *old_enc;
|
||||
gboolean old_buf;
|
||||
GError *err = NULL;
|
||||
|
||||
@ -319,8 +315,7 @@ err:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct network_proxy *
|
||||
_network_proxy_socks5_create(void)
|
||||
struct network_proxy *_network_proxy_socks5_create(void)
|
||||
{
|
||||
struct _network_proxy_socks5 *res;
|
||||
|
||||
|
@ -1,19 +1,3 @@
|
||||
/* --*- c -*--
|
||||
* Copyright (C) 2008 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 and/or 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef H_IRSSI_SRC_CORE_PROXY_SOCKS5_H
|
||||
#define H_IRSSI_SRC_CORE_PROXY_SOCKS5_H
|
||||
|
||||
@ -22,10 +6,10 @@
|
||||
struct _network_proxy_socks5 {
|
||||
struct network_proxy proxy;
|
||||
|
||||
char const *username;
|
||||
char const *password;
|
||||
const char *username;
|
||||
const char *password;
|
||||
};
|
||||
|
||||
struct network_proxy * _network_proxy_socks5_create(void);
|
||||
struct network_proxy *_network_proxy_socks5_create(void);
|
||||
|
||||
#endif /* H_IRSSI_SRC_CORE_PROXY_SOCKS5_H */
|
||||
#endif
|
||||
|
@ -1,18 +1,20 @@
|
||||
/* --*- c -*--
|
||||
* Copyright (C) 2008 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 and/or 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
network-proxy.c : irssi
|
||||
|
||||
Copyright (C) 2008 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 and/or 3 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
|
||||
@ -22,8 +24,7 @@
|
||||
#include "network-proxy-http.h"
|
||||
#include "network-proxy-socks5.h"
|
||||
|
||||
struct network_proxy *
|
||||
network_proxy_create(char const *type)
|
||||
struct network_proxy *network_proxy_create(const char *type)
|
||||
{
|
||||
if (type==NULL)
|
||||
return NULL;
|
||||
|
@ -1,19 +1,3 @@
|
||||
/* --*- c -*--
|
||||
* Copyright (C) 2008 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 and/or 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef H_IRSSI_SRC_CORE_PROXY_H
|
||||
#define H_IRSSI_SRC_CORE_PROXY_H
|
||||
|
||||
@ -22,13 +6,12 @@
|
||||
|
||||
/* helper structure for the send_string*() functions of the network_proxy
|
||||
* class */
|
||||
struct network_proxy_send_string_info
|
||||
{
|
||||
char const *host; /* hostname of the IRC server */
|
||||
struct network_proxy_send_string_info {
|
||||
const char *host; /* hostname of the IRC server */
|
||||
uint16_t port; /* portnumber of the IRC server */
|
||||
|
||||
/* function which is used to send string; usually irc_send_cmd_now() */
|
||||
void (*func)(void *obj, char const *);
|
||||
void (*func)(void *obj, const char *);
|
||||
|
||||
/* object for func */
|
||||
void *obj;
|
||||
@ -46,36 +29,34 @@ struct network_proxy {
|
||||
* \arg address the hostname where proxy shall connect to
|
||||
* \arg port port address where proxy shall connect to
|
||||
*/
|
||||
GIOChannel * (*connect)(struct network_proxy const *, IPADDR const *hint_ip,
|
||||
char const *address, int port);
|
||||
GIOChannel *(*connect)(const struct *network_proxy, const IPADDR *hint_ip,
|
||||
const char *address, int port);
|
||||
|
||||
/* clones the given network_proxy object; this memberfunction is
|
||||
* mandatory */
|
||||
struct network_proxy * (*clone)(struct network_proxy const *);
|
||||
struct network_proxy *(*clone)(const struct *network_proxy);
|
||||
|
||||
|
||||
/* sends a string after connection has been established but before IRC
|
||||
* authentication begins; this memberfunction is optional
|
||||
*/
|
||||
void (*send_string)(struct network_proxy const *,
|
||||
struct network_proxy_send_string_info const *);
|
||||
void (*send_string)(const struct *network_proxy,
|
||||
const struct *network_proxy_send_string_info);
|
||||
|
||||
/* sends a string after connection IRC authentication suceeded; this
|
||||
* memberfunction is optional
|
||||
*/
|
||||
void (*send_string_after)(struct network_proxy const *,
|
||||
struct network_proxy_send_string_info const *);
|
||||
|
||||
void (*send_string_after)(const struct *network_proxy,
|
||||
const struct *network_proxy_send_string_info);
|
||||
|
||||
/* hostname of proxy host */
|
||||
char const *host;
|
||||
const char *host;
|
||||
|
||||
/* portnumber of proxy */
|
||||
int port;
|
||||
};
|
||||
|
||||
/* factory method to create a proxy object based upon value of 'type' */
|
||||
struct network_proxy * network_proxy_create(char const *type);
|
||||
struct network_proxy *network_proxy_create(const char *type);
|
||||
|
||||
|
||||
#endif /* H_IRSSI_SRC_CORE_PROXY_H */
|
||||
#endif
|
||||
|
@ -231,14 +231,12 @@ GIOChannel *net_connect_ip(IPADDR *ip, int port, IPADDR *my_ip)
|
||||
GIOChannel *net_connect_proxy(struct network_proxy const *proxy,
|
||||
char const *host, int port, IPADDR *ip, IPADDR *my_ip)
|
||||
{
|
||||
|
||||
if (proxy)
|
||||
return proxy->connect(proxy, ip, host, port);
|
||||
else
|
||||
return net_connect_ip(ip, port, my_ip);
|
||||
}
|
||||
|
||||
|
||||
/* Connect to named UNIX socket */
|
||||
GIOChannel *net_connect_unix(const char *path)
|
||||
{
|
||||
|
@ -50,11 +50,13 @@ int net_ip_compare(IPADDR *ip1, IPADDR *ip2);
|
||||
/* Connect to socket */
|
||||
GIOChannel *net_connect(const char *addr, int port, IPADDR *my_ip);
|
||||
/* Connect to socket with ip address and SSL*/
|
||||
GIOChannel *net_connect_proxy_ssl(struct network_proxy const *proxy, char const *host, int port, IPADDR *ip, IPADDR *my_ip, SERVER_REC *server);
|
||||
GIOChannel *net_connect_proxy_ssl(struct network_proxy const *proxy, char const *host, int port,
|
||||
IPADDR *ip, IPADDR *my_ip, SERVER_REC *server);
|
||||
int irssi_ssl_handshake(GIOChannel *handle);
|
||||
/* Connect to socket with ip address */
|
||||
GIOChannel *net_connect_ip(IPADDR *ip, int port, IPADDR *my_ip);
|
||||
GIOChannel *net_connect_proxy(struct network_proxy const *proxy, char const *host, int port, IPADDR *ip, IPADDR *my_ip);
|
||||
GIOChannel *net_connect_proxy(struct network_proxy const *proxy, char const *host, int port,
|
||||
IPADDR *ip, IPADDR *my_ip);
|
||||
/* Connect to named UNIX socket */
|
||||
GIOChannel *net_connect_unix(const char *path);
|
||||
/* Disconnect socket */
|
||||
|
Loading…
Reference in New Issue
Block a user