2008年4月28日 星期一

kphone / QT

kphone project include
IM(instant messenger) && SI (SIP user agent)

QT library is a
Cross-Platform Rich Client Development Framework

Qt is a cross-platform rich application development framework. It includes:

* An intuitive, easy to use class library
* Integrated development tools
* Cross-platform development on desktop and embedded platforms
* Support for C++ and Java development

SCTP protocol

SCTP, Stream Control Transmission Protocol

SCTP is designed to transport PSTN signaling messages over IP networks, but is capable of broader applications. SCTP is a reliable transport protocol operating on top of a connectionless packet network such as IP. It offers the following services to its users:

* Acknowledged error-free non-duplicated transfer of user data.
* Data fragmentation to conform to discovered path MTU size.
* Sequenced delivery of user messages within multiple streams, with an option for order-of-arrival delivery of individual user messages.
* Optional bundling of multiple user messages into a single SCTP packet.
* Network-level fault tolerance through supporting of multi-homing at either or both ends of an association.

The design of SCTP includes appropriate congestion avoidance behavior and resistance to flooding and masquerade attacks.

the lksctp Project! (linux sctp project)
The Linux Kernel Stream Control Transmission Protocol (lksctp) project is an implementation of the Stream Control Transmission Protocol (SCTP) in the Linux kernel. The primary goal of this project is to provide user applications with a viable SCTP solution by incorporating features and functions defined in the following documents:

* Stream Control Transmission Protocol (IETF RFC 2960)
* SCTP Checksum Change (IETF RFC 3309)
* SCTP Specification Errata and Issues (IETF RFC 4460)
* Sockets API Extensions for SCTP
* SCTP Partial Reliability Extension (IETF RFC 3758)
* SCTP Dynamic Address Reconfiguaration
* An Introduction to the Stream Control Transmission Protocol (IETF RFC 3286)
* Stream Control Transmission Protocol Applicability Statement (IETF RFC 3257)

Stream Control Transmission Protocol (SCTP) is a reliable, message-oriented, multihomed transport protocol. Developed by the IETF SIGTRAN working group to transport SS7 over IP, it is now the third general-purpose transport developed by the IETF.

We can use the SSRC field of RTP to identify an unique rtp session. The known implemented software is kphone.

linux remote control

Linux remote control server package
-- xrdp

Linux remote control client package
-- rdesktop
http://xrdp.sourceforge.net/
xrdp: An open source remote desktop protocol(rdp) server

linux vnc experience

vnc config -- /root/.vnc/xstartup
--------------------------------------------------------------------
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &
#kde-session &
#twm &
--------------------------------------------------------------------


stop vnc session
vncserver -kill :1

start vncserver
vncserver

restart the vncserver
service vncserver restart ==> this command seems not work for me? I don't know why?

vncserver was a Perl script, the real executable file was Xvnc

2008年4月24日 星期四

Catch three fishes while you are free

If you are struggling in the water. You must try to catch three fishes while you are free from the water. Get one fish by each hand, and get another one bitten by your mouse.

eXosip2 segementation fault experience

I had ever installed the osip2/eXosip2 library to test my program, but it always cause the Segmentation fault while I am running my sip user agent program.

The osip2/eXosip2 library versions are as follows:
osip2: libosip2-3.0.3-2
eXosip2: libeXosip2-3.0.3-3

The libraries include libeXosip2, libosip2, libosipparser2 as follow listing
# ls -la /usr/lib/libosip* /usr/lib/libeXosip2.* | awk '{print $8}'
/usr/lib/libeXosip2.a
/usr/lib/libeXosip2.la
/usr/lib/libeXosip2.so
/usr/lib/libeXosip2.so.4
/usr/lib/libeXosip2.so.4.2.0
/usr/lib/libosip2.a
/usr/lib/libosip2.la
/usr/lib/libosip2.so
/usr/lib/libosip2.so.2
/usr/lib/libosip2.so.2.2.0
/usr/lib/libosipparser2.a
/usr/lib/libosipparser2.la
/usr/lib/libosipparser2.so
/usr/lib/libosipparser2.so.2
/usr/lib/libosipparser2.so.2.2.0


When I run the sip ua program, it will cause Segmentation fault while receive the SIP reply message "407 Proxy Authentication Required".

SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP
[Other sip headers are omitted]

| INFO1 | Message received from: A.B.C.D:5060
| INFO1 | Message received from: A.B.C.D:5060
| INFO3 | MESSAGE REC. CALLID:951246000
| INFO1 | Message received from: A.B.C.D:5060
| INFO3 | cb_rcv4xx (id=1)
| INFO2 | eXosip: timer sec:5 usec:10000!

