Skip to content

Commit be5fde0

Browse files
committed
Removed isIPv4 and isIPv6 (moved to wsjcpp-validators)
1 parent 0b194eb commit be5fde0

File tree

8 files changed

+0
-166
lines changed

8 files changed

+0
-166
lines changed

src/wsjcpp_core.cpp

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <streambuf>
1919
#include <sys/types.h>
2020
#include <sys/socket.h>
21-
#include <arpa/inet.h>
2221

2322
// ---------------------------------------------------------------------
2423

@@ -421,44 +420,6 @@ std::string WSJCppCore::createUuid() {
421420

422421
// ---------------------------------------------------------------------
423422

424-
bool WSJCppCore::isIPv4(const std::string& str) {
425-
int n = 0;
426-
std::string s[4] = {"", "", "", ""};
427-
for (int i = 0; i < str.length(); i++) {
428-
char c = str[i];
429-
if (n > 3) {
430-
return false;
431-
}
432-
if (c >= '0' && c <= '9') {
433-
s[n] += c;
434-
} else if (c == '.') {
435-
n++;
436-
} else {
437-
return false;
438-
}
439-
}
440-
for (int i = 0; i < 4; i++) {
441-
if (s[i].length() > 3) {
442-
return false;
443-
}
444-
int p = std::stoi(s[i]);
445-
if (p > 255 || p < 0) {
446-
return false;
447-
}
448-
}
449-
return true;
450-
}
451-
452-
// ---------------------------------------------------------------------
453-
454-
bool WSJCppCore::isIPv6(const std::string& str) {
455-
unsigned char buf[sizeof(struct in6_addr)];
456-
bool isValid = inet_pton(AF_INET6, str.c_str(), buf);
457-
return isValid;
458-
}
459-
460-
// ---------------------------------------------------------------------
461-
462423
unsigned long WSJCppCore::convertVoidToULong(void *p) {
463424
unsigned long ret = *(unsigned long *)p;
464425
return ret;

src/wsjcpp_core.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ class WSJCppCore {
4949

5050
static void initRandom();
5151
static std::string createUuid();
52-
static bool isIPv4(const std::string& str);
53-
static bool isIPv6(const std::string& str);
5452

5553
static unsigned long convertVoidToULong(void *p);
5654
static std::string getPointerAsHex(void *p);

unit-tests.wsjcpp/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ list (APPEND WSJCPP_SOURCES "../unit-tests.wsjcpp/src/unit_test_core_uuid.h")
3030
list (APPEND WSJCPP_SOURCES "../unit-tests.wsjcpp/src/unit_test_core_uuid.cpp")
3131
list (APPEND WSJCPP_SOURCES "../unit-tests.wsjcpp/src/unit_test_core_extract_filename.h")
3232
list (APPEND WSJCPP_SOURCES "../unit-tests.wsjcpp/src/unit_test_core_extract_filename.cpp")
33-
list (APPEND WSJCPP_SOURCES "../unit-tests.wsjcpp/src/unit_test_ip_v4.h")
34-
list (APPEND WSJCPP_SOURCES "../unit-tests.wsjcpp/src/unit_test_ip_v4.cpp")
35-
list (APPEND WSJCPP_SOURCES "../unit-tests.wsjcpp/src/unit_test_ip_v6.h")
36-
list (APPEND WSJCPP_SOURCES "../unit-tests.wsjcpp/src/unit_test_ip_v6.cpp")
3733
list (APPEND WSJCPP_SOURCES "../unit-tests.wsjcpp/src/unit_test_to_upper.h")
3834
list (APPEND WSJCPP_SOURCES "../unit-tests.wsjcpp/src/unit_test_to_upper.cpp")
3935
list (APPEND WSJCPP_SOURCES "../unit-tests.wsjcpp/src/unit_test_create_uuid.h")

unit-tests.wsjcpp/src/unit_test_ip_v4.cpp

Lines changed: 0 additions & 44 deletions
This file was deleted.

unit-tests.wsjcpp/src/unit_test_ip_v4.h

Lines changed: 0 additions & 13 deletions
This file was deleted.

unit-tests.wsjcpp/src/unit_test_ip_v6.cpp

Lines changed: 0 additions & 47 deletions
This file was deleted.

unit-tests.wsjcpp/src/unit_test_ip_v6.h

Lines changed: 0 additions & 13 deletions
This file was deleted.

wsjcpp.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ unit-tests:
5050
description: Check test generate uuid function
5151
- name: CoreExtractFilename
5252
description: Check function extract filenane from path
53-
- name: IpV4
54-
description: Check function isIPv4
55-
- name: IpV6
56-
description: Check function isIPv6
5753
- name: "ToUpper"
5854
description: "String to upper"
5955
- name: "CreateUuid"

0 commit comments

Comments
 (0)