add state check into switch_event_disconnected()
refactoring unlink_pid()
- check pid file locked
added sleep
renumber error codes

All libtrema error codes used to be negative (-60 to -1) until the
commit that added another code into the enum and the last value became
0. That breaks the code that assumes an error code to have a negative
value.

Renumber the enum starting from -100 to fix the issue and make some
space for future items.
check OFPT_ERROR type and code

Update validate_error() to check that both type and code make a valid
combination. Without this done handle_openflow_error() would report an
error once per nonsense OFPT_ERROR message like this:

Un-handled error type ( type = 45250 ),
fix nw_tos bitmask in hash calculation