Unified Settings

 

Linux, being a derivative from Unix, inherits the nightmare for users -- lacking of the standard for storing application settings. It is not uncommon for software in Linux using 5 private setting files (e.g. boa). To manage the system, you need to maintain a list to track who uses which and where they are.

 

Seeing this, Microsoft unified all system settings on Win16 into several files, e.g. "system.ini" and "win.ini". Later, they enhanced the mechanism further to a single Registry database on Win32 platforms.

 

FIles

 

Here, we adopted the Win16 system.ini model to put all settings to:

 

/flash/config/app.ini

current configuration

/flash/config/app-default.ini

default configuration

 

During runtime, for technial reasons, instead of accesing directly from jffs2 FLASH, the reading and writing of settings are redirected to the copy in RAM disk.

 

/var/run/app.ini

runtime copy

 

Operations

 

The setting management functions (in app/lib/lib.c) use similar syntax as Windows' ones. Windows programmers should feel comfortable to use the model.

 

Functions

Windows16 APIs

ReadIni

GetProfileString

WriteIni

WriteProfileString

ReadIniInt

GetProfileInt

StoreIni

No counterpart.

copy runtime to current

RestoreDefaultIni

No counterpart

copy default to current and runtime

 

The Web-based configuration is conducted by (app/cgi/cgi.c) which uses the above 5 functions to manage all settings.

 

Settings

 

The setting file app.ini is a pain text file which can be edited by any editor (Windows notepad, Linux gedit, vi, etc…). To modify its contents manually, you can download it by FTP, edit it, and upload it by FTP. The general syntax of the settings are:

 

[Section]

Key=Value

 

Section

case insensitive

Key

case insensitive

Value

case sensitive

 

[System]

DeviceName=eLinkW90

Http=1

HttpPort=80

HttpDir=/flash/www

User=admin

Password=

SSL=0

Telnet=1

Ftp=1

 

The followings are typical settings:

 

[System]

 

DeviceName

Used in web banner and authentication dialog

Http

HTTP server control. 0=disable, 1=enable

HttpPort

HTTP port number. Normally 80.

HttpDir

root of HTTP directory

HttpSysDir

web for system administrator account

HttpAppDir

web for application controlled accounts

UserName

administrator name

Password

administrator password

PasswordAlt

alternative administrator password for HTTP

SSL

SSL HTTP (not used yet)

Telnet

Telnet server control. 0=disable, 1=enable

Ftp

FTP server control. 0=disable, 1=enable

 

[Network]

 

LinkSpeed

0=auto, 1=10M full, 2=100M full, 3=10M half, 4=100M half

IP

Device's IP address

NetMask

subnet mask

Gateway

default gateway

DNS

DNS server

DHCP

DHCP client. 0=disable, 1=enable

 

[NTP]

 

NTP

NTP client control. 0=disable, 1=enable

NtpServer

Default NTP server

UsrServer

User specified NTP server

TimeOffset

Timezone adjustment in minutes

London = 0

New York = -300

Taipei = +480

 

[DDNS]

 

Provider

0 = disable, 1 = www.no-ip.com

User

vendor specific

Password

vendor specific

Hostname

vendor specific

Domain

vendor specific

 

 

[SIO 1/2]

 

SioPort

server mode socket listen port

HostIP

client / UDP mode remote destination address

HostPort

client / UDP mode remote destination port

SioMode

0=server, 1=client, 2=UDP

SioBaud

0=300 bps

1=600 bps

5=9600 bps

9=115200 bps

10=230400 bps

SioParity

0=None, 1=Even, 2=Odd, 3=Mark, 4=Space

SioBits

0=5 bit, 1=6 bit, 2=7 bit, 3=8 bit

SioStops

0=1 bit, 1=2 bit

SioFlow

0=None, 1=RTS/CTS flow control

PktMode

0=None, 1=Packet mode enable

Inactive

Timeout for inactivity in minutes.

0=no timeout