changeset 11482:3ced52f7ace2

[gaim-migrate @ 13724] not used anymore (replaced by src/dnssrv.[ch]) committer: Tailor Script <tailor@pidgin.im>
author Thomas Butter <tbutter>
date Fri, 09 Sep 2005 19:36:31 +0000
parents c80edbd8961a
children 0d18fa6c3b41
files src/protocols/simple/srvresolve.c src/protocols/simple/srvresolve.h
diffstat 2 files changed, 0 insertions(+), 148 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/simple/srvresolve.c	Fri Sep 09 19:06:29 2005 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/**
- * @file srvresolve.c
- *
- * gaim
- *
- * Copyright (C) 2005 Thomas Butter <butter@uni-mannheim.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; 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "srvresolve.h"
-
-typedef union {
-	HEADER hdr;
-	u_char buf[1024];
-} queryans;
-
-struct getserver_return *getserver(const char *domain, const char *srv) {
-	static struct getserver_return ret;
-	queryans answer;
-	int size;
-	int qdcount;
-	int ancount;
-	gchar *end;
-	gchar *cp;
-	gchar name[256];
-	gchar *bestname = NULL;
-	int bestport = 5060;
-	int bestpri=99999;
-	int type, dlen, pref, weight, port;
-	gchar *query = g_strdup_printf("%s.%s",srv,domain);
-
-	
-	size = res_query( query, C_IN, T_SRV, (u_char*)&answer, sizeof( answer));
-
-	g_free(query);
-
-	qdcount = ntohs(answer.hdr.qdcount);
-	ancount = ntohs(answer.hdr.ancount);
-
-	
-	cp = (char*)&answer + sizeof(HEADER);
-	end = (char*)&answer + size;
-
-	// skip over unwanted stuff
-	while (qdcount-- > 0 && cp < end) {
-		size = dn_expand( (char*)&answer, end, cp, name, 256);
-		if(size < 0) return NULL;
-		cp += size + QFIXEDSZ;
-	}
-
-	while (ancount-- > 0 && cp < end) {
-		size = dn_expand((char*)&answer, end, cp, name, 256);
-		if(size < 0)
-			return NULL;
-
-		cp += size;
-	
-		NS_GET16(type,cp);
-		cp += 6; // skip ttl and class
-
-		NS_GET16(dlen,cp);
-
-		if (type == T_SRV) {
-			NS_GET16(pref,cp);
-
-			NS_GET16(weight, cp);
-
-			NS_GET16(port, cp);
-
-			size = dn_expand( (char*)&answer, end, cp, name, 256);
-			if(size < 0 )
-				return NULL;
-
-			cp += size;
-
-			if(pref<bestpri) {
-				if( bestname) g_free(bestname);
-				bestname = g_strdup(name);
-				bestpri = pref;
-				bestport = port;
-			}
-		} else {
-			cp += dlen;
-		}
-	}
-	if(bestpri < 99999) {
-		ret.name = bestname;
-		ret.port = bestport;
-	} else {
-		ret.name = g_strdup(domain);
-		ret.port = 5060;
-	}
-	return &ret;
-}
--- a/src/protocols/simple/srvresolve.h	Fri Sep 09 19:06:29 2005 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/**
- * @file srvresolve.h
- * 
- * gaim
- *
- * Copyright (C) 2005, Thomas Butter <butter@uni-mannheim.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; 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef _GAIM_SRVRESOLVE_H
-#define _GAIM_SRVRESOLVE_H
-
-#include <glib.h>
-#include <resolv.h>
-#include <stdlib.h>
-#include <arpa/nameser_compat.h>
-#ifndef T_SRV
-#define T_SRV	33
-#endif
-
-struct getserver_return {
-	char *name;
-	int port;
-};
-
-struct getserver_return *getserver(const char *domain, const char *srv);
-
-#endif /* _GAIM_SRVRESOLVE_H */