summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/GNUmakefile4
-rw-r--r--src/common/core.cpp (renamed from src/common/core.c)18
-rw-r--r--src/common/core.hpp (renamed from src/common/core.h)6
-rw-r--r--src/common/db.cpp (renamed from src/common/db.c)4
-rw-r--r--src/common/db.hpp (renamed from src/common/db.h)9
-rw-r--r--src/common/grfio.cpp (renamed from src/common/grfio.c)14
-rw-r--r--src/common/grfio.hpp (renamed from src/common/grfio.h)6
-rw-r--r--src/common/lock.cpp (renamed from src/common/lock.c)4
-rw-r--r--src/common/lock.hpp (renamed from src/common/lock.h)6
-rw-r--r--src/common/md5calc.cpp (renamed from src/common/md5calc.c)27
-rw-r--r--src/common/md5calc.hpp (renamed from src/common/md5calc.h)10
-rw-r--r--src/common/mmo.hpp (renamed from src/common/mmo.h)16
-rw-r--r--src/common/mt_rand.cpp (renamed from src/common/mt_rand.c)3
-rw-r--r--src/common/mt_rand.hpp (renamed from src/common/mt_rand.h)8
-rw-r--r--src/common/nullpo.cpp (renamed from src/common/nullpo.c)19
-rw-r--r--src/common/nullpo.hpp (renamed from src/common/nullpo.h)8
-rw-r--r--src/common/sanity.hpp (renamed from src/common/sanity.h)21
-rw-r--r--src/common/socket.cpp (renamed from src/common/socket.c)6
-rw-r--r--src/common/socket.hpp (renamed from src/common/socket.h)8
-rw-r--r--src/common/timer.cpp (renamed from src/common/timer.c)4
-rw-r--r--src/common/timer.hpp (renamed from src/common/timer.h)8
-rw-r--r--src/common/utils.cpp97
-rw-r--r--src/common/utils.hpp (renamed from src/common/utils.h)14
-rw-r--r--src/common/version.hpp (renamed from src/common/version.h)6
24 files changed, 215 insertions, 111 deletions
diff --git a/src/common/GNUmakefile b/src/common/GNUmakefile
index 555f81e..d8d841f 100644
--- a/src/common/GNUmakefile
+++ b/src/common/GNUmakefile
@@ -1,7 +1,7 @@
.SUFFIXES:
all:
- make -C ../.. common
+ ${MAKE} -C ../.. common
clean:
rm -r ../../obj/common/
%::
- make -C ../.. obj/common/$@
+ ${MAKE} -C ../.. obj/common/$@
diff --git a/src/common/core.c b/src/common/core.cpp
index b08276c..db26e31 100644
--- a/src/common/core.c
+++ b/src/common/core.cpp
@@ -4,16 +4,12 @@
#include <signal.h>
#include <sys/wait.h>
-#include "core.h"
-#include "socket.h"
-#include "timer.h"
-#include "version.h"
-#include "mt_rand.h"
-#include "nullpo.h"
-
-/// Defined by each server
-extern int do_init (int, char **);
-extern void term_func (void);
+#include "core.hpp"
+#include "socket.hpp"
+#include "timer.hpp"
+#include "version.hpp"
+#include "mt_rand.hpp"
+#include "nullpo.hpp"
// Added by Gabuzomeu
//
@@ -22,7 +18,7 @@ extern void term_func (void);
// Programming in the UNIX Environment_.
//
typedef void (*sigfunc)(int);
-sigfunc compat_signal (int signo, sigfunc func)
+static sigfunc compat_signal (int signo, sigfunc func)
{
struct sigaction sact, oact;
diff --git a/src/common/core.h b/src/common/core.hpp
index 44473e9..8a52c55 100644
--- a/src/common/core.h
+++ b/src/common/core.hpp
@@ -1,5 +1,5 @@
-#ifndef CORE_H
-#define CORE_H
+#ifndef CORE_HPP
+#define CORE_HPP
#include <stdbool.h>
/// core.c contains a server-independent main() function
/// and then runs a do_sendrecv loop
@@ -16,4 +16,4 @@ extern int do_init (int, char **);
/// or when if we manage to exit() gracefully.
extern void term_func (void);
-#endif // CORE_H
+#endif // CORE_HPP
diff --git a/src/common/db.c b/src/common/db.cpp
index f56a511..21a3597 100644
--- a/src/common/db.c
+++ b/src/common/db.cpp
@@ -1,10 +1,10 @@
-#include "db.h"
+#include "db.hpp"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "utils.h"
+#include "utils.hpp"
#define ROOT_SIZE 4096
diff --git a/src/common/db.h b/src/common/db.hpp
index 7152854..62125d8 100644
--- a/src/common/db.h
+++ b/src/common/db.hpp
@@ -1,7 +1,7 @@
// WARNING: there is a system header by this name
-#ifndef DB_H
-#define DB_H
-# include "sanity.h"
+#ifndef DB_HPP
+#define DB_HPP
+# include "sanity.hpp"
# include <stdarg.h>
@@ -22,6 +22,9 @@ typedef union db_key_t
char *ms __attribute__((deprecated));
const char* s;
numdb_key_t i;
+
+ db_key_t(numdb_key_t n) : i(n) {}
+ db_key_t(const char * z) : s(z) {}
} db_key_t;
typedef void* db_val_t;
typedef uint32_t hash_t;
diff --git a/src/common/grfio.c b/src/common/grfio.cpp
index d640263..dd1e707 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.cpp
@@ -4,10 +4,10 @@
#include <string.h>
#include <sys/stat.h>
-#include "utils.h"
-#include "grfio.h"
-#include "mmo.h"
-#include "socket.h"
+#include "utils.hpp"
+#include "grfio.hpp"
+#include "mmo.hpp"
+#include "socket.hpp"
//----------------------------
// file entry table struct
@@ -29,7 +29,9 @@ static uint16_t filelist_entrys = 0;
static uint16_t filelist_maxentry = 0;
/// First index of the given hash, into the filelist[] array
-static int16_t filelist_hash[256] = {[0 ... 255] = -1};
+#define l -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
+static int16_t filelist_hash[256] = {l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l};
+#undef l
/// Hash a filename
static uint8_t filehash (const char *fname)
@@ -45,6 +47,7 @@ static uint8_t filehash (const char *fname)
}
/// Find the filelist entry for the given filename, or NULL if it is not
+static
FILELIST *filelist_find (const char *fname)
{
int16_t index = filelist_hash[filehash (fname)];
@@ -98,6 +101,7 @@ static FILELIST *filelist_modify (FILELIST * entry)
/// Change fname data/*.gat to lfname data/*.wlk
// TODO even if the file exists, don't keep reopening it every time one loads
+static
void grfio_resnametable (const char *fname, char *lfname)
{
char restable[] = "data/resnametable.txt";
diff --git a/src/common/grfio.h b/src/common/grfio.hpp
index 4919a7b..3485904 100644
--- a/src/common/grfio.h
+++ b/src/common/grfio.hpp
@@ -2,8 +2,8 @@
// Note .gat files are mapped to .wlk files by data/resnametable.txt
// Note that there currently is a 1-1 correlation between them,
// but it is possible for a single .wlk to have multiple .gats reference it
-#ifndef GRFIO_H
-#define GRFIO_H
+#ifndef GRFIO_HPP
+#define GRFIO_HPP
/// Load file into memory
# define grfio_read(resourcename) grfio_reads (resourcename, NULL)
@@ -14,4 +14,4 @@ void *grfio_reads (const char *resourcename, size_t *size);
// This is only called once, and that is to check the existence of a file.
size_t grfio_size (const char *resourcename) __attribute__((deprecated));
-#endif // GRFIO_H
+#endif // GRFIO_HPP
diff --git a/src/common/lock.c b/src/common/lock.cpp
index dd42ef2..2ba9a0a 100644
--- a/src/common/lock.c
+++ b/src/common/lock.cpp
@@ -1,7 +1,7 @@
#include <unistd.h>
#include <stdio.h>
-#include "lock.h"
-#include "socket.h"
+#include "lock.hpp"
+#include "socket.hpp"
/// Protected file writing
/// (Until the file is closed, it keeps the old file)
diff --git a/src/common/lock.h b/src/common/lock.hpp
index 2f087fd..19c1302 100644
--- a/src/common/lock.h
+++ b/src/common/lock.hpp
@@ -1,8 +1,8 @@
-#ifndef LOCK_H
-#define LOCK_H
+#ifndef LOCK_HPP
+#define LOCK_HPP
/// Locked FILE I/O
// Changes are made in a separate file until lock_fclose
FILE *lock_fopen (const char *filename, int *info);
void lock_fclose (FILE * fp, const char *filename, int *info);
-#endif // LOCK_H
+#endif // LOCK_HPP
diff --git a/src/common/md5calc.c b/src/common/md5calc.cpp
index ba8f6af..b0f8e5f 100644
--- a/src/common/md5calc.c
+++ b/src/common/md5calc.cpp
@@ -1,6 +1,6 @@
-#include "md5calc.h"
+#include "md5calc.hpp"
#include <string.h>
-#include "mt_rand.h"
+#include "mt_rand.hpp"
// auxilary data
/*
@@ -309,31 +309,26 @@ bool pass_ok(const char *password, const char *crypted) {
// [M|h]ashes up an IP address and a secret key
// to return a hopefully unique masked IP.
-in_addr_t MD5_ip(char *secret, in_addr_t ip)
+struct in_addr MD5_ip(char *secret, struct in_addr ip)
{
char ipbuf[32];
uint8_t obuf[16];
union {
- struct bytes {
- uint8_t b1;
- uint8_t b2;
- uint8_t b3;
- uint8_t b4;
- } bytes;
- in_addr_t ip;
+ uint8_t bytes[4];
+ struct in_addr ip;
} conv;
// MD5sum a secret + the IP address
memset(&ipbuf, 0, sizeof(ipbuf));
- snprintf(ipbuf, sizeof(ipbuf), "%lu%s", (unsigned long)ip, secret);
+ snprintf(ipbuf, sizeof(ipbuf), "%u%s", ip.s_addr, secret);
/// TODO stop it from being a cstring
MD5_to_bin(MD5_from_cstring(ipbuf), obuf);
- // Fold the md5sum to 32 bits, pack the bytes to an in_addr_t
- conv.bytes.b1 = obuf[0] ^ obuf[1] ^ obuf[8] ^ obuf[9];
- conv.bytes.b2 = obuf[2] ^ obuf[3] ^ obuf[10] ^ obuf[11];
- conv.bytes.b3 = obuf[4] ^ obuf[5] ^ obuf[12] ^ obuf[13];
- conv.bytes.b4 = obuf[6] ^ obuf[7] ^ obuf[14] ^ obuf[15];
+ // Fold the md5sum to 32 bits, pack the bytes to an in_addr
+ conv.bytes[0] = obuf[0] ^ obuf[1] ^ obuf[8] ^ obuf[9];
+ conv.bytes[1] = obuf[2] ^ obuf[3] ^ obuf[10] ^ obuf[11];
+ conv.bytes[2] = obuf[4] ^ obuf[5] ^ obuf[12] ^ obuf[13];
+ conv.bytes[3] = obuf[6] ^ obuf[7] ^ obuf[14] ^ obuf[15];
return conv.ip;
}
diff --git a/src/common/md5calc.h b/src/common/md5calc.hpp
index b864791..2dfaecb 100644
--- a/src/common/md5calc.h
+++ b/src/common/md5calc.hpp
@@ -1,7 +1,7 @@
-#ifndef MD5CALC_H
-#define MD5CALC_H
+#ifndef MD5CALC_HPP
+#define MD5CALC_HPP
-#include "sanity.h"
+#include "sanity.hpp"
#include <netinet/in.h>
@@ -58,7 +58,7 @@ const char *make_salt(void);
/// check plaintext password against saved saltcrypt
bool pass_ok(const char *password, const char *crypted);
-/// This returns an in_addr_t because it is configurable whether it gets called at all
-in_addr_t MD5_ip(char *secret, in_addr_t ip);
+/// This returns an in_addr because it is configurable whether it gets called at all
+struct in_addr MD5_ip(char *secret, struct in_addr ip);
#endif
diff --git a/src/common/mmo.h b/src/common/mmo.hpp
index 64e0523..151fa03 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.hpp
@@ -1,9 +1,9 @@
/// Global structures and defines
-#ifndef MMO_H
-#define MMO_H
+#ifndef MMO_HPP
+#define MMO_HPP
# include <time.h>
-# include "utils.h" // LCCWIN32
+# include "utils.hpp" // LCCWIN32
# define FIFOSIZE_SERVERLINK 256*1024
@@ -185,14 +185,14 @@ struct guild_position
int exp_mode;
};
-struct guild_alliance
+struct GuildAlliance
{
int opposition;
int guild_id;
char name[24];
};
-struct guild_explusion
+struct GuildExpulsion
{
char name[24];
char mes[40];
@@ -217,8 +217,8 @@ struct guild
char mes1[60], mes2[120];
int emblem_len, emblem_id;
char emblem_data[2048];
- struct guild_alliance alliance[MAX_GUILDALLIANCE];
- struct guild_explusion explusion[MAX_GUILDEXPLUSION];
+ GuildAlliance alliance[MAX_GUILDALLIANCE];
+ GuildExpulsion explusion[MAX_GUILDEXPLUSION];
struct guild_skill skill[MAX_GUILDSKILL];
};
@@ -280,4 +280,4 @@ enum
};
-#endif // MMO_H
+#endif // MMO_HPP
diff --git a/src/common/mt_rand.c b/src/common/mt_rand.cpp
index e4e8d12..676eca1 100644
--- a/src/common/mt_rand.c
+++ b/src/common/mt_rand.cpp
@@ -46,7 +46,7 @@
*/
#include <time.h>
-#include "mt_rand.h"
+#include "mt_rand.hpp"
#define N 624 // length of state vector
#define M 397 // a period parameter
@@ -70,6 +70,7 @@ void mt_seed (uint32_t seed)
for (int j = N; *s++ = x, --j; x *= 69069U);
}
+static
void mt_reload (void)
{
// if mt_seed has never been called
diff --git a/src/common/mt_rand.h b/src/common/mt_rand.hpp
index 84d32e5..c7bae4e 100644
--- a/src/common/mt_rand.h
+++ b/src/common/mt_rand.hpp
@@ -1,7 +1,7 @@
-#ifndef MT_RAND_H
-#define MT_RAND_H
+#ifndef MT_RAND_HPP
+#define MT_RAND_HPP
-# include "sanity.h"
+# include "sanity.hpp"
/// Initialize the generator (called automatically with time() if you don't)
void mt_seed (uint32_t seed);
@@ -21,4 +21,4 @@ uint32_t mt_random (void);
# define MRAND(mod) ((int)(mt_random() % (mod)))
# define MPRAND(add, mod) ((add) + MRAND(mod))
-#endif // MT_RAND_H
+#endif // MT_RAND_HPP
diff --git a/src/common/nullpo.c b/src/common/nullpo.cpp
index 8c7c405..67c839f 100644
--- a/src/common/nullpo.c
+++ b/src/common/nullpo.cpp
@@ -1,8 +1,10 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#include "nullpo.h"
+#include "nullpo.hpp"
+static void nullpo_info_core (const char *file, int line, const char *func);
+__attribute__((format(printf, 4, 0)))
static void nullpo_info_core (const char *file, int line, const char *func,
const char *fmt, va_list ap);
@@ -26,7 +28,7 @@ bool nullpo_chk (const char *file, int line, const char *func,
if (target)
return 0;
- nullpo_info_core (file, line, func, NULL, NULL);
+ nullpo_info_core (file, line, func);
return 1;
}
@@ -42,14 +44,11 @@ void nullpo_info_f (const char *file, int line, const char *func,
}
void nullpo_info (const char *file, int line, const char *func)
{
- nullpo_info_core (file, line, func, NULL, NULL);
+ nullpo_info_core (file, line, func);
}
/// Actual output function
-static void nullpo_info_core (const char *file, int line, const char *func,
- const char *fmt, va_list ap) __attribute__((format(printf, 4, 0)));
-static void nullpo_info_core (const char *file, int line, const char *func,
- const char *fmt, va_list ap)
+static void nullpo_info_core (const char *file, int line, const char *func)
{
if (!file)
file = "??";
@@ -57,6 +56,12 @@ static void nullpo_info_core (const char *file, int line, const char *func,
func = "unknown";
fprintf (stderr, "%s:%d: in func `%s': NULL pointer\n", file, line, func);
+}
+
+static void nullpo_info_core (const char *file, int line, const char *func,
+ const char *fmt, va_list ap)
+{
+ nullpo_info_core(file, line, func);
if (fmt && *fmt)
{
vfprintf (stderr, fmt, ap);
diff --git a/src/common/nullpo.h b/src/common/nullpo.hpp
index 9b33b4b..7aff691 100644
--- a/src/common/nullpo.h
+++ b/src/common/nullpo.hpp
@@ -1,6 +1,6 @@
/// return wrappers for unexpected NULL pointers
-#ifndef NULLPO_H
-#define NULLPO_H
+#ifndef NULLPO_HPP
+#define NULLPO_HPP
/// Comment this out to live dangerously
# define NULLPO_CHECK
@@ -39,7 +39,7 @@
# define nullpo_retr_f(ret, t, fmt, ...) t;
# endif // NULLPO_CHECK
-# include "sanity.h"
+# include "sanity.hpp"
/// Used by macros in this header
bool nullpo_chk (const char *file, int line, const char *func,
@@ -58,4 +58,4 @@ void nullpo_info_f (const char *file, int line, const char *func,
const char *fmt, ...)
__attribute__ ((format (printf, 4, 5)));
-#endif // NULLPO_H
+#endif // NULLPO_HPP
diff --git a/src/common/sanity.h b/src/common/sanity.hpp
index 168671f..7ffd077 100644
--- a/src/common/sanity.h
+++ b/src/common/sanity.hpp
@@ -1,8 +1,8 @@
/// return wrappers for unexpected NULL pointers
-#ifndef SANITY_H
-#define SANITY_H
-# if __STDC_VERSION__ < 199901L
-# error "Please compile in C99 mode"
+#ifndef SANITY_HPP
+#define SANITY_HPP
+# ifndef __cplusplus
+# error "Please compile in C++ mode"
# endif
# if __GNUC__ < 3
// I don't specifically know what version this requires,
@@ -22,15 +22,10 @@
# endif
/// A name for unused function arguments - can be repeated
-# define UNUSED UNUSED_IMPL(__COUNTER__)
-// Don't you just love the hoops the preprocessor makes you go through?
-# define UNUSED_IMPL(arg) UNUSED_IMPL2(arg)
-# define UNUSED_IMPL2(suffix) unused_ ## suffix __attribute__((unused))
-/// Convert conditions to use the bool type
-# include <stdbool.h>
+# define UNUSED /* empty works for C++ */
/// Convert type assumptions to use the standard types here
-# include <stdint.h>
+# include <cstdint>
/// size_t, NULL
-# include <stddef.h>
+# include <cstddef>
-#endif // SANITY_H
+#endif // SANITY_HPP
diff --git a/src/common/socket.c b/src/common/socket.cpp
index 67a5102..cc6e4b3 100644
--- a/src/common/socket.c
+++ b/src/common/socket.cpp
@@ -15,9 +15,9 @@
#include <fcntl.h>
#include <string.h>
-#include "mmo.h" // [Valaris] thanks to fov
-#include "socket.h"
-#include "utils.h"
+#include "mmo.hpp" // [Valaris] thanks to fov
+#include "socket.hpp"
+#include "utils.hpp"
fd_set readfds;
int fd_max;
diff --git a/src/common/socket.h b/src/common/socket.hpp
index b886df0..00f2df0 100644
--- a/src/common/socket.h
+++ b/src/common/socket.hpp
@@ -1,7 +1,7 @@
-#ifndef SOCKET_H
-#define SOCKET_H
+#ifndef SOCKET_HPP
+#define SOCKET_HPP
-# include "sanity.h"
+# include "sanity.hpp"
# include <stdio.h>
@@ -132,4 +132,4 @@ void fclose_ (FILE * fp);
FILE *fopen_ (const char *path, const char *mode);
bool free_fds (void);
-#endif // SOCKET_H
+#endif // SOCKET_HPP
diff --git a/src/common/timer.c b/src/common/timer.cpp
index 6795824..66aaa9b 100644
--- a/src/common/timer.c
+++ b/src/common/timer.cpp
@@ -6,8 +6,8 @@
#include <sys/socket.h>
#include <sys/time.h>
-#include "timer.h"
-#include "utils.h"
+#include "timer.hpp"
+#include "utils.hpp"
static struct TimerData *timer_data;
static uint32_t timer_data_max, timer_data_num;
diff --git a/src/common/timer.h b/src/common/timer.hpp
index e6a292c..fdda344 100644
--- a/src/common/timer.h
+++ b/src/common/timer.hpp
@@ -1,7 +1,7 @@
-#ifndef TIMER_H
-#define TIMER_H
+#ifndef TIMER_HPP
+#define TIMER_HPP
-# include "sanity.h"
+# include "sanity.hpp"
enum TIMER_TYPE
{
@@ -58,4 +58,4 @@ interval_t do_timer (tick_t tick);
-#endif // TIMER_H
+#endif // TIMER_HPP
diff --git a/src/common/utils.cpp b/src/common/utils.cpp
new file mode 100644
index 0000000..fbdd87e
--- /dev/null
+++ b/src/common/utils.cpp
@@ -0,0 +1,97 @@
+#include "utils.hpp"
+
+#include <cstring>
+#include <cstdio>
+#include <cstdlib>
+
+#include <netinet/in.h>
+
+//-----------------------------------------------------
+// Function to suppress control characters in a string.
+//-----------------------------------------------------
+int remove_control_chars (char *str)
+{
+ int i;
+ int change = 0;
+
+ for (i = 0; str[i]; i++)
+ {
+ if (0 <= str[i] && str[i] < 32)
+ {
+ str[i] = '_';
+ change = 1;
+ }
+ }
+
+ return change;
+}
+
+//---------------------------------------------------
+// E-mail check: return 0 (not correct) or 1 (valid).
+//---------------------------------------------------
+int e_mail_check (const char *email)
+{
+ char ch;
+ const char *last_arobas;
+
+ // athena limits
+ if (strlen (email) < 3 || strlen (email) > 39)
+ return 0;
+
+ // part of RFC limits (official reference of e-mail description)
+ if (strchr (email, '@') == NULL || email[strlen (email) - 1] == '@')
+ return 0;
+
+ if (email[strlen (email) - 1] == '.')
+ return 0;
+
+ last_arobas = strrchr (email, '@');
+
+ if (strstr (last_arobas, "@.") != NULL ||
+ strstr (last_arobas, "..") != NULL)
+ return 0;
+
+ for (ch = 1; ch < 32; ch++)
+ {
+ if (strchr (last_arobas, ch) != NULL)
+ {
+ return 0;
+ break;
+ }
+ }
+
+ if (strchr (last_arobas, ' ') != NULL ||
+ strchr (last_arobas, ';') != NULL)
+ return 0;
+
+ // all correct
+ return 1;
+}
+
+//-------------------------------------------------
+// Return numerical value of a switch configuration
+// on/off, english, français, deutsch, español
+//-------------------------------------------------
+int config_switch (const char *str)
+{
+ if (strcasecmp (str, "on") == 0 || strcasecmp (str, "yes") == 0
+ || strcasecmp (str, "oui") == 0 || strcasecmp (str, "ja") == 0
+ || strcasecmp (str, "si") == 0)
+ return 1;
+ if (strcasecmp (str, "off") == 0 || strcasecmp (str, "no") == 0
+ || strcasecmp (str, "non") == 0 || strcasecmp (str, "nein") == 0)
+ return 0;
+
+ return atoi (str);
+}
+
+const char *ip2str(struct in_addr ip, bool extra_dot)
+{
+ const uint8_t *p = (const uint8_t *)(&ip);
+ static char buf[17];
+ if (extra_dot)
+ sprintf(buf, "%d.%d.%d.%d.", p[0], p[1], p[2], p[3]);
+ else
+ sprintf(buf, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
+ return buf;
+}
diff --git a/src/common/utils.h b/src/common/utils.hpp
index 961d960..1097bf7 100644
--- a/src/common/utils.h
+++ b/src/common/utils.hpp
@@ -1,5 +1,8 @@
-#ifndef UTILS_H
-#define UTILS_H
+#ifndef UTILS_HPP
+#define UTILS_HPP
+
+#include "sanity.hpp"
+
/*
Notes about memory allocation in tmwAthena:
There used to be 3 sources of allocation: these macros,
@@ -15,4 +18,9 @@ future calls should either use this or depend on the coming segfault.
if (!((result) = (type *) realloc ((result), sizeof(type) * (number))))\
{ perror("SYSERR: realloc failure"); abort(); } else (void)0
-#endif //UTILS_H
+int remove_control_chars (char *str);
+int e_mail_check (const char *email);
+int config_switch (const char *str);
+const char *ip2str(struct in_addr ip, bool extra_dot = false);
+
+#endif //UTILS_HPP
diff --git a/src/common/version.h b/src/common/version.hpp
index 46165aa..d72f41e 100644
--- a/src/common/version.h
+++ b/src/common/version.hpp
@@ -1,8 +1,8 @@
/// Some constants to identify the version of (e)Athena
/// The values are different if the client connects (-1,'T','M','W',flags32)
// These numbers have never been changed while TMW
-#ifndef VERSION_H
-#define VERSION_H
+#ifndef VERSION_HPP
+#define VERSION_HPP
//When a server receives a 0x7530 packet from an admin connection,
//it sends an 0x7531 packet with the following bytes
# define ATHENA_MAJOR_VERSION 1 // Major Version
@@ -21,4 +21,4 @@
// and this as two bytes
# define ATHENA_MOD_VERSION 1052 // mod version (patch No.)
-#endif // VERSION_H
+#endif // VERSION_HPP