From 5d550c51a5e9c9f48f26283f0ea3fee2d4945feb Mon Sep 17 00:00:00 2001 From: ulim Date: Tue, 12 Aug 2008 11:24:09 +0200 Subject: Added lib/ftutil.[ch]. yes, that was supposed to happen in the last commit ;) --- lib/ftutil.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 lib/ftutil.h (limited to 'lib/ftutil.h') diff --git a/lib/ftutil.h b/lib/ftutil.h new file mode 100644 index 00000000..5f2780ef --- /dev/null +++ b/lib/ftutil.h @@ -0,0 +1,24 @@ +/***************************************************************************\ +* * +* BitlBee - An IRC to IM gateway * +* Utility functions for file transfer * +* * +* Copyright 2008 Uli Meis * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +* 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, write to the Free Software Foundation, Inc., * +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* * +\***************************************************************************/ + +int ft_listen( struct sockaddr_storage *saddr_ptr, char *host, char *port, int for_bitlbee_client, char **errptr ); -- cgit v1.2.3 From aac40178a6669e20855b7f5d3cc6a82cba10042e Mon Sep 17 00:00:00 2001 From: ulim Date: Tue, 12 Aug 2008 13:04:37 +0200 Subject: More hints for getaddrinfo(). Hopefully solves a problem on FreeBSD. --- lib/ftutil.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/ftutil.h') diff --git a/lib/ftutil.h b/lib/ftutil.h index 5f2780ef..636fcbd0 100644 --- a/lib/ftutil.h +++ b/lib/ftutil.h @@ -21,4 +21,8 @@ * * \***************************************************************************/ +#ifndef AI_NUMERICSERV +#define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */ +#endif + int ft_listen( struct sockaddr_storage *saddr_ptr, char *host, char *port, int for_bitlbee_client, char **errptr ); -- cgit v1.2.3 From 60e4df367e5c3af0eb1aada19f9c39ef7079e8e6 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 17 Mar 2010 23:23:27 +0000 Subject: Small cleanup. The max_packet_size variable doesn't seem to be read anywhere, and reworked string handling in ft_listen() a little bit. --- lib/ftutil.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/ftutil.h') diff --git a/lib/ftutil.h b/lib/ftutil.h index 636fcbd0..c4a5b02b 100644 --- a/lib/ftutil.h +++ b/lib/ftutil.h @@ -25,4 +25,16 @@ #define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */ #endif +/* Some ifdefs for ulibc and apparently also BSD (Thanks to Whoopie) */ +#ifndef HOST_NAME_MAX +#include +#ifdef MAXHOSTNAMELEN +#define HOST_NAME_MAX MAXHOSTNAMELEN +#else +#define HOST_NAME_MAX 255 +#endif +#endif + +/* This function should be used with care. host should be AT LEAST a + char[HOST_NAME_MAX+1] and port AT LEAST a char[6]. */ int ft_listen( struct sockaddr_storage *saddr_ptr, char *host, char *port, int for_bitlbee_client, char **errptr ); -- cgit v1.2.3