Fix handling of supported protocol versions

Add a new define that defines the number of currently supported
version. This avoids out-of-bounds access of array.