mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
ip to long utils moved to Tools
Former-commit-id: 737257575dc1ac69ad9f1a284d7165077d7d6d4e
This commit is contained in:
parent
d57e6db0c0
commit
c24bea32a8
@ -125,6 +125,8 @@ our @EXPORT = qw(
|
|||||||
start_server_thread
|
start_server_thread
|
||||||
stop_server_threads
|
stop_server_threads
|
||||||
generate_agent_name_hash
|
generate_agent_name_hash
|
||||||
|
long_to_ip
|
||||||
|
ip_to_long
|
||||||
);
|
);
|
||||||
|
|
||||||
# ID of the different servers
|
# ID of the different servers
|
||||||
@ -1956,6 +1958,22 @@ sub rightrotate {
|
|||||||
return (0xFFFFFFFF & ($x << (32 - $c))) | ($x >> $c);
|
return (0xFFFFFFFF & ($x << (32 - $c))) | ($x >> $c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Returns IP address(v4) in longint format
|
||||||
|
###############################################################################
|
||||||
|
sub ip_to_long {
|
||||||
|
my $ip_str = shift;
|
||||||
|
return unpack "N", inet_aton($ip_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Returns IP address(v4) in longint format
|
||||||
|
###############################################################################
|
||||||
|
sub long_to_ip {
|
||||||
|
my $ip_long = shift;
|
||||||
|
return inet_ntoa pack("N", ($ip_long));
|
||||||
|
}
|
||||||
|
|
||||||
# End of function declaration
|
# End of function declaration
|
||||||
# End of defined Code
|
# End of defined Code
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user