2007年8月29日 星期三

Gmail 設定方式

(1) 瀏覽 Gmail 的 Mail Setting, 選擇 enable POP download。

開啟知識總理的郵件模組,至郵件帳戶新增Gmail帳戶,並依下述(2)-(6)步驟填寫資料。

(2)收件伺服器 (POP3) –
pop.gmail.com
使用 SSL: Yes
通信埠 : 995

(3) 寄件伺服器 (SMTP) –
smtp.gmail.com
使用 SSL: Yes
通信埠: 465 or 587 (請自己嘗試選擇讓寄件速度較快的通信埠,我建議選用 587)
使用認證: Yes(勾選我的伺服器需要認證)

(4) 帳戶名稱: 您的 Gmail 帳戶名稱(包括 '@gmail.com')

(5) 電子郵件地址: 您的 Gmail 電子郵件地址 ( '您的 Gmail 帳戶名稱@gmail.com')

(6) 密碼: 您的 Gmail 密碼

注意:

(a) 不要在寄件與收件伺服器上勾選 "使用安全密碼驗證登入"。
(b) 如果您使用垃圾郵件過濾模式預覽Gmail並自Gmail讀取郵件的訊息內容,則當您再次按下預覽或欲將郵件收至本地端資料夾,您將無法再度看到或收取那些已經被"讀取"的郵件。別擔心! 那些郵件不會消失或被刪除,這是因為Gmail會將被讀取過的郵件自動轉至Gmail上的Inbox資料夾,稍後您可以登入網頁 Gmail再度讀取之。您可以直接使用本地端資料夾模式來下載或接收Gmail的郵件訊息,這樣的操作模式下就跟其他的客戶端電 子郵件軟體完全一樣。
(c) 目前Gmail的繁體中文介面、信件內容之繁體中文解碼似乎還在測試階段,所以有時候可能會在收信轉碼時產生亂碼。

2007年8月20日 星期一

Big/Little endian

在ethereal 所錄的封包中看到下面的字串, 由於一般RFC protocol所使用的byte order 都是big endian,
37ea ==> big endian 所以真正的value為 37ea

如果在程式當中利用 ntohs (network to host short) 會存成ea37 (little endian format), 存在x86的記憶體當中

當我們print 這個data時, 會嗅出其真正的涵義, 也就是real value, not storing value

2007年8月14日 星期二

很棒, 資料很豐富的network wiki sites

http://linux-net.osdl.org/index.php/Main_Page

wiki Computer Network Group
http://en.wikipedia.org/wiki/Computer_Network

2007年8月8日 星期三

pscp howto

將 192.168.XX.YY server 的檔案 dump1 抓下來, 存成檔名 dump1.cap
C:\pscp.exe UserName@192.168.XX.YY:/dump1 dump1.cap

Another userful tool for the scp is WinSCP (GUI application) :)

2007年8月6日 星期一

stun/turn message types/attributes

Message Types:
From STUN RFC -
0x0001 : Binding Request
0x0101 : Binding Response
0x0111 : Binding Error Response
0x0002 : Shared Secret Request
0x0102 : Shared Secret Response
0x0112 : Shared Secret Error Response

From TURN draft -
0x0003 : Allocate Request
0x0103 : Allocate Response
0x0113 : Allocate Error Response
0x0004 : Send Request
0x0104 : Send Response
0x0114 : Send Error Response
0x0115 : Data Indication
0x0006 : Set Active Destination Request
0x0106 : Set Active Destination Response
0x0116 : Set Active Destination Error Response

Attributes:
From STUN RFC -
0x0001: MAPPED-ADDRESS
0x0002: RESPONSE-ADDRESS
0x0003: CHANGE-REQUEST
0x0004: SOURCE-ADDRESS
0x0005: CHANGED-ADDRESS
0x0006: USERNAME
0x0007: PASSWORD
0x0008: MESSAGE-INTEGRITY
0x0009: ERROR-CODE
0x000a: UNKNOWN-ATTRIBUTES
0x000b: REFLECTED-FROM

From TURN draft -
0x000d: LIFETIME
0x000e: ALTERNATE-SERVER
0x000f: MAGIC-COOKIE
0x0010: BANDWIDTH
0x0011: DESTINATION-ADDRESS
0x0012: REMOTE-ADDRESS
0x0013: DATA
0x0014: NONCE
0x0015: REALM

user-attribute format: dest:src

+ Added all the message format (2008/07/11)

Stun header format
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Value ....
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-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-+-+-+-+-+-+-+-+-+
| Attribute 1 Type | Attribute 2 Type |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Attribute 3 Type | Attribute 4 Type ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Reference:
http://www.ietf.org/rfc/rfc3489.txt
http://www1.tools.ietf.org/wg/behave/
http://www1.tools.ietf.org/wg/mmusic/

