Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
2d9f9ac6
Commit
2d9f9ac6
authored
Jul 22, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) move functions from pfsense-utils.inc to interfaces.inc
parent
2443b718
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
116 additions
and
115 deletions
+116
-115
interfaces.inc
src/etc/inc/interfaces.inc
+116
-0
pfsense-utils.inc
src/etc/inc/pfsense-utils.inc
+0
-115
No files found.
src/etc/inc/interfaces.inc
View file @
2d9f9ac6
...
...
@@ -5302,3 +5302,119 @@ function get_interface_info($ifdescr)
return
$ifinfo
;
}
function
convert_seconds_to_hms
(
$sec
){
$min
=
$hrs
=
0
;
if
(
$sec
!=
0
){
$min
=
floor
(
$sec
/
60
);
$sec
%=
60
;
}
if
(
$min
!=
0
){
$hrs
=
floor
(
$min
/
60
);
$min
%=
60
;
}
if
(
$sec
<
10
)
$sec
=
"0"
.
$sec
;
if
(
$min
<
10
)
$min
=
"0"
.
$min
;
if
(
$hrs
<
10
)
$hrs
=
"0"
.
$hrs
;
$result
=
$hrs
.
":"
.
$min
.
":"
.
$sec
;
return
$result
;
}
function
huawei_rssi_to_string
(
$rssi
)
{
$dbm
=
array
();
$i
=
0
;
$dbstart
=
-
113
;
while
(
$i
<
32
)
{
$dbm
[
$i
]
=
$dbstart
+
(
$i
*
2
);
$i
++
;
}
$percent
=
round
((
$rssi
/
31
)
*
100
);
$string
=
"rssi:
{
$rssi
}
level:
{
$dbm
[
$rssi
]
}
dBm percent:
{
$percent
}
%"
;
return
$string
;
}
function
huawei_mode_to_string
(
$mode
,
$submode
)
{
$modes
[
0
]
=
"None"
;
$modes
[
1
]
=
"AMPS"
;
$modes
[
2
]
=
"CDMA"
;
$modes
[
3
]
=
"GSM/GPRS"
;
$modes
[
4
]
=
"HDR"
;
$modes
[
5
]
=
"WCDMA"
;
$modes
[
6
]
=
"GPS"
;
$submodes
[
0
]
=
"No Service"
;
$submodes
[
1
]
=
"GSM"
;
$submodes
[
2
]
=
"GPRS"
;
$submodes
[
3
]
=
"EDGE"
;
$submodes
[
4
]
=
"WCDMA"
;
$submodes
[
5
]
=
"HSDPA"
;
$submodes
[
6
]
=
"HSUPA"
;
$submodes
[
7
]
=
"HSDPA+HSUPA"
;
$submodes
[
8
]
=
"TD-SCDMA"
;
$submodes
[
9
]
=
"HSPA+"
;
$string
=
"
{
$modes
[
$mode
]
}
,
{
$submodes
[
$submode
]
}
Mode"
;
return
$string
;
}
function
huawei_service_to_string
(
$state
)
{
$modes
[
0
]
=
"No"
;
$modes
[
1
]
=
"Restricted"
;
$modes
[
2
]
=
"Valid"
;
$modes
[
3
]
=
"Restricted Regional"
;
$modes
[
4
]
=
"Powersaving"
;
$string
=
"
{
$modes
[
$state
]
}
Service"
;
return
$string
;
}
function
huawei_simstate_to_string
(
$state
)
{
$modes
[
0
]
=
"Invalid SIM/locked"
;
$modes
[
1
]
=
"Valid SIM"
;
$modes
[
2
]
=
"Invalid SIM CS"
;
$modes
[
3
]
=
"Invalid SIM PS"
;
$modes
[
4
]
=
"Invalid SIM CS/PS"
;
$modes
[
255
]
=
"Missing SIM"
;
$string
=
"
{
$modes
[
$state
]
}
State"
;
return
$string
;
}
function
zte_rssi_to_string
(
$rssi
)
{
return
huawei_rssi_to_string
(
$rssi
);
}
function
zte_mode_to_string
(
$mode
,
$submode
)
{
$modes
[
0
]
=
"No Service"
;
$modes
[
1
]
=
"Limited Service"
;
$modes
[
2
]
=
"GPRS"
;
$modes
[
3
]
=
"GSM"
;
$modes
[
4
]
=
"UMTS"
;
$modes
[
5
]
=
"EDGE"
;
$modes
[
6
]
=
"HSDPA"
;
$submodes
[
0
]
=
"CS_ONLY"
;
$submodes
[
1
]
=
"PS_ONLY"
;
$submodes
[
2
]
=
"CS_PS"
;
$submodes
[
3
]
=
"CAMPED"
;
$string
=
"
{
$modes
[
$mode
]
}
,
{
$submodes
[
$submode
]
}
Mode"
;
return
$string
;
}
function
zte_service_to_string
(
$state
)
{
$modes
[
0
]
=
"Initializing"
;
$modes
[
1
]
=
"Network Lock error"
;
$modes
[
2
]
=
"Network Locked"
;
$modes
[
3
]
=
"Unlocked or correct MCC/MNC"
;
$string
=
"
{
$modes
[
$state
]
}
Service"
;
return
$string
;
}
function
zte_simstate_to_string
(
$state
)
{
$modes
[
0
]
=
"No action"
;
$modes
[
1
]
=
"Network lock"
;
$modes
[
2
]
=
"(U)SIM card lock"
;
$modes
[
3
]
=
"Network Lock and (U)SIM card Lock"
;
$string
=
"
{
$modes
[
$state
]
}
State"
;
return
$string
;
}
src/etc/inc/pfsense-utils.inc
View file @
2d9f9ac6
...
...
@@ -435,26 +435,6 @@ function is_pppoe_server_enabled() {
return
$pppoeenable
;
}
function
convert_seconds_to_hms
(
$sec
){
$min
=
$hrs
=
0
;
if
(
$sec
!=
0
){
$min
=
floor
(
$sec
/
60
);
$sec
%=
60
;
}
if
(
$min
!=
0
){
$hrs
=
floor
(
$min
/
60
);
$min
%=
60
;
}
if
(
$sec
<
10
)
$sec
=
"0"
.
$sec
;
if
(
$min
<
10
)
$min
=
"0"
.
$min
;
if
(
$hrs
<
10
)
$hrs
=
"0"
.
$hrs
;
$result
=
$hrs
.
":"
.
$min
.
":"
.
$sec
;
return
$result
;
}
/* Compute the total uptime from the ppp uptime log file in the conf directory */
function
get_ppp_uptime
(
$port
){
...
...
@@ -1036,98 +1016,3 @@ function calculate_ipv6_delegation_length($if) {
return(
$pdlen
);
}
function huawei_rssi_to_string(
$rssi
) {
$dbm
= array();
$i
= 0;
$dbstart
= -113;
while(
$i
< 32) {
$dbm[$i]
=
$dbstart
+ (
$i
* 2);
$i
++;
}
$percent
= round((
$rssi
/ 31) * 100);
$string
= "
rssi
:
{
$rssi
}
level
:
{
$dbm
[
$rssi
]}
dBm
percent
:
{
$percent
}
%
";
return
$string
;
}
function huawei_mode_to_string(
$mode
,
$submode
) {
$modes[0]
= "
None
";
$modes[1]
= "
AMPS
";
$modes[2]
= "
CDMA
";
$modes[3]
= "
GSM
/
GPRS
";
$modes[4]
= "
HDR
";
$modes[5]
= "
WCDMA
";
$modes[6]
= "
GPS
";
$submodes[0]
= "
No
Service
";
$submodes[1]
= "
GSM
";
$submodes[2]
= "
GPRS
";
$submodes[3]
= "
EDGE
";
$submodes[4]
= "
WCDMA
";
$submodes[5]
= "
HSDPA
";
$submodes[6]
= "
HSUPA
";
$submodes[7]
= "
HSDPA
+
HSUPA
";
$submodes[8]
= "
TD
-
SCDMA
";
$submodes[9]
= "
HSPA
+
";
$string
= "
{
$modes
[
$mode
]},
{
$submodes
[
$submode
]}
Mode
";
return
$string
;
}
function huawei_service_to_string(
$state
) {
$modes[0]
= "
No
";
$modes[1]
= "
Restricted
";
$modes[2]
= "
Valid
";
$modes[3]
= "
Restricted
Regional
";
$modes[4]
= "
Powersaving
";
$string
= "
{
$modes
[
$state
]}
Service
";
return
$string
;
}
function huawei_simstate_to_string(
$state
) {
$modes[0]
= "
Invalid
SIM
/
locked
";
$modes[1]
= "
Valid
SIM
";
$modes[2]
= "
Invalid
SIM
CS
";
$modes[3]
= "
Invalid
SIM
PS
";
$modes[4]
= "
Invalid
SIM
CS
/
PS
";
$modes[255]
= "
Missing
SIM
";
$string
= "
{
$modes
[
$state
]}
State
";
return
$string
;
}
function zte_rssi_to_string(
$rssi
) {
return huawei_rssi_to_string(
$rssi
);
}
function zte_mode_to_string(
$mode
,
$submode
) {
$modes[0]
= "
No
Service
";
$modes[1]
= "
Limited
Service
";
$modes[2]
= "
GPRS
";
$modes[3]
= "
GSM
";
$modes[4]
= "
UMTS
";
$modes[5]
= "
EDGE
";
$modes[6]
= "
HSDPA
";
$submodes[0]
= "
CS_ONLY
";
$submodes[1]
= "
PS_ONLY
";
$submodes[2]
= "
CS_PS
";
$submodes[3]
= "
CAMPED
";
$string
= "
{
$modes
[
$mode
]},
{
$submodes
[
$submode
]}
Mode
";
return
$string
;
}
function zte_service_to_string(
$state
) {
$modes[0]
= "
Initializing
";
$modes[1]
= "
Network
Lock
error
";
$modes[2]
= "
Network
Locked
";
$modes[3]
= "
Unlocked
or
correct
MCC
/
MNC
";
$string
= "
{
$modes
[
$state
]}
Service
";
return
$string
;
}
function zte_simstate_to_string(
$state
) {
$modes[0]
= "
No
action
";
$modes[1]
= "
Network
lock
";
$modes[2]
= "
(
U
)
SIM
card
lock
";
$modes[3]
= "
Network
Lock
and
(
U
)
SIM
card
Lock
";
$string
= "
{
$modes
[
$state
]}
State
";
return
$string
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment