summaryrefslogtreecommitdiff
path: root/src/realmnames.c
diff options
context:
space:
mode:
authorJakub Sławiński2006-02-05 15:14:03 +0100
committerJoshua Judson Rosen2014-07-17 21:15:02 +0200
commitb457fec36399c1f7de093d5e92bb4fa453b79c86 (patch)
tree2084c9a78d40213015e6f10e3e9e01bc4c0c51f1 /src/realmnames.c
parentUpdate copyright statements. (diff)
downloadapf-b457fec36399c1f7de093d5e92bb4fa453b79c86.tar.gz
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
Diffstat (limited to 'src/realmnames.c')
-rw-r--r--src/realmnames.c22
1 files changed, 22 insertions, 0 deletions
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 <stdio.h>
#include <string.h>
+#include <assert.h>
#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) {