Make code nest more shallow, and fix initial packet_type as UNKNOWN.

git-svn-id: http://ninja-scan-light.googlecode.com/svn/trunk@150 94d2995a-3457-b8a5-7510-40b377e6a921