From 080942fc68337fe0211ceb0e8083d3a8aef74db3 Mon Sep 17 00:00:00 2001 From: lion Date: Mon, 27 Jun 2022 18:37:31 +0800 Subject: [PATCH] impl the search by string --- binding/c/xdb_searcher.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/binding/c/xdb_searcher.c b/binding/c/xdb_searcher.c index 692f15d..8a12119 100644 --- a/binding/c/xdb_searcher.c +++ b/binding/c/xdb_searcher.c @@ -54,8 +54,14 @@ XDB_PUBLIC(int) xdb_search(unsigned int ip, char *buffer) { return 0; } -XDB_PUBLIC(int) xdb_search_by_string(const char *ip, char *buffer) { - return 0; +XDB_PUBLIC(int) xdb_search_by_string(const char *str_ip, char *buffer) { + unsigned int ip = 0; + int errcode = check_ip(str_ip, &ip); + if (errcode != 0) { + return 10 + errcode; + } else { + return xdb_search(ip, buffer); + } } // get unsigned long (4bytes) from a specified buffer start from the specified offset