Segmentation fault (core dumped)

The gdb bt (backtrace) dumping is listed below

Program terminated with signal 11, Segmentation fault.
#0 0x0015298c in osip_trace@plt () from /usr/lib/libeXosip2.so.4
(gdb) bt
#0 0x0015298c in osip_trace@plt () from /usr/lib/libeXosip2.so.4
#1 0x0016e722 in __eXosip_create_proxy_authorization_header (wa=0x9eab608, rquri=0x9eab940 "sip:d-life.org",
username=0x9ea71e2 "admin", passwd=0x9ea7214 "openserrw", ha1=0x9ea7246 "", auth=0xbfd87dac,
method=0x9eaa258 "REGISTER", pCNonce=0x17cd9d "0a4f113b", iNonceCount=1) at jauth.c:484
#2 0x001556c9 in eXosip_add_authentication_information (req=0x9eaa268, last_response=0x9eab3a0) at eXosip.c:1248
#3 0x00158952 in _eXosip_register_build_register (jr=0x9ea72b8, _reg=0xbfd87e94) at eXregister_api.c:145
#4 0x00158e48 in eXosip_register_send_register (rid=1, reg=0x0) at eXregister_api.c:294
#5 0x001531ca in _eXosip_retry_register_with_auth (je=0x9eaa7f8) at eXosip.c:255
#6 0x0015362b in eXosip_retry_with_auth (je=0x9eaa7f8) at eXosip.c:385
#7 0x001538a6 in eXosip_default_action (je=0x9eaa7f8) at eXosip.c:450
#8 0x0804b704 in main (argc=3, argv=0xbfd8a014) at sip8d.c:139

The Segmentation fault is caused by the signal 11 (SIGSEGM), and was triggered from the eXosip2 eXosip_default_action api (frame 7). And the error reference seems to happen in the osip2/osipparser2 library (frame 1).

definition of /usr/include/bits/signum.h (some pieces of the definition)
/* Signals. */
#define SIGHUP 1 /* Hangup (POSIX). */
#define SIGINT 2 /* Interrupt (ANSI). */
#define SIGQUIT 3 /* Quit (POSIX). */
#define SIGILL 4 /* Illegal instruction (ANSI). */
#define SIGTRAP 5 /* Trace trap (POSIX). */
#define SIGABRT 6 /* Abort (ANSI). */
#define SIGIOT 6 /* IOT trap (4.2 BSD). */
#define SIGBUS 7 /* BUS error (4.2 BSD). */
#define SIGFPE 8 /* Floating-point exception (ANSI). */
#define SIGKILL 9 /* Kill, unblockable (POSIX). */
#define SIGUSR1 10 /* User-defined signal 1 (POSIX). */
#define SIGSEGV 11 /* Segmentation violation (ANSI). */
#define SIGUSR2 12 /* User-defined signal 2 (POSIX). */
#define SIGPIPE 13 /* Broken pipe (POSIX). */
#define SIGALRM 14 /* Alarm clock (POSIX). */
#define SIGTERM 15 /* Termination (ANSI). */

From frame 0, we can know that libeXosip2 seems something wrong with the osip_trace

