Subject Re: [firebird-support] [FIREBIRD WIRE PROTOCOL] Documentation
Author Mark Rotteveel
On 25-2-2015 17:45, sdnetwork@... [firebird-support] wrote:
> i try to implement a driver and i play with the wire protocol but i need
> help !

Question about implementing the wirebird protocol are off-topic on
firebird-support. The firebird-devel mailinglist is better suited for
these types of questions.

> i have found this doc :
> http://sourceforge.net/p/firebird/NETProvider/ci/3.1.1.0/tree/Documentation/FirebirdWireProtocol/
> => FirebirdWireProtocol.pdf
>
> For exemple the packet to send for a connect is :
>
> Int32 => Operation code (op_connect)
> Int32 => Operation code (op_attach)
> Int32 => Version (CONNECT_VERSION2)
> Int32 => Architecture type (Generic = 1)
> String => Database path
> Int32 => Protocol versions understood (1)
> Buffer => User identification
> Int32 => Protocol version (PROTOCOL_VERSION10)
> Int32 => Architecture type (Generic = 1)
> Int32 => Minimum type (2)
> Int32 => Maximum type (3)
> Int32 => Preference weight (2)
>
> the problem is that i don't find the doc that describe the buffer for
> user identification.
>
> i have take a look in the dotnet provider : and i found this :
>
> it is the code for the buffer
>
> user_id.WriteByte(1); => what is the 1 ?
> user_id.WriteByte((byte)user.Length);
> user_id.Write(user, 0, user.Length);
> // Host name
> user_id.WriteByte(4); => what is the 4 ?
> user_id.WriteByte((byte)host.Length);
> user_id.Write(host, 0, host.Length);
> // Attach/create using this connection will use user verification
> user_id.WriteByte(6); => what is the 6 ?
> user_id.WriteByte(0); => what is the 0 ?

Look at the protocol.h in the Firebird sources, it describes (in
Firebird 2.5):

/* User identification data, if any, is of form:

<type> <length> <data>

where

type is a byte code
length is an unsigned byte containing length of data
data is 'type' specific

*/

const UCHAR CNCT_user = 1; // User name
const UCHAR CNCT_passwd = 2;
//const UCHAR CNCT_ppo = 3; // Apollo person, project, organization.
OBSOLETE.
const UCHAR CNCT_host = 4;
const UCHAR CNCT_group = 5; // Effective Unix group id
const UCHAR CNCT_user_verification = 6; // Attach/create using this
connection will use user verification

I am not sure why the .net provider doesn't have these constants.

> more globally how i can found the description of this buffer ? and do
> you know a more detailed documentation about the wire protocol ?

As documentation there is only that document, the Interbase 6.0 API
guide, and the sources of Firebird itself, and sources of drivers like
Jaybird, the .net provider, etc.

Mark
--
Mark Rotteveel