export php function: fastcommon_get_first_local_ip
parent
8f5c4fd3f7
commit
ba00a3bb12
3
HISTORY
3
HISTORY
|
|
@ -1,4 +1,7 @@
|
|||
|
||||
Version 1.22 2015-09-15
|
||||
* export php function: fastcommon_get_first_local_ip
|
||||
|
||||
Version 1.21 2015-09-14
|
||||
* ini_file_reader support annotation function
|
||||
* correct PTHREAD_MUTEX_ERRORCHECK define
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
%define LibFastcommonDevel libfastcommon-devel
|
||||
|
||||
Name: libfastcommon
|
||||
Version: 1.0.21
|
||||
Version: 1.0.22
|
||||
Release: 1%{?dist}
|
||||
Summary: c common functions library extracted from my open source projects FastDFS
|
||||
License: GPL
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ const zend_fcall_info empty_fcall_info = { 0, NULL, NULL, NULL, NULL, 0, NULL, N
|
|||
ZEND_FE(fastcommon_time33_hash, NULL)
|
||||
ZEND_FE(fastcommon_simple_hash, NULL)
|
||||
ZEND_FE(fastcommon_get_line_distance_km, NULL)
|
||||
ZEND_FE(fastcommon_get_first_local_ip, NULL)
|
||||
{NULL, NULL, NULL} /* Must be the last line */
|
||||
};
|
||||
|
||||
|
|
@ -274,3 +275,22 @@ ZEND_FUNCTION(fastcommon_get_line_distance_km)
|
|||
RETURN_DOUBLE(get_line_distance_km(lat1, lon1, lat2, lon2));
|
||||
}
|
||||
|
||||
/*
|
||||
string fastcommon_get_first_local_ip()
|
||||
return the first local ip
|
||||
*/
|
||||
ZEND_FUNCTION(fastcommon_get_first_local_ip)
|
||||
{
|
||||
int argc;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
if (argc != 0) {
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
"fastcommon_get_first_local_ip parameters count: %d is invalid",
|
||||
__LINE__, argc);
|
||||
RETURN_BOOL(false);
|
||||
}
|
||||
|
||||
RETURN_STRING(get_first_local_ip(), 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ ZEND_FUNCTION(fastcommon_gethostaddrs);
|
|||
ZEND_FUNCTION(fastcommon_time33_hash);
|
||||
ZEND_FUNCTION(fastcommon_simple_hash);
|
||||
ZEND_FUNCTION(fastcommon_get_line_distance_km);
|
||||
ZEND_FUNCTION(fastcommon_get_first_local_ip);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ int insert_into_local_host_ip(const char *client_ip)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void log_local_host_ip_addrs()
|
||||
void log_local_host_ip_addrs()
|
||||
{
|
||||
char *p;
|
||||
char *pEnd;
|
||||
|
|
@ -113,7 +113,7 @@ void load_local_host_ip_addrs()
|
|||
insert_into_local_host_ip(ip_addresses[k]);
|
||||
}
|
||||
|
||||
log_local_host_ip_addrs();
|
||||
//log_local_host_ip_addrs();
|
||||
//print_local_host_ip_addrs();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ void load_local_host_ip_addrs();
|
|||
bool is_local_host_ip(const char *client_ip);
|
||||
const char *get_first_local_ip();
|
||||
int insert_into_local_host_ip(const char *client_ip);
|
||||
void log_local_host_ip_addrs();
|
||||
void print_local_host_ip_addrs();
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
Loading…
Reference in New Issue