2007年8月5日 星期日

如何讓vi 有顏色

if has("terminfo")
set t_Co=8
set t_Sf=^[[3%p1%dm
set t_Sb=^[[4%p1%dm
else
set t_Co=8
set t_Sf=^[[3%dm
set t_Sb=^[[4%dm
endif

syntax on
set tabstop=4
set shiftwidth=4
set autoindent

2007年8月1日 星期三

執行程式時, 找不到shared library 時, 該如何處理

# ./aaad
./aaad: error while loading shared libraries: libosip2.so.4: cannot open shared object file: No such file or directory

遇到執行程式時, 找不到shared library 時, ㄧ般都是路徑沒有設定正確
可以透過修改 /etc/ld.so.conf,
include /etc/ld.so.conf.d/*.conf
/usr/X11R6/lib
/usr/local/lib <--- 增加這一行 然後執行 # ldconfig 就會做出動態連結所需的cache檔 或是直接執行下面這一行也可以 export LD_LIBRARY_PATH=/usr/local/lib 另外也可以直接在程式run time 來設定環境變數, 直接執行程式 # ./aaa ./aaa: relocation error: ./aaa: undefined symbol: pcap_findalldevs ===> 因為預設的shared library 只有找/usr/lib, 沒有/usr/local/lib, 所以若沒有設定環境變數, 就無法載入 shared library, 無法成功執行
# LD_LIBRARY_PATH=/usr/local/lib ./aaa
ok
==> 有另外設定shared library path, 就可以找到 shared library, 就可以成功執行

標準做法如下
Libraries have been installed in:
/usr/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath=LIBDIR' linker flag
e.g.
# gcc -c pq.c
# gcc -lpq -L/usr/local/lib -Wl,rpath=/usr/local/lib -o pq pq.o

- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

實際範例
test -z "/usr/lib" || mkdir -p -- "/usr/lib"
/bin/sh ../libtool --mode=install /usr/bin/install -c 'libeXosip2.la' '/usr/lib/libeXosip2.la'
/usr/bin/install -c .libs/libeXosip2.so.6.0.0 /usr/lib/libeXosip2.so.6.0.0
(cd /usr/lib && { ln -s -f libeXosip2.so.6.0.0 libeXosip2.so.6 || { rm -f libeXosip2.so.6 && ln -s libeXosip2.so.6.0.0 libeXosip2.so.6; }; })
(cd /usr/lib && { ln -s -f libeXosip2.so.6.0.0 libeXosip2.so || { rm -f libeXosip2.so && ln -s libeXosip2.so.6.0.0 libeXosip2.so; }; })
/usr/bin/install -c .libs/libeXosip2.lai /usr/lib/libeXosip2.la
/usr/bin/install -c .libs/libeXosip2.a /usr/lib/libeXosip2.a
chmod 644 /usr/lib/libeXosip2.a
ranlib /usr/lib/libeXosip2.a
PATH="$PATH:/sbin" ldconfig -n /usr/lib

結果如下
# ls -l /usr/lib/libe*
-rw-r--r-- 1 root root 632866 Dec 24 12:35 /usr/lib/libeXosip2.a
-rwxr-xr-x 1 root root 902 Dec 24 12:35 /usr/lib/libeXosip2.la
lrwxrwxrwx 1 root root 19 Dec 24 12:35 /usr/lib/libeXosip2.so -> libeXosip2.so.6.0.0
lrwxrwxrwx 1 root root 19 Dec 24 12:35 /usr/lib/libeXosip2.so.6 -> libeXosip2.so.6.0.0
-rwxr-xr-x 1 root root 544903 Dec 24 12:35 /usr/lib/libeXosip2.so.6.0.0

ortp 的make install範例
test -z "/usr/lib" || mkdir -p -- "/usr/lib"
/bin/sh ../libtool --mode=install /usr/bin/install -c 'libortp.la' '/usr/lib/libortp.la'
/usr/bin/install -c .libs/libortp.so.5.0.0 /usr/lib/libortp.so.5.0.0
(cd /usr/lib && { ln -s -f libortp.so.5.0.0 libortp.so.5 || { rm -f libortp.so.5 && ln -s libortp.so.5.0.0 libortp.so.5; }; })
(cd /usr/lib && { ln -s -f libortp.so.5.0.0 libortp.so || { rm -f libortp.so && ln -s libortp.so.5.0.0 libortp.so; }; })
/usr/bin/install -c .libs/libortp.lai /usr/lib/libortp.la
/usr/bin/install -c .libs/libortp.a /usr/lib/libortp.a
chmod 644 /usr/lib/libortp.a
ranlib /usr/lib/libortp.a
PATH="$PATH:/sbin" ldconfig -n /usr/lib
----------------------------------------------------------------------
Libraries have been installed in:
/usr/lib