From b457fec36399c1f7de093d5e92bb4fa453b79c86 Mon Sep 17 00:00:00 2001 From: Jakub Sławiński Date: Sun, 5 Feb 2006 15:14:03 +0100 Subject: v0.8 - Fixed: infinite loop after buffering message - Fixed: corrupt packets after closing connections in the stopped state - Fixed: bug in mapping user numbers between afclient and afserver - Fixed: premature close of the service connection - Fixed: invalid buffering when the connection is closing - Added: Multiple tunnels in one afclient<->afserver connection --- src/realmnames.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/realmnames.c') diff --git a/src/realmnames.c b/src/realmnames.c index cbc38b2..0b920dd 100644 --- a/src/realmnames.c +++ b/src/realmnames.c @@ -22,12 +22,23 @@ #include #include +#include #include "realmnames.h" +/* + * Function name: get_realmname + * Description: Returns the name of the realm. + * Arguments: config - the server configuration + * realm - the realm number + * Returns: The name of the realm. + */ + char* get_realmname(ServerConfiguration* config, int realm) { static char realmname[10]; + + assert(config != NULL); if (ServerRealm_get_realmName(ServerConfiguration_get_realmsTable(config)[realm]) == NULL) { memset(realmname, 0, 10); @@ -38,12 +49,23 @@ get_realmname(ServerConfiguration* config, int realm) return ServerRealm_get_realmName(ServerConfiguration_get_realmsTable(config)[realm]); } +/* + * Function name: get_realmnumber + * Description: Returns the realm number. + * Arguments: config - the server configuration + * realmname - the name of the realm + * Returns: The realm number or -1, if there is no realm with such name. + */ + int get_realmnumber(ServerConfiguration* config, char* realmname) { int i; char guard; + assert(config != NULL); + assert(realmname != NULL); + for (i = 0; i < ServerConfiguration_get_realmsNumber(config); ++i) { if (ServerRealm_get_realmName(ServerConfiguration_get_realmsTable(config)[i]) != NULL) { if (strcmp(realmname, ServerRealm_get_realmName(ServerConfiguration_get_realmsTable(config)[i])) == 0) { -- cgit v1.1