Ethereal-dev: [ethereal-dev] Packet decode generation

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Richard Sharpe <sharpe@xxxxxxxxxx>
Date: Mon, 12 Jul 1999 23:37:00 +0900
Hi,

just an update on this.  I should be committing some changes to
packet-smb.c that adds code for open_andX SMBs.

These are quite complex ... The description below shows that, and I really
need a type capability in the definitions ...

I think I have now preserved the changes that Gilbert has made and have
adapted to them.

Anyway, here is the declaration for the open_andx SMB.

SMB open_andx {
  andx;    # An andx SMB
  request {
    UCHAR Word Count
(WCT) = 15;
    UCHAR AndXCommand;
    UCHAR AndXReserved;
    USHORT
AndXOffset;
    BITFIELD 16 Flags = {
      0x01 = { "Return Additional
Info" , "Dont Return Additional Info" };
      0x02 = { "Exclusive OpLock
Requested" , "Exclusive OpLock not Requested" };
      0x04 = { "Batch
OpLock Requested" , "Batch OpLock not Requested" };
    };
    ENUMFIELD 16
Desired Access = {
      0x07   = { "Open for reading" , "Open for writing"
, "Open for reading and writing" , "Open for execute" };
      0x70   = {
"Compatibility mode" , "Deny read/write/execute (exclusive)" , "Deny write"
, "Deny read/execute" , "Deny none" };
      0x700  = { "Locality of
reference unknown" , "Mainly sequential access" , "Mainly random access" ,
"Random access with some locality" };
      0x1000 = { "Normal file
(caching permitted)" , "Do not cache this file" };
      0x4000 = { "Write
through mode disabled" , "Write through mode enabled" };
    };

BITFIELD 16 Search Attributes = {
      0x01 = { "Not a read only file" ,
"Read only file" };
      0x02 = { "Not a hidden file" , "Hidden file" };

    0x04 = { "Not a system file" , "System file" };
      0x08 = { "Not a
volume" , "Volume" };
      0x10 = { "Not a directory" , "Directory" };

  0x20 = { "Do not archive file" , "Archive file" };
    };
    BITFIELD 16
File Attributes = {
      0x01 = { "Not a read only file" , "Read only
file" };
      0x02 = { "Not a hidden file" , "Hidden file" };
      0x04 =
{ "Not a system file" , "System file" };
      0x08 = { "Not a volume" ,
"Volume" };
      0x10 = { "Not a directory" , "Directory" };
      0x20 =
{ "Do not archive file" , "Archive file" };
    };
    USHORT Creation Time
| fcall dissect_smb_time;
    USHORT Creation Date | fcall
dissect_smb_date;
    ENUMFIELD 16 Open Function = {
      0x10 = { "Fail
if file does not exist" , "Create file if it does not exist" };
      0x03
= { "Fail if file exists" , "Open file if it exists" , "Truncate File if it
exists" };
    };
    ULONG Allocated Size;
    ULONG Reserved1;
    ULONG
Reserved2;
    USHORT Byte Count;
    UCHAR Buffer Format;
    STRING File
Name;
  }
  response {
    UCHAR Word Count (WCT) = 15;
    UCHAR
AndXCommand;
    UCHAR AndXReserved;
    USHORT AndXOffset;
    USHORT
FID;
    BITFIELD 16 FileAttributes = { 
      0x01 = { "Not a read only
file" , "Read only file" };
      0x02 = { "Not a hidden file" , "Hidden
file" };
      0x04 = { "Not a system file" , "System file" };
      0x08 =
{ "Not a volume" , "Volume" };
      0x10 = { "Not a directory" ,
"Directory" };
      0x20 = { "Do not archive file" , "Archive file" };

};
    USHORT Last Write Time | fcall dissect_dos_time;
    USHORT Last
Write Date | fcall dissect_dos_date;
    ULONG Data Size;
    USHORT
Granted Access;
    ENUMFIELD 16 File Type = {
      0xFFFF = { "Disk file
or directory" , "Named pipe in byte mode" , "Named pipe in message mode" ,
"Spooled printer" };

    };
    USHORT Device State;
    ENUMFIELD 16
Action = {
      0x8000 = { "File opened by another user (or mode not
supported by server)" , "File is opened only by this user at present" };

   0x0003 = { "No action taken?" , "The file existed and was opened" , "The
file did not exist but was created" , "The file existed and was truncated"
};
    };
    ULONG Server FID;
    USHORT Reserved;
    USHORT Byte
Count;
  }
}


Regards
-------
Richard Sharpe, sharpe@xxxxxxxxxx, NS Computer Software and Services P/L,
Samba (Team member www.samba.org), Ethereal (Team member www.zing.org)
Co-author, SAMS Teach Yourself Samba in 24 Hours