summaryrefslogtreecommitdiff
path: root/src/qcommon/IpToCountryResolver.h
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-03-22 17:56:34 +0100
committerPaweł Redman <pawel.redman@gmail.com>2017-03-22 17:56:34 +0100
commit6a777afc079c2a8d3af3ecd2145fe8dd50567a39 (patch)
tree520f4489cebf8564ef6cb27064ceea45cbc005b3 /src/qcommon/IpToCountryResolver.h
Funko sources as released by Rotacak.HEADmaster
Diffstat (limited to 'src/qcommon/IpToCountryResolver.h')
-rw-r--r--src/qcommon/IpToCountryResolver.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/qcommon/IpToCountryResolver.h b/src/qcommon/IpToCountryResolver.h
new file mode 100644
index 0000000..cf97cf8
--- /dev/null
+++ b/src/qcommon/IpToCountryResolver.h
@@ -0,0 +1,30 @@
+#ifndef IPTOCOUNTRYRESOLVER_H_INCLUDED
+#define IPTOCOUNTRYRESOLVER_H_INCLUDED
+
+#define FULL_NAME_LENGTH 64
+
+typedef struct {
+ unsigned int ipFrom;
+ unsigned int ipTo;
+ char name2[2+1]; //1 for zero character (line end)
+ char name3[3+1];
+ char nameFull[FULL_NAME_LENGTH];
+} IpToCountryInfo;
+
+typedef struct {
+ unsigned int size;
+ IpToCountryInfo *infoArray;
+} IpToCountryList;
+
+unsigned int ipstr_to_int (const char *cp_arg);
+unsigned int ipbyte_to_int(unsigned int parts[4], unsigned int length);
+unsigned int LoadIp2CountryInfo(const char *fileName, IpToCountryList *infoList, int camelCaseNames);
+IpToCountryInfo *FindCountryInfoS(const char *ip_addr, IpToCountryList *infoList);
+IpToCountryInfo *FindCountryInfoB(unsigned int parts[4], unsigned int length, IpToCountryList *infoList);
+IpToCountryInfo *FindCountryInfoUI(unsigned int ip, IpToCountryList *infoList);
+
+#endif // IPTOCOUNTRYRESOLVER_H_INCLUDED
+
+
+
+