diff options
Diffstat (limited to 'src/qcommon/IpToCountryResolver.h')
-rw-r--r-- | src/qcommon/IpToCountryResolver.h | 30 |
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
+
+
+
+
|