But I can not get the idea (help?) from the frame 0 of the gdb backtrace. beacause when I try to list the original source code of backtrace frame 0. It just show me the
original code of the sip user agent.
(gdb) f 0
#0 0x0015298c in osip_trace@plt () from /usr/lib/libeXosip2.so.4
(gdb) list
4 */
5
6
7 int main (int argc, char *argv[])
8 {
9 sipconf *sc;
10 siprunconf *sr;
11
12 char buf[ML], tmp[ML];
13 int ch, i, call=0;

Another point, we can show the member libraries of the libeXosip2 shared library by using nm.

# nm -l -o /usr/lib/libeXosip2.so.4 | grep osip_trace
/usr/lib/libeXosip2.so.4: U osip_trace

Here we can discover that osip_trace is an undefined symbol (reference to the nm man page, "U" The symbol is undefined)

The final solution was using the newest library of the osip2/eXosip2 libraries as follow listing

Correct libraries combination (No segmentation fault)
osip2: libosip2-3.1.0
eXosip2: libeXosip2-3.1.0

Error libraries combination (Cause the segmentation fault)
osip2: libosip2-3.0.3-2
eXosip2: libeXosip2-3.0.3-3

I guess the possible reason was that osip2 and eXosip2 library have something dependency that library version number must the same to guarantee the proper working. Because the eXosip2 library is based on the osip2 library stack to develop. Maybe the eXosip2 developers doesn't consider the backward compatibility very carefully to cause this segmentation fault condition.

2008年4月23日 星期三

How to build openssl shared library?

How to build openssl shared library? Just follow the commands below
# ./configure --prefix=/usr/share/openssl shared
# ./Configure shared linux-generic32
# make
# make test
# make install

You can reference the INSTALL file for the details.

Linux Command - yum

yum was original developed by the Duke University
http://linux.duke.edu/projects/
http://yum.baseurl.org/

# install the package
# yum install mysql.i386

list repository available
# yum list all/available/updates
we can also use similar text to search the available packages
# yum list git
updates 100% |=========================| 2.6 kB 00:00
fedora 100% |=========================| 2.1 kB 00:00
Available Packages
git.i386 1.5.3.4-1.fc8 fedora


list local installed packages
# yum list installed

remove package
# yum remove openssl.i686

show the information of the specified package
# yum info openssl.i686

// We need to install yum-utils.noarch package to get the repoquery, yumdownloader tools
# yum install yum-utils.noarch

list all the files provided by a specified yum package
e.g.
# repoquery --list openssl.i686

Just download the rpm package, no need to install it
# /usr/bin/yumdownloader nc (No need to spend the full file name, just use the name-prefix is enough)
# /usr/bin/yumdownloader tftp.i386

Search a specific tool in which rpm file. We can search from the following site.
http://rpm.pbone.net/

# yum list all | grep ncftp
Error: Cannot retrieve repository metadata (repomd.xml) for repository: fedora. Please verify its path and try again

1.
If you are fail to connect to the yum server. Sometimes this is because you don't probably set the name server in the /etc/resolv.conf
Try to ping the yum server

# ping download.fedora.redhat.com

After setting the /etc/resolv.conf
nameserver 168.95.1.1
nameserver 140.113.1.1

We can continue to use yum as normally.

2.
yum clean all

add yum repository files to the yum configuration file pool, e.g. add pptp.repo of pptp, than we can retrieve others files/progs from the pptp yum repository
# cat /etc/yum.repos.d/pptp.repo


# cat /etc/yum.repos.d/pptp.repo
[pptp-stable]
name=PPTP Client stable repository for Fedora Core $releasever ($basearch)
#baseurl=http://pptpclient.sourceforge.net/yum/stable/fc$releasever/$basearch
mirrorlist=http://pptpclient.sourceforge.net/yum/stable/mirrorlist-pptp-stable-fc$releasever
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PPTP

[pptp-beta]
omit...

[poptop-stable]
omit...

[poptop-beta]
omit...

# yum --enablerepo=pptp-stable install pptpconfig // "pptp-stable" indicate the tag in the yum config

remove openssl library through yum

First try to remove the original openssl packages (by using yum).

# yum list installed | grep openssl
openssl.i686 0.9.8b-17.fc8 installed
openssl-devel.i386 0.9.8b-17.fc8 installed
[root@localhost openssl-0.9.8g]# yum remove openssl-devel.i386
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package openssl-devel.i386 0:0.9.8b-17.fc8 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Removing:
openssl-devel i386 0.9.8b-17.fc8 installed 4.3 M

Transaction Summary
=============================================================================
Install 0 Package(s)
Update 0 Package(s)
Remove 1 Package(s)

Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing : openssl-devel ######################### [1/1]

Removed: openssl-devel.i386 0:0.9.8b-17.fc8
Complete!


openssl contains the following packages
libcrypto.so.6
libssl.so.6
openssl
libcamel-1.2.so.10
libcamel-provider-1.2.so.10
libebook-1.2.so.9
libecal-1.2.so.7
libedata-book-1.2.so.2
libedata-cal-1.2.so.6
libedataserver-1.2.so.9
libedataserverui-1.2.so.8
libegroupwise-1.2.so.13
libexchange-storage-1.2.so.3
evolution-data-server

Linux System - vMware

Sometimes we will encounter that vMware image was unable to boot correctly. According to the vMware message that it indicate there are some lock in the vMware image system. How do we do in this situation?
A. Go directly to the image folder, as the following path
/var/lib/vmware/Virtual Machines/WinXP_CH/

remove the like the following file
# rm -f "Windows XP Professional.vmdk.WRITELOCK"
And then we can boot the vMware image correctly.

If you specify the network interface directly in the vMware software, you must extra enable the following option in the vMware. Or the network interface will fail to connect the physical network interface.
Note: you can verify the network interface status by execute the "ifconfig" command. And then check if the RUNNING status is appeared or not.

By enable the vMware network connectivity, you can simply follow the actions below.

1. Right Click the vMware guest client window. And select the "Settings".
2. Select "Hardware"
3. Select "Ethernet1"
4. Enable Device/Connected checkbox
5. It's finished


vMware network include
* Bridge (vmnet0)
* NAT (vmnet8)
* Host-Only (vmnet1)

Bridge Network:
















NAT Network:

















Host Only Network:

2008年4月22日 星期二

Windows Live mail path

If you want to backup the windows Live mail manually, you can simply backup the following folder

C:\Documents and Settings\user_name\Local Settings\Application Data\Microsoft\Windows Live Mail\e-mail-address\Inbox

2008年4月21日 星期一

bash, tcsh shell programming

#!/bin/tcsh
set loopcount = 0
set result = 0
while ($loopcount < 5)
set loopcount = ’expr $loopcount + 1’
set increment = ’expr $loopcount \* 2’
set result = ’expr $result + $increment’

end

echo "result is $result"


TCSH 的assign 利用 set 即可

cvs (WinCVS) client manual command (include setting the various enviroment variables)

cvs -d :ext:user_name@cvs_server:/repository/path cvs_commands

// checkout bugzilla cvs mainline
# cvs -d:pserver:anonymous@cvs-mirror.mozilla.org:2401/cvsroot checkout -P -d bugzilla Bugzilla

// checkout bugzilla cvs Bugzilla_Stable branch
# cvs -d:pserver:anonymous@cvs-mirror.mozilla.org:2401/cvsroot checkout -P -d bugzilla -rBugzilla_Stable Bugzilla

Another method that we can login once, and then execute all the cvs commands directly.

The following example is captured from the
http://www.horde.org/source/using.php

Anonymous CVS

Anonymous CVS access is available using pserver. To log in to the server, use the following commands:


sh, ksh, bash, zsh:

export CVSROOT=:pserver:cvsread@anoncvs.horde.org:/repository
CVSROOT=/path/to/cvsroot; export CVSROOT # Bourne syntax

csh, tcsh:

setenv CVSROOT :pserver:cvsread@anoncvs.horde.org:/repository
setenv CVSROOT /path/to/cvsroot          # C-shell syntax


csh: % setenv CVSROOT ":pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot"
win: > SET CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot


then for all:

cvs login
(password: 'horde')


Use CVS/WinCVS to chekout project

# cvs -d :ssh:UserName@CVSServerIP:CVSPort:/home/cvs checkout -P -- ProjectName

2008年4月2日 星期三

Edit static route in the linux/windows

Windows
** add a specified route
C:\>route ADD 172.16.0.0 MASK 255.255.0.0 172.17.0.254
METRIC 20 IF 4

Sometimes if we have dual interfaces in the windows host, and we get 2 DHCP-addresses/gateways from these two interfaces. So we want to disable one gateway, and only leave one gateway in the windows routing table. We can issue the following command...
** delete the default gateway of windows
C:\Documents and Settings\vincentlin>route DELETE 0.0.0.0 MASK 0.0.0.0 192.168.
.1

Linux
# route add -net 172.16.0.0/16 gw 172.17.0.254
or
# route add -net 172.16.0.0 netmask 255.255.0.0 gw 172.17.0.254

# route add default gateway A.B.C.D

DNS nameserver list

Hinet
168.95.1.1
168.95.192.1

NCTU
140.113.1.1
140.113.23.1

2008年4月1日 星期二

file permission experience

srwxrwxrwx 1 root root 0 Apr 2 13:29 X0
srwxrwxrwx 1 root root 0 Apr 2 13:23 X1
srwxrwxrwx 1 root root 0 Apr 2 13:23 X2
srwxrwxrwx 1 root root 0 Apr 2 13:23 X3
srwxrwxrwx 1 root root 0 Apr 2 13:26 X4
srwxrwxrwx 1 root root 0 Apr 2 13:27 X5
srwxrwxrwx 1 root root 0 Apr 2 13:29 X6
srwxrwxrwx 1 root root 0 Apr 2 13:31 X7

here first character "s" means socket

There are some other bits in the Linux File permission
* setuid
-rwsrwxrwt

* setgid
-rwxrwsrwt

* sticky bit
drwxrwxrwt

How to change the special file permission?
# chmod 0700 file-name clean all the special permission bits
# chmod 1700 file-name set setuid bit
# chmod 2700 file-name set setgid bit
# chmod 4700 file-name set sticky bit