From 049d6714cb5aa0811624666335995b4b3fd28254 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 31 May 2005 13:48:37 +0000 Subject: r7140: removing aparser directory since it is obselete in light of pidl (This used to be commit 38cad678b8058d5ac99b41c0be07f4c58a720cfc) --- source3/aparser/Makefile | 17 - source3/aparser/build | 13 - source3/aparser/cifs.struct | 1029 -------------------- source3/aparser/dump.awk | 70 -- source3/aparser/harness.awk | 17 - source3/aparser/header.awk | 80 -- source3/aparser/main.awk | 25 - source3/aparser/parsefn.awk | 271 ------ source3/aparser/parser.c | 471 --------- source3/aparser/parser.h | 103 -- source3/aparser/parserel.awk | 213 ---- source3/aparser/parsetree.awk | 224 ----- source3/aparser/spool.struct | 90 -- .../spool_io_printer_driver_info_level_3.prs | Bin 5636 -> 0 bytes .../spool_io_printer_driver_info_level_6.prs | Bin 5636 -> 0 bytes source3/aparser/srvsvc.struct | 184 ---- source3/aparser/srvsvc2.struct | 655 ------------- source3/aparser/template.awk | 18 - source3/aparser/templates/fn_end.tpl | 13 - source3/aparser/templates/fn_end0.tpl | 8 - source3/aparser/templates/fn_i_end.tpl | 12 - source3/aparser/templates/fn_i_start.tpl | 15 - source3/aparser/templates/fn_mid.tpl | 6 - source3/aparser/templates/fn_start.tpl | 17 - source3/aparser/templates/harness.tpl | 5 - source3/aparser/templates/harness_end.tpl | 7 - source3/aparser/templates/harness_start.tpl | 7 - source3/aparser/templates/ifptr_end.tpl | 1 - source3/aparser/templates/ifptr_start.tpl | 2 - source3/aparser/templates/module_end.tpl | 3 - source3/aparser/templates/module_start.tpl | 5 - source3/aparser/templates/prs_.align.tpl | 1 - source3/aparser/templates/prs_align2.tpl | 1 - source3/aparser/templates/prs_align4.tpl | 1 - source3/aparser/templates/prs_array.tpl | 8 - source3/aparser/templates/prs_array_optional.tpl | 5 - source3/aparser/templates/prs_array_remainder.tpl | 17 - source3/aparser/templates/prs_break.tpl | 1 - source3/aparser/templates/prs_case.tpl | 1 - source3/aparser/templates/prs_case_end.tpl | 1 - source3/aparser/templates/prs_element.tpl | 1 - source3/aparser/templates/prs_pointer.tpl | 2 - source3/aparser/templates/prs_struct.tpl | 1 - source3/aparser/templates/prs_struct_alloc.tpl | 1 - source3/aparser/templates/prs_uint16.tpl | 1 - source3/aparser/templates/prs_uint32.tpl | 1 - source3/aparser/templates/prs_uint8s.tpl | 2 - source3/aparser/templates/prs_uint8s_fixed.tpl | 1 - source3/aparser/templates/prs_wstring.tpl | 2 - source3/aparser/templates/prs_wstring_fixed.tpl | 2 - source3/aparser/templates/union_end.tpl | 5 - source3/aparser/templates/union_start.tpl | 1 - source3/aparser/token.awk | 180 ---- source3/aparser/util.awk | 39 - source3/aparser/util.c | 112 --- source3/aparser/vluke.c | 41 - 56 files changed, 4009 deletions(-) delete mode 100644 source3/aparser/Makefile delete mode 100755 source3/aparser/build delete mode 100644 source3/aparser/cifs.struct delete mode 100644 source3/aparser/dump.awk delete mode 100644 source3/aparser/harness.awk delete mode 100644 source3/aparser/header.awk delete mode 100644 source3/aparser/main.awk delete mode 100644 source3/aparser/parsefn.awk delete mode 100644 source3/aparser/parser.c delete mode 100644 source3/aparser/parser.h delete mode 100644 source3/aparser/parserel.awk delete mode 100644 source3/aparser/parsetree.awk delete mode 100644 source3/aparser/spool.struct delete mode 100644 source3/aparser/spool_io_printer_driver_info_level_3.prs delete mode 100644 source3/aparser/spool_io_printer_driver_info_level_6.prs delete mode 100644 source3/aparser/srvsvc.struct delete mode 100644 source3/aparser/srvsvc2.struct delete mode 100644 source3/aparser/template.awk delete mode 100644 source3/aparser/templates/fn_end.tpl delete mode 100644 source3/aparser/templates/fn_end0.tpl delete mode 100644 source3/aparser/templates/fn_i_end.tpl delete mode 100644 source3/aparser/templates/fn_i_start.tpl delete mode 100644 source3/aparser/templates/fn_mid.tpl delete mode 100644 source3/aparser/templates/fn_start.tpl delete mode 100644 source3/aparser/templates/harness.tpl delete mode 100644 source3/aparser/templates/harness_end.tpl delete mode 100644 source3/aparser/templates/harness_start.tpl delete mode 100644 source3/aparser/templates/ifptr_end.tpl delete mode 100644 source3/aparser/templates/ifptr_start.tpl delete mode 100644 source3/aparser/templates/module_end.tpl delete mode 100644 source3/aparser/templates/module_start.tpl delete mode 100644 source3/aparser/templates/prs_.align.tpl delete mode 100644 source3/aparser/templates/prs_align2.tpl delete mode 100644 source3/aparser/templates/prs_align4.tpl delete mode 100644 source3/aparser/templates/prs_array.tpl delete mode 100644 source3/aparser/templates/prs_array_optional.tpl delete mode 100644 source3/aparser/templates/prs_array_remainder.tpl delete mode 100644 source3/aparser/templates/prs_break.tpl delete mode 100644 source3/aparser/templates/prs_case.tpl delete mode 100644 source3/aparser/templates/prs_case_end.tpl delete mode 100644 source3/aparser/templates/prs_element.tpl delete mode 100644 source3/aparser/templates/prs_pointer.tpl delete mode 100644 source3/aparser/templates/prs_struct.tpl delete mode 100644 source3/aparser/templates/prs_struct_alloc.tpl delete mode 100644 source3/aparser/templates/prs_uint16.tpl delete mode 100644 source3/aparser/templates/prs_uint32.tpl delete mode 100644 source3/aparser/templates/prs_uint8s.tpl delete mode 100644 source3/aparser/templates/prs_uint8s_fixed.tpl delete mode 100644 source3/aparser/templates/prs_wstring.tpl delete mode 100644 source3/aparser/templates/prs_wstring_fixed.tpl delete mode 100644 source3/aparser/templates/union_end.tpl delete mode 100644 source3/aparser/templates/union_start.tpl delete mode 100644 source3/aparser/token.awk delete mode 100644 source3/aparser/util.awk delete mode 100644 source3/aparser/util.c delete mode 100644 source3/aparser/vluke.c diff --git a/source3/aparser/Makefile b/source3/aparser/Makefile deleted file mode 100644 index 953743b234..0000000000 --- a/source3/aparser/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -CFLAGS=-Wall -g -CC=gcc - -OBJ = vluke.o parser.o -AWKPROGS=dump.awk harness.awk header.awk parsefn.awk main.awk parsetree.awk template.awk util.awk - -all: test.h vluke - -test.h : $(AWKPROGS) - igawk -f main.awk srvsvc.struct - -vluke: test.h $(OBJ) - $(CC) $(CFLAGS) -o vluke $(OBJ) - -clean: - rm -f *.o test.h prs_*.[ch] - diff --git a/source3/aparser/build b/source3/aparser/build deleted file mode 100755 index 4cdf2901f8..0000000000 --- a/source3/aparser/build +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -file=$1 - -if ! igawk -f main.awk $file; then - echo parse failed; - exit 1; -fi - -echo compiling vluke -gcc -Wall -g -o vluke parser.c vluke.c util.c -echo done. - diff --git a/source3/aparser/cifs.struct b/source3/aparser/cifs.struct deleted file mode 100644 index 202f0d7e61..0000000000 --- a/source3/aparser/cifs.struct +++ /dev/null @@ -1,1029 +0,0 @@ -module cifs - -option autoalign False - - -#define BOOL uint32 -#define UCHAR uint8 -#define WCHAR uint16 -#define USHORT uint16 -#define LONG uint32 -#define ULONG uint32 -#define DWORD uint32 -#define SMB_TIME uint16 -#define SMB_DATE uint16 - -typedef struct { - ULONG low; - LONG high; -} TIME; - -typedef struct { - ULONG low; - ULONG high; -} hyper; - -typedef struct { - uint8 cmd; - uint8 reserved; - uint16 offset; -} ANDX_INFO; - - -typedef struct { - uint8 tag2; - STRING protocol; -} BUF2; - -typedef struct { - uint16 bcount; - BUF2 protocol[*]; -} Q_NEGPROT_0; - -typedef struct { - uint8 wcount; - union ctr[wcount] { - case 0 Q_NEGPROT_0 q0; - } -} Q_NEGPROT; - -typedef struct { - USHORT DialectIndex; /* Index of selected dialect */ - USHORT SecurityMode; /* Security mode: */ - /* bit 0: 0 = share, 1 = user */ - /* bit 1: 1 = use challenge/response */ - /* authentication */ - USHORT MaxBufferSize; /* Max transmit buffer size (>= 1024) */ - USHORT MaxMpxCount; /* Max pending multiplexed requests */ - USHORT MaxNumberVcs; /* Max VCs between client and server */ - USHORT RawMode; /* Raw modes supported: */ - /* bit 0: 1 = Read Raw supported */ - /* bit 1: 1 = Write Raw supported */ - ULONG SessionKey; /* Unique token identifying this session */ - SMB_TIME ServerTime; /* Current time at server */ - SMB_DATE ServerDate; /* Current date at server */ - USHORT ServerTimeZone; /* Current time zone at server */ - USHORT ChallengeLength; /* Length of Challenge; MBZ if not LM2.1 - /* dialect or later */ - USHORT Reserved; /* MBZ */ - USHORT ByteCount; /* Count of data bytes */ - UCHAR Challenge[ChallengeLength]; /* The challenge */ - STRING PrimaryDomain; /* The server's primary domain */ - -} R_NEGPROT_12; - -typedef struct { - USHORT DialectIndex; /*Index of selected dialect */ - UCHAR SecurityMode; /*Security mode: */ - /* bit 0: 0 = share, 1 = user */ - /* bit 1: 1 = use challenge/response */ - /* authentication */ - /* bit 2: 1 = Security Signatures (SMB integrity */ - /* check) enabled */ - /* bit 3: 1 = Security Signatures (SMB integrity */ - /* check) required */ - USHORT MaxMpxCount; /*Max pending outstanding requests */ - USHORT MaxNumberVcs; /*Max VCs between client and server */ - ULONG MaxBufferSize; /*Max transmit buffer size */ - ULONG MaxRawSize; /*Maximum raw buffer size */ - ULONG SessionKey; /*Unique token identifying this session */ - ULONG Capabilities; /*Server capabilities */ - ULONG SystemTimeLow; /*System (UTC) time of the server (low). */ - ULONG SystemTimeHigh; /*System (UTC) time of the server (high). */ - USHORT ServerTimeZone;/*Time zone of server (minutes from UTC) */ - UCHAR SecurityBlobLength;/*Length of SecurityBlob */ - - USHORT bcount; /*Count of data bytes */ - /*UCHAR GUID[16]; A globally unique identifier assigned to the */ - /* server; present only when */ - /* CAP_EXTENDED_SECURITY is on in the */ - /* Capabilities field. */ - UCHAR SecurityBlob[SecurityBlobLength]; /*Opaque Security Blob associated with the */ - /* security package if CAP_EXTENDED_SECURITY is */ - /* on in the Capabilities field; else challenge */ - /* for CIFS challenge/response authentication. */ - STRING OemDomainName[+]; /*The name of the domain (in OEM chars); not */ - /* present if CAP_EXTENDED_SECURITY is on in the */ - /* Capabilities field */ -} R_NEGPROT_17; - - -typedef struct { - uint8 wcount; - union ctr[wcount] { - case 17 R_NEGPROT_17 r17; - } -} R_NEGPROT; - -typedef struct { - uint8 wcount; - uint16 vwv[wcount]; - uint16 bcount; - uint8 none[bcount]; -} Q_TDIS; - -typedef struct { - uint8 wcount; - uint16 vwv[wcount]; - uint16 bcount; - uint8 none[bcount]; -} R_TDIS; - -typedef struct { - ANDX_INFO andx; - uint16 bcount; - uint8 none[bcount]; -} R_ULOGOFF_ANDX_2; - -typedef struct { - uint8 wcount; - union ctr[wcount] { - case 2 R_ULOGOFF_ANDX_2 q2; - } -} R_ULOGOFF_ANDX; - -typedef struct { - ANDX_INFO andx; - uint16 bcount; - uint8 none[bcount]; -} Q_ULOGOFF_ANDX_2; - -typedef struct { - uint8 wcount; - union ctr[wcount] { - case 2 Q_ULOGOFF_ANDX_2 q2; - } -} Q_ULOGOFF_ANDX; - -typedef struct { - ANDX_INFO andx; - uint16 bufsize; - uint16 max_mpx; - uint16 vc; - ULONG sess_key; - uint16 pwlen; - ULONG reserved; - - uint16 bcount; - uint8 password[pwlen]; - STRING domain; - STRING os; - STRING server; - -} Q_SESSION_SETUP_ANDX_10; - -typedef struct { - ANDX_INFO andx; - uint16 bufsize; - uint16 max_mpx; - uint16 vc; - ULONG sess_key; - uint16 pwlen; - uint16 upwlen; - ULONG capabilities; - ULONG reserved; - - uint16 bcount; - uint8 password[pwlen]; - uint8 upassword[upwlen]; - STRING user; - STRING domain; - STRING os; - STRING server; - -} Q_SESSION_SETUP_ANDX_13; - -typedef struct _Q_SESSION_SETUP_ANDX { - uint8 wcount; - union ctr[wcount] { - case 10 Q_SESSION_SETUP_ANDX_10 q10; - case 13 Q_SESSION_SETUP_ANDX_13 q13; - } -} Q_SESSION_SETUP_ANDX; - -typedef struct { - ANDX_INFO andx; - uint16 vwv2; - uint16 passlen; - uint16 bcount; - uint8 password[passlen]; - STRING path; - STRING device; -} Q_TCON_ANDX_4; - -typedef struct _Q_TCON_ANDX { - uint8 wcount; - union ctr[wcount] { - case 4 Q_TCON_ANDX_4 q4; - } -} Q_TCON_ANDX; - -typedef struct { - ANDX_INFO andx; - uint16 vwv2; - uint16 bcount; - STRING share; -} R_TCON_ANDX_3; - -typedef struct _R_TCON_ANDX { - uint8 wcount; - union ctr[wcount] { - case 3 R_TCON_ANDX_3 q3; - } -} R_TCON_ANDX; - -typedef struct { - ANDX_INFO andx; - uint16 action; - - uint16 count; - STRING os; - STRING server; - STRING domain; -} R_SESSION_SETUP_ANDX_10; - -typedef struct _R_SESSION_SETUP_ANDX { - uint8 wcount; - union ctr[wcount] { - case 3 R_SESSION_SETUP_ANDX_10 r3; - } -} R_SESSION_SETUP_ANDX; - - -typedef struct _R_CLOSE { - uint8 wcount; - uint16 count; - uint8 none[count]; - -} R_CLOSE; - -typedef struct _Q_CLOSE { - uint8 wcount; - uint16 fnum; - uint32 vwv1; - - uint16 count; - uint8 none[count]; - -} Q_CLOSE; - -typedef struct { - uint16 dsize; - uint16 bsizehi; - uint16 bsizelo; - uint16 avail; - uint16 vwv4; - - uint16 bcount; - uint8 none[bcount]; - -} R_DSKATTR_5; - -typedef struct { - uint8 wcount; - union ctr[wcount] { - case 5 R_DSKATTR_5 r5; - } -} R_DSKATTR; - -typedef struct { - uint16 count; - uint8 none[count]; - -} Q_DSKATTR_0; - -typedef struct _Q_DSKATTR { - uint8 wcount; - union ctr[wcount] { - case 0 Q_DSKATTR_0 q1; - } - -} Q_DSKATTR; - -typedef struct { - ANDX_INFO andx; - - uint16 bcount; - uint8 none[bcount]; - -} R_LOCKING_2; - -typedef struct { - uint8 wcount; - union ctr[wcount] { - case 2 R_LOCKING_2 r2; - } -} R_LOCKING_ANDX; - -/* XXXX must do a switch on bit 0x10 to do large locks XXXX */ -/* LockType Flag Name Value Description */ - -#define LOCKING_ANDX_SHARED_LOCK 0x01 /* Read-only lock */ -#define LOCKING_ANDX_OPLOCK_RELEASE 0x02 /* Oplock break notification */ -#define LOCKING_ANDX_CHANGE_LOCKTYPE 0x04 /* Change lock type */ -#define LOCKING_ANDX_CANCEL_LOCK 0x08 /* Cancel outstanding request */ -#define LOCKING_ANDX_LARGE_FILES 0x10 /* Large file locking format */ - -typedef struct { - USHORT Pid; /* PID of process "owning" lock */ - ULONG Offset; /* Offset to bytes to [un]lock */ - ULONG Length; /* Number of bytes to [un]lock */ -} LOCKING_ANDX_RANGE_SHORT; - -typedef struct { - USHORT Pid; /* PID of process "owning" lock */ - .align4 0; - ULONG OffsetHigh; /* Offset to bytes to [un]lock (high) */ - ULONG OffsetLow; /* Offset to bytes to [un]lock (low) */ - ULONG LengthHigh; /* Number of bytes to [un]lock (high) */ - ULONG LengthLow; /* Number of bytes to [un]lock (low) */ - -} LOCKING_ANDX_RANGE_LARGE; - -/* typedef struct { */ - /* union ctr[LockType&0x10] { */ - /* case 0 LOCKING_ANDX_RANGE_SHORT ls; */ - /* case 0x10 LOCKING_ANDX_RANGE_LARGE ll; */ - /* } */ -/* } LOCKING_ANDX_RANGE; */ - -typedef struct { - ANDX_INFO andx; - - USHORT Fid; /* File handle */ - UCHAR LockType; /* See LockType table below */ - UCHAR OplockLevel; /* The new oplock level */ - ULONG Timeout; /* Milliseconds to wait for unlock */ - USHORT NumberOfUnlocks; /* Num. unlock range structs following */ - USHORT NumberOfLocks; /* Num. lock range structs following */ - - USHORT ByteCount; /* Count of data bytes */ - LOCKING_ANDX_RANGE_SHORT Unlocks[NumberOfUnlocks]; /* Unlock ranges */ - LOCKING_ANDX_RANGE_SHORT Locks[NumberOfLocks]; /* Lock ranges */ - -} Q_LOCKING_8; - -typedef struct _Q_LOCKING { - uint8 wcount; - union ctr[wcount] { - case 8 Q_LOCKING_8 q8; - } - -} Q_LOCKING_ANDX; - - -typedef struct { - uint16 bcount; - uint8 protocols[bcount]; - -} R_UNLINK_0; - -typedef struct { - uint8 wcount; - union ctr[wcount] { - case 0 R_UNLINK_0 r0; - } -} R_UNLINK; - -typedef struct { - uint16 dirtype; - - uint16 count; - uint8 fname[count]; - -} Q_UNLINK_1; - -typedef struct _Q_UNLINK { - uint8 wcount; - union ctr[wcount] { - case 1 Q_UNLINK_1 q1; - } - -} Q_UNLINK; - -typedef struct _R_OPEN_ANDX{ - uint8 wcount; - ANDX_INFO andx; - uint16 fnum; - uint16 fmode; - uint32 mtime; - uint32 size; - uint16 rmode; - uint16 vwv9; - uint16 vwv10; - uint16 smb_action; - uint16 vwv12; - uint16 vwv13; - uint16 vwv14; - - uint16 count; - uint8 none[count]; - -} R_OPEN_ANDX; - -typedef struct _Q_OPEN_ANDX{ - uint8 wcount; - ANDX_INFO andx; - uint16 fnum; - uint16 fmode; - uint32 mtime; - uint32 size; - uint16 rmode; - uint16 vwv9; - uint16 vwv10; - uint16 smb_action; - uint16 vwv12; - uint16 vwv13; - uint16 vwv14; - - uint16 count; - uint8 fname[count]; - -} Q_OPEN_ANDX; - -typedef struct _R_READ_ANDX { - uint8 wcount; - ANDX_INFO andx; - uint16 vwv2; - uint16 vwv3; - uint16 vwv4; - uint16 nread; - uint16 offset; - uint16 vwv7; - uint16 vwv8; - uint16 vwv9; - uint16 vwv10; - uint16 vwv11; - - uint16 count; - uint8 data[count]; - -} R_READ_ANDX; - -typedef struct _Q_READ_ANDX_10 { - ANDX_INFO andx; - uint16 fnum; - uint32 startpos; - uint16 smb_maxcnt; - uint16 smb_mincnt; - uint16 vwv7; - uint16 vwv8; - uint16 vwv9; - - uint16 count; - uint8 none[count]; - -} Q_READ_ANDX_10; - -typedef struct _Q_READ_ANDX_12 { - ANDX_INFO andx; - uint16 fnum; - uint32 startpos; - uint16 smb_maxcnt; - uint16 smb_mincnt; - uint16 vwv7; - uint16 vwv8; - uint16 vwv9; - uint32 startposhi; - - uint16 count; - uint8 none[count]; - -} Q_READ_ANDX_12; - -typedef struct _Q_READ_ANDX { - uint8 wcount; - union ctr[wcount] { - case 10 Q_READ_ANDX_10 q10; - case 12 Q_READ_ANDX_12 q12; - } -} Q_READ_ANDX; - -typedef struct _R_WRITE_ANDX { - uint8 wcount; - ANDX_INFO andx; - uint16 nwritten; - uint16 vwv3; - uint16 vwv4; - uint16 vwv5; - - uint16 count; - uint8 none[count]; - -} R_WRITE_ANDX; - -typedef struct _Q_WRITE_ANDX_12 { - ANDX_INFO andx; - uint16 fnum; - uint32 startpos; - uint16 vwv5; - uint16 vwv6; - uint16 write_through; - uint16 vwv8; - uint16 vwv9; - uint16 numtowrite; - uint16 smb_doff; - - uint16 count; - uint8 data[count]; - -} Q_WRITE_ANDX_12; - -typedef struct _Q_WRITE_ANDX_14 { - ANDX_INFO andx; - uint16 fnum; - uint32 startpos; - uint16 vwv5; - uint16 vwv6; - uint16 write_through; - uint16 vwv8; - uint16 vwv9; - uint16 numtowrite; - uint16 smb_doff; - uint32 startposhi; - - uint16 count; - uint8 data[count]; - -} Q_WRITE_ANDX_14; - -typedef struct _Q_WRITE_ANDX { - uint8 wcount; - union ctr[wcount] { - case 12 Q_WRITE_ANDX_12 q12; - case 14 Q_WRITE_ANDX_14 q14; - } -} Q_WRITE_ANDX; - - - -typedef struct _Q_NTTRANS_19 { - UCHAR MaxSetupCount; /* Max setup words to return */ - USHORT Reserved; - ULONG TotalParameterCount; /* Total parameter bytes being sent */ - ULONG TotalDataCount; /* Total data bytes being sent */ - ULONG MaxParameterCount; /* Max parameter bytes to return */ - ULONG MaxDataCount; /* Max data bytes to return */ - ULONG ParameterCount; /* Parameter bytes sent this buffer */ - ULONG ParameterOffset; /* Offset (from header start) to */ - /* Parameters */ - ULONG DataCount; /* Data bytes sent this buffer */ - ULONG DataOffset; /* Offset (from header start) to data */ - UCHAR SetupCount; /* Count of setup words */ - USHORT Function; /* The transaction function code */ - UCHAR Buffer[1]; - USHORT Setup[SetupCount]; /* Setup words */ - USHORT ByteCount; /* Count of data bytes */ - .align4 0; - UCHAR Parameters[ParameterCount];/* Parameter bytes */ - .align4 0; - UCHAR Data[DataCount]; /* Data bytes */ - -} Q_NTTRANS_19; - -typedef struct _Q_NTTRANS { - uint8 wcount; - union ctr[wcount] { - case 19 Q_NTTRANS_19 q19; - } -} Q_NTTRANS; - -typedef struct _R_NTTRANS_18 { - UCHAR Reserved[3]; - ULONG TotalParameterCount; /* Total parameter bytes being sent */ - ULONG TotalDataCount; /* Total data bytes being sent */ - ULONG ParameterCount; /* Parameter bytes sent this buffer */ - ULONG ParameterOffset; /* Offset (from header start) to */ - /* Parameters */ - ULONG ParameterDisplacement; /* Specifies the offset from the start */ - /* of the overall parameter block to */ - /* the parameter bytes that are */ - /* contained in this message */ - ULONG DataCount; /* Data bytes sent this buffer */ - ULONG DataOffset; /* Offset (from header start) to data */ - ULONG DataDisplacement; /* Specifies the offset from the start */ - /* of the overall data block to the */ - /* data bytes that are contained in */ - /* this message. */ - UCHAR SetupCount; /* Count of setup words */ - USHORT Setup[SetupCount]; /* Setup words */ - USHORT ByteCount; /* Count of data bytes */ - .align4 0; - UCHAR Parameters[ParameterCount]; /* Parameter bytes */ - .align4 0; - UCHAR Data[DataCount]; /* Data bytes */ -} R_NTTRANS_18; - -typedef struct _R_NTTRANS { - uint8 wcount; - union ctr[wcount] { - case 18 R_NTTRANS_18 q18; - } - .align4 2; -} R_NTTRANS; - -/*Setup[0] Transaction2 Value Description */ -/*Subcommand Code */ -/*=============================== ===== ============================= */ - -#define TRANS2_OPEN2 0x00 /* Create file with extended attributes */ -#define TRANS2_FIND_FIRST2 0x01 /* Begin search for files */ -#define TRANS2_FIND_NEXT2 0x02 /* Resume search for files */ -#define TRANS2_QUERY_FS_INFO 0x03 /* Get file system information -#define TRANS2_RESERVED4 0x04 /* Reserved */ -#define TRANS2_QUERY_PATH_INFO 0x05 /* Get information about a named file or directory */ -#define TRANS2_SET_PATH_INFO 0x06 /* Set information about a named file or directory */ -#define TRANS2_QUERY_FILE_INFO 0x07 /* Get information about a handle */ -#define TRANS2_SET_FILE_INFO 0x08 /* Set information by handle */ -#define TRANS2_FSCTL 0x09 /* Not implemented by NT server */ -#define TRANS2_IOCTL2 0x0A /* Not implemented by NT server */ -#define TRANS2_FIND_NOTIFY_FIRST 0x0B /* Not implemented by NT server */ -#define TRANS2_FIND_NOTIFY_NEXT 0x0C /* Not implemented by NT server */ -#define TRANS2_CREATE_DIRECTORY 0x0D /* Create directory with extended attributes */ -#define TRANS2_SESSION_SETUP 0x0E /* Session setup with extended security information */ -#define TRANS2_GET_DFS_REFERRAL 0x10 /* Get a DFS referral */ -#define TRANS2_REPORT_DFS_INCONSISTENCY 0x11 /* Report a DFS knowledge inconsistency */ - -typedef struct { - USHORT InformationLevel; /* Level of information requested */ -} TRANS2_QUERY_FS_INFO_STRUCT; - -#define SMB_INFO_STANDARD 1 -#define SMB_INFO_QUERY_EA_SIZE 2 -#define SMB_SET_FILE_BASIC_INFO 0x101 -#define SMB_SET_FILE_DISPOSITION_INFO 0x102 -#define SMB_SET_FILE_ALLOCATION_INFO 0x103 -#define SMB_SET_FILE_END_OF_FILE_INFO 0x104 - - -typedef struct { - hyper CreationTime; - hyper LastAccessTime; - hyper LastWriteTime; - hyper ChangeTime; - USHORT Attributes; - .align4 0; -} SMB_QUERY_FILE_BASIC_INFO_STRUCT; - - -typedef struct { - ULONG fs_atr; - LONG max_len_filename; - ULONG length; - uint8 fs[length]; - .align4 2; -} SMB_QUERY_FS_ATTRIBUTE_INFO_STRUCT; - -#define FILE_CASE_SENSITIVE_SEARCH 0x00000001 -#define FILE_CASE_PRESERVED_NAMES 0x00000002 -#define FILE_PRSISTENT_ACLS 0x00000004 -#define FILE_FILE_COMPRESSION 0x00000008 -#define FILE_VOLUME_QUOTAS 0x00000010 -#define FILE_DEVICE_IS_MOUNTED 0x00000020 -#define FILE_VOLUME_IS_COMPRESSED 0x00008000 - -typedef struct { - USHORT Fid; - USHORT InformationLevel; - USHORT Reserved; - .align4 0; - - union ctr[InformationLevel] { - case 0x101 SMB_QUERY_FILE_BASIC_INFO_STRUCT t101; - } - -} TRANS2_SET_FILE_INFO_STRUCT; - -typedef struct { - USHORT InformationLevel; /* Level of information requested */ - ULONG Reserved; /* Must be zero */ - STRING FileName; /* File or directory name */ -} TRANS2_QUERY_PATH_INFO_STRUCT; - -typedef struct { - USHORT SearchAttributes; - USHORT SearchCount; - USHORT Flags; - USHORT InformationLevel; - ULONG SearchStorageType; - STRING FileName; -} TRANS2_FIND_FIRST2_STRUCT; - -typedef struct _Q_TRANS2_15 { - USHORT TotalParameterCount; /* Total parameter bytes being sent */ - USHORT TotalDataCount; /* Total data bytes being sent */ - USHORT MaxParameterCount; /* Max parameter bytes to return */ - USHORT MaxDataCount; /* Max data bytes to return */ - UCHAR MaxSetupCount; /* Max setup words to return */ - UCHAR Reserved; - USHORT Flags; /* Additional information: */ - /* bit 0 - also disconnect TID in TID */ - ULONG Timeout; - USHORT Reserved2; - USHORT ParameterCount; /* Parameter bytes sent this buffer */ - USHORT ParameterOffset; /* Offset (from header start) to */ - /* Parameters */ - USHORT DataCount; /* Data bytes sent this buffer */ - USHORT DataOffset; /* Offset (from header start) to data */ - UCHAR SetupCount; /* Count of setup words */ - UCHAR Reserved3; /* Reserved (pad above to word) */ - USHORT Setup[SetupCount]; /* Setup words (# = SetupWordCount) */ - USHORT ByteCount; /* Count of data bytes */ - .align4 0; - union ctr[Setup[0]] { - case 1 TRANS2_FIND_FIRST2_STRUCT t1; - case 3 TRANS2_QUERY_FS_INFO_STRUCT t3; - case 5 TRANS2_QUERY_PATH_INFO_STRUCT t5; - case 8 TRANS2_SET_FILE_INFO_STRUCT t8; - } - -} Q_TRANS2_15; - -typedef struct _Q_TRANS2 { - uint8 wcount; - union ctr[wcount] { - case 15 Q_TRANS2_15 q15; - } -} Q_TRANS2; - -typedef struct { - ULONG NextEntryOffset; - ULONG FileIndex; - hyper CreationTime; - hyper LastAccessTime; - hyper LastWriteTime; - hyper ChangeTime; - hyper EndOfFile; - hyper AllocationSize; - ULONG ExtFileAttributes; - ULONG FileNameLength; - ULONG EaSize; - UCHAR ShortNameLength; - UCHAR Reserved; - uint8 ShortName[24]; - UCHAR FileName[FileNameLength]; - .align4 2; -} SMB_FIND_FILE_BOTH_DIRECTORY_INFO; - -typedef struct { - .align2 0; -} R_TRANS2_D0; - -typedef struct { - .align4 2; -} R_TRANS2_P0; - -typedef struct { - USHORT Reserved; -} R_TRANS2_P2; - -typedef struct { - USHORT Sid; /* Search handle */ - USHORT SearchCount; /* Number of entries returned */ - USHORT EndOfSearch; /* Was last entry returned? */ - USHORT EaErrorOffset; /* Offset into EA list if EA error */ - USHORT LastNameOffset; /* Offset into data to file name of last */ - /* entry, if server needs it to resume */ - /* search; else 0 */ - .align4 2; - SMB_FIND_FILE_BOTH_DIRECTORY_INFO i104[SearchCount]; -} R_TRANS2_FIND_FIRST2_STRUCT; - -typedef struct { - SMB_QUERY_FILE_BASIC_INFO_STRUCT i101; - .align4 2; -} R_TRANS2_FILE_BASIC_STRUCT; - -typedef struct _R_TRANS2_10 { - USHORT TotalParameterCount;/* Total parameter bytes being sent */ - USHORT TotalDataCount; /* Total data bytes being sent */ - USHORT Reserved2; - USHORT ParameterCount; /* Parameter bytes sent this buffer */ - USHORT ParameterOffset; /* Offset (from header start) to */ - /* Parameters */ - USHORT ParameterDisplacement; /* Specifies the offset from the start */ - /* of the overall parameter block to */ - /* the parameter bytes that are */ - /* contained in this message */ - USHORT DataCount; /* Data bytes sent this buffer */ - USHORT DataOffset; /* Offset (from header start) to data */ - USHORT DataDisplacement; /* Specifies the offset from the start */ - /* of the overall data block to the */ - /* data bytes that are contained in */ - /* this message. */ - UCHAR SetupCount; /* Count of setup words */ - UCHAR Reserved3; /* Reserved (pad above to word) */ - USHORT Setup[SetupCount]; /* Setup words */ - USHORT ByteCount; /* Count of data bytes */ - .align4 2; - union pctr[ParameterCount] { - case 0 R_TRANS2_P0 p0; - case 2 R_TRANS2_P2 p2; - case 10 R_TRANS2_FIND_FIRST2_STRUCT r10; - } - union dctr[DataCount] { - case 0 R_TRANS2_D0 d0; - case 0x24 R_TRANS2_FILE_BASIC_STRUCT r24; - case 0x14 SMB_QUERY_FS_ATTRIBUTE_INFO_STRUCT r14; - } -} R_TRANS2_10; - -typedef struct { - USHORT ByteCount; /* Count of data bytes */ -} R_TRANS2_0; - -typedef struct _R_TRANS2 { - uint8 wcount; - union ctr[wcount] { - case 0 R_TRANS2_0 q0; - case 10 R_TRANS2_10 q10; - } -} R_TRANS2; - -typedef struct _Q_TRANS_16 { - USHORT TotalParameterCount; /* Total parameter bytes being sent */ - USHORT TotalDataCount; /* Total data bytes being sent */ - USHORT MaxParameterCount; /* Max parameter bytes to return */ - USHORT MaxDataCount; /* Max data bytes to return */ - UCHAR MaxSetupCount; /* Max setup words to return */ - UCHAR Reserved; - USHORT Flags; /* Additional information: */ - /* bit 0 - also disconnect TID in TID */ - ULONG Timeout; - USHORT Reserved2; - USHORT ParameterCount; /* Parameter bytes sent this buffer */ - USHORT ParameterOffset; /* Offset (from header start) to */ - /* Parameters */ - USHORT DataCount; /* Data bytes sent this buffer */ - USHORT DataOffset; /* Offset (from header start) to data */ - UCHAR SetupCount; /* Count of setup words */ - UCHAR Reserved3; /* Reserved (pad above to word) */ - USHORT Setup[SetupCount]; /* Setup words (# = SetupWordCount) */ - USHORT ByteCount; /* Count of data bytes */ - STRING Name; /* Must be NULL */ - .align4 0; - UCHAR Parameters[ParameterCount];/* Parameter bytes (# = ParameterCount) */ - .align4 0; - UCHAR Data[DataCount]; /* Data bytes (# = DataCount) */ - -} Q_TRANS_16; - -typedef struct _Q_TRANS { - uint8 wcount; - union ctr[wcount] { - case 16 Q_TRANS_16 q16; - } -} Q_TRANS; - -typedef struct _R_TRANS_10 { - USHORT TotalParameterCount;/* Total parameter bytes being sent */ - USHORT TotalDataCount; /* Total data bytes being sent */ - USHORT Reserved2; - USHORT ParameterCount; /* Parameter bytes sent this buffer */ - USHORT ParameterOffset; /* Offset (from header start) to */ - /* Parameters */ - USHORT ParameterDisplacement; /* Specifies the offset from the start */ - /* of the overall parameter block to */ - /* the parameter bytes that are */ - /* contained in this message */ - USHORT DataCount; /* Data bytes sent this buffer */ - USHORT DataOffset; /* Offset (from header start) to data */ - USHORT DataDisplacement; /* Specifies the offset from the start */ - /* of the overall data block to the */ - /* data bytes that are contained in */ - /* this message. */ - UCHAR SetupCount; /* Count of setup words */ - UCHAR Reserved3; /* Reserved (pad above to word) */ - USHORT Setup[SetupCount]; /* Setup words */ - USHORT ByteCount; /* Count of data bytes */ - .align4 0; - UCHAR Parameters[ParameterCount];/* Parameter bytes */ - .align4 0; - UCHAR Data[DataCount]; /* Data bytes */ -} R_TRANS_10; - -typedef struct _R_TRANS { - uint8 wcount; - union ctr[wcount] { - case 10 R_TRANS_10 q10; - } -} R_TRANS; - -typedef struct _Q_NT_CREATE_ANDX_24 { - ANDX_INFO andx; - uint8 reserved; - uint16 name_len; - ULONG flags; - ULONG rootfid; - ULONG access; - hyper allocsize; - ULONG attribs; - ULONG sharing; - ULONG creat_disp; - ULONG creat_options; - ULONG impersonation; - uint8 sec_flags; - - uint16 count; - uint8 name[name_len]; - -} Q_NTCREATE_ANDX_24; - -typedef struct _Q_NTCREATE_ANDX{ - uint8 wcount; - union ctr[wcount] { - case 24 Q_NTCREATE_ANDX_24 q24; - } -} Q_NTCREATE_ANDX; - -typedef struct { - ANDX_INFO andx; - uint8 oplock_level; - uint16 fid; - ULONG action; - TIME create_time; - TIME access_time; - TIME write_time; - TIME change_time; - ULONG ext_attribs; - hyper allocsize; - hyper size; - uint16 type; - uint16 state; - uint8 directory; - - uint16 count; - uint8 none[count]; - -} R_NTCREATE_ANDX_34; - -typedef struct _R_NTCREATE_ANDX{ - uint8 wcount; - union ctr[wcount] { - case 34 R_NTCREATE_ANDX_34 q34; - } -} R_NTCREATE_ANDX; - -typedef struct { - ULONG smbhdr; - uint8 com; - uint8 rcls; - uint8 reh; - uint16 err; - uint8 flg; - uint16 flg2; - uint16 reserved; - uint8 SecuritySignature[8]; - uint16 pad; - uint16 tid; - uint16 pid; - uint16 uid; - uint16 mid; -} SMB_HDR; - -typedef struct _R_SMB { - ULONG nbhdr; - SMB_HDR hdr; - union ctr[hdr.com] { - case 4 R_CLOSE r4; - case 6 R_UNLINK r6; - case 36 R_LOCKING_ANDX r36; - case 37 R_TRANS r37; - case 45 R_OPEN_ANDX r45; - case 46 R_READ_ANDX r46; - case 47 R_WRITE_ANDX r47; - case 50 R_TRANS2 q50; - case 113 R_TDIS r113; - case 114 R_NEGPROT r114; - case 115 R_SESSION_SETUP_ANDX r115; - case 116 R_ULOGOFF_ANDX r116; - case 117 R_TCON_ANDX r117; - case 128 R_DSKATTR r128; - case 160 R_NTTRANS r160; - case 162 R_NTCREATE_ANDX r162; - } -} R_SMB; - -typedef struct _Q_SMB { - ULONG nbhdr; - SMB_HDR hdr; - union ctr[hdr.com] { - case 4 Q_CLOSE q4; - case 6 Q_UNLINK q6; - case 36 Q_LOCKING_ANDX q36; - case 37 Q_TRANS q37; - case 45 Q_OPEN_ANDX q45; - case 46 Q_READ_ANDX q46; - case 47 Q_WRITE_ANDX q47; - case 50 Q_TRANS2 q50; - case 113 Q_TDIS q113; - case 114 Q_NEGPROT q114; - case 115 Q_SESSION_SETUP_ANDX q115; - case 116 Q_ULOGOFF_ANDX q116; - case 117 Q_TCON_ANDX q117; - case 128 Q_DSKATTR q128; - case 160 Q_NTTRANS q160; - case 162 Q_NTCREATE_ANDX q162; - } -} Q_SMB; - diff --git a/source3/aparser/dump.awk b/source3/aparser/dump.awk deleted file mode 100644 index 11bfb107e4..0000000000 --- a/source3/aparser/dump.awk +++ /dev/null @@ -1,70 +0,0 @@ -# dump the current parse tree - - -function element_string(elnum, - LOCAL, elem) -{ - elem = elements[elnum, "elem"]; - if (elements[elnum, "ptr"]=="1") elem="*"elem; - if (elements[elnum, "array_len"]!="") - elem=elem"["elements[elnum, "array_len"]"]"; - if (elements[elnum, "switch"]!="") - elem=elem"["elements[elnum, "switch"]"]"; - return elem; -} - -function dump_element(f, elnum, - LOCAL, elem, type) -{ - type = elements[elnum, "type"]; - case = elements[elnum, "case"]; - elem = element_string(elnum); - if (case != "") { - xprintf(f,"\t\tcase %d %s %s;\n", case, type, elem); - } else { - xprintf(f,"\t%s %s;\n", type, elem); - } -} - -function dump_union(f, elnum, - LOCAL, i) -{ - xprintf(f,"\tunion %s {\n", element_string(elnum)); - for (i=0;i"; - } else { - v["UNION"] = v["UNION"]"."; - } - - print_template(f, "union_start.tpl", v); - for (i=0;i 0) { - print_template(f, "fn_end.tpl", v); - } - else { - print_template(f, "fn_end0.tpl", v); - } - - if (f1 == -1) - return; - - xprintf(m, "void fn_%s(\n", v["STRUCTNAME"]); - - for (i=f1+1;igrow_size = MAX(ps->grow_size, ps->data_offset + extra_space); - - if(ps->data_offset + extra_space <= ps->buffer_size) - return True; - - /* - * We cannot grow the buffer if we're not reading - * into the io_struct, or if we don't own the memory. - */ - - if(UNMARSHALLING(ps) || !ps->is_dynamic) { - DEBUG(0,("io_grow: Buffer overflow - unable to expand buffer by %u bytes.\n", - (unsigned int)extra_space)); - return False; - } - - /* - * Decide how much extra space we really need. - */ - - extra_space -= (ps->buffer_size - ps->data_offset); - if(ps->buffer_size == 0) { - new_size = extra_space; - - if((new_data = malloc(new_size)) == NULL) { - DEBUG(0,("io_grow: Malloc failure for size %u.\n", (unsigned int)new_size)); - return False; - } - memset(new_data, '\0', new_size ); - } else { - /* - * If the current buffer size is bigger than the space needed, just - * double it, else add extra_space. - */ - new_size = MAX(ps->buffer_size*2, ps->buffer_size + extra_space); - - if ((new_data = Realloc(ps->data_p, new_size)) == NULL) { - DEBUG(0,("io_grow: Realloc failure for size %u.\n", - (unsigned int)new_size)); - return False; - } - } - ps->buffer_size = new_size; - ps->data_p = new_data; - - return True; -} - - -/******************************************************************* - Ensure we can read/write to a given offset. - ********************************************************************/ - -char *io_mem_get(io_struct *ps, uint32 extra_size) -{ - if(UNMARSHALLING(ps)) { - /* - * If reading, ensure that we can read the requested size item. - */ - if (ps->data_offset + extra_size > ps->buffer_size) { - DEBUG(0,("io_mem_get: reading data of size %u would overrun buffer.\n", - (unsigned int)extra_size )); - return NULL; - } - } else { - /* - * Writing - grow the buffer if needed. - */ - if(!io_grow(ps, extra_size)) - return False; - } - return &ps->data_p[ps->data_offset]; -} - -/******************************************************************* - Initialise a parse structure - malloc the data if requested. - ********************************************************************/ - -BOOL io_init(io_struct *ps, uint32 size, BOOL io) -{ - ZERO_STRUCTP(ps); - ps->io = io; - ps->bigendian_data = False; - ps->is_dynamic = False; - ps->data_offset = 0; - ps->buffer_size = 0; - ps->data_p = NULL; - - if (size != 0) { - ps->buffer_size = size; - if((ps->data_p = (char *)malloc((size_t)size)) == NULL) { - DEBUG(0,("io_init: malloc fail for %u bytes.\n", (unsigned int)size)); - return False; - } - ps->is_dynamic = True; /* We own this memory. */ - } - - return True; -} - -/******************************************************************* - debug output for parsing info. - - XXXX side-effect of this function is to increase the debug depth XXXX - - ********************************************************************/ -void io_debug(io_struct *ps, int depth, char *desc, char *fn_name) -{ - DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->data_offset, fn_name, desc)); -} - -/******************************************************************* - Align a the data_len to a multiple of align bytes - filling with - zeros. - ********************************************************************/ - -BOOL io_align2(io_struct *ps, int offset) -{ - uint32 mod = (ps->data_offset + offset) & (2-1); - - if (mod != 0) { - uint32 extra_space = (2 - mod); - if(!io_grow(ps, extra_space)) - return False; - memset(&ps->data_p[ps->data_offset], '\0', (size_t)extra_space); - ps->data_offset += extra_space; - } - - return True; -} - -BOOL io_align4(io_struct *ps, int offset) -{ - uint32 mod = (ps->data_offset + offset) & (4-1); - - if (mod != 0) { - uint32 extra_space = (4 - mod); - if(!io_grow(ps, extra_space)) - return False; - memset(&ps->data_p[ps->data_offset], '\0', (size_t)extra_space); - ps->data_offset += extra_space; - } - - return True; -} - -/******************************************************************* - Align a the data_len to a multiple of align bytes - filling with - zeros. - ********************************************************************/ - -BOOL io_align(io_struct *ps, int align) -{ - uint32 mod; - - if (!ps->autoalign) return True; - - mod = ps->data_offset & (align-1); - - if (align != 0 && mod != 0) { - uint32 extra_space = (align - mod); - if(!io_grow(ps, extra_space)) - return False; - memset(&ps->data_p[ps->data_offset], '\0', (size_t)extra_space); - ps->data_offset += extra_space; - } - - return True; -} - - -/******************************************************************* - read from a socket into memory. - ********************************************************************/ -BOOL io_read(io_struct *ps, int fd, size_t len, int timeout) -{ - BOOL ok; - size_t prev_size = ps->buffer_size; - if (!io_grow(ps, len)) - { - return False; - } - - if (timeout > 0) - { - ok = (read(fd, &ps->data_p[prev_size], len) == len); - } - else - { - ok = (read(fd, &ps->data_p[prev_size], len) == len); - } - return ok; -} - - -/******************************************************************* - do IO on a uint32. - ********************************************************************/ -BOOL io_uint32(char *name, io_struct *ps, int depth, uint32 *data32, unsigned flags) -{ - char *q; - - if (!(flags & PARSE_SCALARS)) return True; - - if (!io_align(ps, 4)) return False; - - q = io_mem_get(ps, sizeof(uint32)); - if (q == NULL) return False; - - DBG_RW_IVAL(name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, *data32) - ps->data_offset += sizeof(uint32); - - return True; -} - -/******************************************************************* - do IO on a uint16. - ********************************************************************/ -BOOL io_uint16(char *name, io_struct *ps, int depth, uint16 *data16, unsigned flags) -{ - char *q; - - if (!(flags & PARSE_SCALARS)) return True; - - if (!io_align(ps, 2)) return False; - - q = io_mem_get(ps, sizeof(uint16)); - if (q == NULL) return False; - - DBG_RW_SVAL(name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, *data16) - ps->data_offset += sizeof(uint16); - - return True; -} - -/******************************************************************* - do IO on a uint8. - ********************************************************************/ -BOOL io_uint8(char *name, io_struct *ps, int depth, uint8 *data8, unsigned flags) -{ - char *q; - - if (!(flags & PARSE_SCALARS)) return True; - - q = io_mem_get(ps, sizeof(uint8)); - if (q == NULL) return False; - - DBG_RW_IVAL(name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, *data8) - ps->data_offset += sizeof(uint8); - - return True; -} - -/******************************************************************* - do IO on a pointer - ********************************************************************/ -BOOL io_pointer(char *desc, io_struct *ps, int depth, void **p, unsigned flags) -{ - uint32 v; - - if (!(flags & PARSE_SCALARS)) return True; - - v = (*p) ? 0xdeadbeef : 0; - if (!io_uint32(desc, ps, depth, &v, flags)) return False; - *p = (void *) (v ? 0xdeadbeef : 0); - return True; -} - -/******************************************************************* - Stream a null-terminated string. - ********************************************************************/ -BOOL io_SMBSTR(char *name, io_struct *ps, int depth, char **str, unsigned flags) -{ - char *q; - uint8 *start; - int i; - size_t len; - int start_offset = ps->data_offset; - - if (!(flags & PARSE_SCALARS)) return True; - - if (UNMARSHALLING(ps)) { - *str = io_mem_get(ps, 0); - if (*str == NULL) - return False; - len = strlen(*str); - ps->data_offset += len + 1; - } - else - { - len = strlen(*str)+1; - start = (uint8*)q; - - for(i = 0; i < len; i++) { - q = io_mem_get(ps, 1); - if (q == NULL) - return False; - - RW_CVAL(ps->io, q, (*str)[i],0); - ps->data_offset++; - } - } - - DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), - start_offset, name, *str)); - return True; -} - -/****************************************************************** - do IO on a byte array - ********************************************************************/ -BOOL io_uint8s(char *name, io_struct *ps, int depth, uint8 **data8s, int len, unsigned flags) -{ - char *q; - size_t num_bytes = len * sizeof(uint8); - - if (!(flags & PARSE_SCALARS)) return True; - - q = io_mem_get(ps, num_bytes); - if (q == NULL) return False; - - if (MARSHALLING(ps)) - { - DBG_RW_PCVAL(True, name, depth, ps->data_offset, ps->io, q, *data8s, len) - } - else - { - *data8s = q; - dump_data(depth+5, *data8s, num_bytes); - } - ps->data_offset += num_bytes; - - return True; -} -/****************************************************************** - do IO on a fixed-size byte array - ********************************************************************/ -BOOL io_uint8s_fixed(char *name, io_struct *ps, int depth, uint8 *data8s, int len, unsigned flags) -{ - char *q; - size_t num_bytes = len * sizeof(uint8); - - if (!(flags & PARSE_SCALARS)) return True; - - q = io_mem_get(ps, num_bytes); - if (q == NULL) return False; - - DBG_RW_PCVAL(True, name, depth, ps->data_offset, ps->io, q, data8s, len) - ps->data_offset += num_bytes; - - return True; -} - - -/****************************************************************** - do IO on an io (eh?? :) - ********************************************************************/ -BOOL io_io_struct(char *name, io_struct *ps, int depth, io_struct *io, unsigned flags) -{ - char *q; - uint16 len; - - if (!(flags & PARSE_SCALARS)) return True; - - q = io_mem_get(ps, sizeof(uint16)); - if (q == NULL) return False; - - /* length first */ - if (MARSHALLING(ps)) - { - len = io->data_offset; - } - if (!io_uint16("len", ps, depth+1, &len, flags)) - { - return False; - } - if (UNMARSHALLING(ps)) - { - if (!io_init(io, len, UNMARSHALL)) - { - return False; - } - } - - /* now data */ - q = io_mem_get(ps, len * sizeof(uint8)); - if (q == NULL) return False; - - if (MARSHALLING(ps)) - { - DBG_RW_PCVAL(False, name, depth+1, ps->data_offset, ps->io, q, io->data_p, len) - } - else - { - io->data_p = q; - dump_data(depth+5, q, len); - } - ps->data_offset += len; - - return True; -} - -/****************************************************************** - do IO on a unicode array - ********************************************************************/ -BOOL io_wstring(char *name, io_struct *ps, int depth, uint16 *data16s, int len, unsigned flags) -{ - char *q; - - if (!(flags & PARSE_SCALARS)) return True; - - if (!io_align(ps, 2)) return False; - - q = io_mem_get(ps, len * sizeof(uint16)); - if (q == NULL) return False; - - DBG_RW_PSVAL(True, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, data16s, len) - ps->data_offset += (len * sizeof(uint16)); - - return True; -} - - -/****************************************************************** -allocate some memory for a parse structure - ********************************************************************/ -void io_free(io_struct *ps) -{ - if (ps->is_dynamic && ps->data_p) - { - free(ps->data_p); - ps->data_p = NULL; - } -} - -/****************************************************************** -allocate some memory for a parse structure - ********************************************************************/ -BOOL io_alloc(char *name, io_struct *ps, void **ptr, unsigned size) -{ - (*ptr) = (void *)malloc(size); - if (*ptr) return True; - return False; -} - -/****************************************************************** -realloc some memory for a parse structure - ********************************************************************/ -BOOL io_realloc(char *name, io_struct *ps, void **ptr, unsigned size) -{ - BOOL ret = True; - void *tp; - - tp = (void *)Realloc(*ptr, size); - if (tp) *ptr = tp; - else ret = False; - return ret; -} - diff --git a/source3/aparser/parser.h b/source3/aparser/parser.h deleted file mode 100644 index 24b0cd1930..0000000000 --- a/source3/aparser/parser.h +++ /dev/null @@ -1,103 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "include/byteorder.h" - -#define PARSE_SCALARS (1<<0) -#define PARSE_BUFFERS (1<<1) - -#ifndef MIN -#define MIN(a,b) ((a)<(b)?(a):(b)) -#endif - -#ifndef MAX -#define MAX(a,b) ((a)>(b)?(a):(b)) -#endif - -#define DEBUG(lvl, str) printf str; -#define DEBUGADD(lvl, str) printf str; - -#define MARSHALL 0 -#define UNMARSHALL 1 - -#define MARSHALLING(ps) (!(ps)->io) -#define UNMARSHALLING(ps) ((ps)->io) - -typedef int BOOL; -typedef unsigned char uint8; -typedef unsigned char uchar; -typedef unsigned short uint16; -typedef unsigned short wchar; -typedef unsigned uint32; -typedef char *SMBSTR; - -/* a null terminated unicode string */ -typedef uint16 ZUSTRING; - -#ifndef _PSTRING - -#define PSTRING_LEN 1024 -#define FSTRING_LEN 128 - -typedef char pstring[PSTRING_LEN]; -typedef char fstring[FSTRING_LEN]; - -#define _PSTRING - -#endif -#define False 0 -#define True 1 - -/* zero a structure given a pointer to the structure */ -#define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0) - -#define MAX_UNISTRLEN 256 -#define MAX_STRINGLEN 256 -#define MAX_BUFFERLEN 512 - -typedef struct _io_struct -{ - BOOL io; /* parsing in or out of data stream */ - /* - * If the (incoming) data is big-endian. On output we are - * always little-endian. - */ - BOOL bigendian_data; - BOOL is_dynamic; /* Do we own this memory or not ? */ - BOOL autoalign; /* should we auto-align all elements? */ - uint32 data_offset; /* Current working offset into data. */ - uint32 buffer_size; /* Current size of the buffer. */ - uint32 grow_size; /* size requested via io_grow() calls */ - char *data_p; /* The buffer itself. */ -} io_struct; - - -char *io_mem_get(io_struct *ps, uint32 extra_size); -BOOL io_init(io_struct *ps, uint32 size, BOOL io); -void io_debug(io_struct *ps, int depth, char *desc, char *fn_name); -BOOL io_align(io_struct *ps, int align); -BOOL io_align4(io_struct *ps, int align); -BOOL io_align2(io_struct *ps, int align); -BOOL io_read(io_struct *ps, int fd, size_t len, int timeout); -void dump_data(int level,char *buf1,int len); -BOOL io_alloc(char *name, io_struct *ps, void **ptr, unsigned size); -BOOL io_uint32(char *name, io_struct *ps, int depth, uint32 *data32, unsigned flags); -BOOL io_uint16(char *name, io_struct *ps, int depth, uint16 *data16, unsigned flags); -BOOL io_uint8(char *name, io_struct *ps, int depth, uint8 *data8, unsigned flags); -BOOL io_pointer(char *desc, io_struct *ps, int depth, void **p, unsigned flags); -BOOL io_SMBSTR(char *name, io_struct *ps, int depth, char **str, unsigned flags); -BOOL io_io_struct(char *name, io_struct *ps, int depth, io_struct *io, unsigned flags); -BOOL io_wstring(char *name, io_struct *ps, int depth, uint16 *data16s, int len, unsigned flags); -BOOL io_uint8s_fixed(char *name, io_struct *ps, int depth, uint8 *data8s, int len, unsigned flags); -BOOL io_uint8s(char *name, io_struct *ps, int depth, uint8 **data8s, int len, unsigned flags); - -char *tab_depth(int depth); -void *Realloc(void *p,size_t size); -void dump_data(int level,char *buf1,int len); -void print_asc(int level, uchar const *buf, int len); -BOOL io_ZUSTRING(char *name, io_struct *ps, int depth, uint16 **ustr, unsigned flags); -size_t strlen_w(void *src); - diff --git a/source3/aparser/parserel.awk b/source3/aparser/parserel.awk deleted file mode 100644 index 6d80f0607e..0000000000 --- a/source3/aparser/parserel.awk +++ /dev/null @@ -1,213 +0,0 @@ -# build parse functions for a parsed struct file - -function elem_name(v, elem) -{ - return v["UNION"]elem; -} - -function parse_array(f, v, elnum, flags, - LOCAL, type, elem, array_len) -{ - type = elements[elnum, "type"]; - elem = elements[elnum, "elem"]; - array_len = elements[elnum, "array_len"]; - v["ELEM"] = elem_name(v, elem); - v["TYPE"] = type; - v["FLAGS"] = flags; - v["ARRAY_LEN"] = array_len; - - if (array_len=="+") { - print_template(f,"prs_array_optional.tpl", v); - return; - } - - if (array_len=="&") { - print_template(f,"prs_array_null.tpl", v); - return; - } - - if (array_len=="*") { - print_template(f,"prs_array_remainder.tpl", v); - return; - } - - if (type == "wchar" || type == "uint16") { - if (match(array_len,"[0-9]") == 1) { - print_template(f, "prs_wstring_fixed.tpl", v); - } else { - print_template(f, "prs_wstring.tpl", v); - } - } else if (type == "uint8") { - if (match(array_len,"[0-9]") == 1) { - print_template(f, "prs_uint8s_fixed.tpl", v); - } else { - print_template(f, "prs_uint8s.tpl", v); - } - } else { - print_template(f, "prs_array.tpl", v); - } -} - - -function parse_element(f, v, elnum, flags, - LOCAL, type, elem) -{ - if (elements[elnum,"nowire"] != "") { - return; - } - type = elements[elnum, "type"]; - if (substr(type,1,1) == ".") return; - elem = elements[elnum, "elem"]; - if (elements[elnum,"ptr"] == "") { - v["PTR"] = "\\&"; - } else { - v["PTR"] = " "; - } - v["ELEM"] = elem_name(v, elem); - v["TYPE"] = type; - v["FLAGS"] = flags; - print_template(f, "prs_element.tpl", v); -} - -function parse_union(f, v, elnum, flags, - LOCAL, i) -{ - v["UNION"] = elements[elnum, "elem"]; - v["SWITCH"] = elements[elnum, "switch"]; - - if (elements[elnum, "ptr"] == "1") { - v["UNION"] = v["UNION"]"->"; - } else { - v["UNION"] = v["UNION"]"."; - } - - print_template(f, "union_start.tpl", v); - for (i=0;i 0) { - while ((i = match(line,"@[a-zA-Z_]*@")) != 0) { - pat=substr(line,i+1,RLENGTH-2); - if (v[pat] == "") fatal("no value for "pat" in "tplname); - gsub("@"pat"@", v[pat], line); - } - - xprintf(f, "%s\n", line); - } - close(tplname); -} diff --git a/source3/aparser/templates/fn_end.tpl b/source3/aparser/templates/fn_end.tpl deleted file mode 100644 index 2275ec4e33..0000000000 --- a/source3/aparser/templates/fn_end.tpl +++ /dev/null @@ -1,13 +0,0 @@ - -end: - /* the parse is OK */ - return True; - -fail: - if (UNMARSHALLING(ps)) { - ZERO_STRUCTP(il); - } - return False; -} /* @FUNCNAME@ */ - - diff --git a/source3/aparser/templates/fn_end0.tpl b/source3/aparser/templates/fn_end0.tpl deleted file mode 100644 index 6e49a10f53..0000000000 --- a/source3/aparser/templates/fn_end0.tpl +++ /dev/null @@ -1,8 +0,0 @@ - -end: - /* the parse is OK */ - return True; - -} /* @FUNCNAME@ */ - - diff --git a/source3/aparser/templates/fn_i_end.tpl b/source3/aparser/templates/fn_i_end.tpl deleted file mode 100644 index 9de61decb3..0000000000 --- a/source3/aparser/templates/fn_i_end.tpl +++ /dev/null @@ -1,12 +0,0 @@ - - /* the parse is OK */ - return True; - -fail: - if (UNMARSHALLING(ps)) { - ZERO_STRUCTP(il); - } - return False; -} /* @FUNCNAME@ */ - - diff --git a/source3/aparser/templates/fn_i_start.tpl b/source3/aparser/templates/fn_i_start.tpl deleted file mode 100644 index 3979d78e7d..0000000000 --- a/source3/aparser/templates/fn_i_start.tpl +++ /dev/null @@ -1,15 +0,0 @@ -/******************************************************************* -parse a @STRUCTNAME@ structure -********************************************************************/ -BOOL @FUNCNAME@(char *desc, io_struct *ps, int depth, - @STRUCTNAME@ *il, unsigned flags) -{ - io_debug(ps, depth, desc, "@FUNCNAME@"); - depth++; - -#if 0 - if (UNMARSHALLING(ps)) { - ZERO_STRUCTP(il); - } -#endif - /* parse the scalars */ diff --git a/source3/aparser/templates/fn_mid.tpl b/source3/aparser/templates/fn_mid.tpl deleted file mode 100644 index b81de92a5b..0000000000 --- a/source3/aparser/templates/fn_mid.tpl +++ /dev/null @@ -1,6 +0,0 @@ - -buffers: - if (!(flags & PARSE_BUFFERS)) goto end; - - /* now parse the buffers */ - diff --git a/source3/aparser/templates/fn_start.tpl b/source3/aparser/templates/fn_start.tpl deleted file mode 100644 index a5d58767a6..0000000000 --- a/source3/aparser/templates/fn_start.tpl +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************* -parse a @STRUCTNAME@ structure -********************************************************************/ -BOOL @FUNCNAME@(char *desc, io_struct *ps, int depth, - @STRUCTNAME@ *il, unsigned flags) -{ - io_debug(ps, depth, desc, "@FUNCNAME@"); - depth++; - - if (!(flags & PARSE_SCALARS)) goto buffers; - -#if 0 - if (UNMARSHALLING(ps)) { - ZERO_STRUCTP(il); - } -#endif - /* parse the scalars */ diff --git a/source3/aparser/templates/harness.tpl b/source3/aparser/templates/harness.tpl deleted file mode 100644 index 27c33c0adc..0000000000 --- a/source3/aparser/templates/harness.tpl +++ /dev/null @@ -1,5 +0,0 @@ - - if (strcmp(test,"@TEST@")==0) { - @TEST@ il; - ret = io_@TEST@("@TEST@", ps, 0, &il, flags); - } else diff --git a/source3/aparser/templates/harness_end.tpl b/source3/aparser/templates/harness_end.tpl deleted file mode 100644 index 1e15faec16..0000000000 --- a/source3/aparser/templates/harness_end.tpl +++ /dev/null @@ -1,7 +0,0 @@ - { - printf("structure %s not found\n", test); - ret = False; - } - - return ret; -} diff --git a/source3/aparser/templates/harness_start.tpl b/source3/aparser/templates/harness_start.tpl deleted file mode 100644 index beba6fc12d..0000000000 --- a/source3/aparser/templates/harness_start.tpl +++ /dev/null @@ -1,7 +0,0 @@ -#include "prs_@MODULE@.c" - -static BOOL run_test(char *test, io_struct *ps, int flags) -{ - BOOL ret; - - diff --git a/source3/aparser/templates/ifptr_end.tpl b/source3/aparser/templates/ifptr_end.tpl deleted file mode 100644 index 990635cf45..0000000000 --- a/source3/aparser/templates/ifptr_end.tpl +++ /dev/null @@ -1 +0,0 @@ - } diff --git a/source3/aparser/templates/ifptr_start.tpl b/source3/aparser/templates/ifptr_start.tpl deleted file mode 100644 index 228b84bac9..0000000000 --- a/source3/aparser/templates/ifptr_start.tpl +++ /dev/null @@ -1,2 +0,0 @@ - if (il->@ELEM@) { - if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@)))) goto fail; diff --git a/source3/aparser/templates/module_end.tpl b/source3/aparser/templates/module_end.tpl deleted file mode 100644 index 661f7edb95..0000000000 --- a/source3/aparser/templates/module_end.tpl +++ /dev/null @@ -1,3 +0,0 @@ - - -/* end auto-generated structure parsers for @MODULE@ */ diff --git a/source3/aparser/templates/module_start.tpl b/source3/aparser/templates/module_start.tpl deleted file mode 100644 index ac6a3c9d98..0000000000 --- a/source3/aparser/templates/module_start.tpl +++ /dev/null @@ -1,5 +0,0 @@ -/* auto-generated structure parsers for @MODULE@ - generated by aparser -*/ -#include "prs_@MODULE@.h" - diff --git a/source3/aparser/templates/prs_.align.tpl b/source3/aparser/templates/prs_.align.tpl deleted file mode 100644 index 25816a23b3..0000000000 --- a/source3/aparser/templates/prs_.align.tpl +++ /dev/null @@ -1 +0,0 @@ - if(!io_align(ps)) goto fail; diff --git a/source3/aparser/templates/prs_align2.tpl b/source3/aparser/templates/prs_align2.tpl deleted file mode 100644 index 54c569b547..0000000000 --- a/source3/aparser/templates/prs_align2.tpl +++ /dev/null @@ -1 +0,0 @@ - if (!io_align2(ps, @OFFSET@)) goto fail; diff --git a/source3/aparser/templates/prs_align4.tpl b/source3/aparser/templates/prs_align4.tpl deleted file mode 100644 index 702fab1324..0000000000 --- a/source3/aparser/templates/prs_align4.tpl +++ /dev/null @@ -1 +0,0 @@ - if (!io_align4(ps, @OFFSET@)) goto fail; diff --git a/source3/aparser/templates/prs_array.tpl b/source3/aparser/templates/prs_array.tpl deleted file mode 100644 index 4bd6a26c99..0000000000 --- a/source3/aparser/templates/prs_array.tpl +++ /dev/null @@ -1,8 +0,0 @@ - if ((@FLAGS@ & PARSE_SCALARS) && - !io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*(il->@ARRAY_LEN@))) goto fail; - { - int i; - for (i=0;i@ARRAY_LEN@;i++) { - if (!io_@TYPE@("@ELEM@...", ps, depth+1, &il->@ELEM@[i], @FLAGS@)) goto fail; - } - } diff --git a/source3/aparser/templates/prs_array_optional.tpl b/source3/aparser/templates/prs_array_optional.tpl deleted file mode 100644 index 38bd32861f..0000000000 --- a/source3/aparser/templates/prs_array_optional.tpl +++ /dev/null @@ -1,5 +0,0 @@ - if ((MARSHALLING(ps) && il->@ELEM@) || - ps->data_offset < ps->buffer_size) { - if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@)))) goto fail; - if (!io_@TYPE@("@ELEM@...", ps, depth+1, il->@ELEM@, @FLAGS@)) goto fail; - } diff --git a/source3/aparser/templates/prs_array_remainder.tpl b/source3/aparser/templates/prs_array_remainder.tpl deleted file mode 100644 index c8b1e2ab5a..0000000000 --- a/source3/aparser/templates/prs_array_remainder.tpl +++ /dev/null @@ -1,17 +0,0 @@ - if (UNMARSHALLING(ps)) - { - int i; - for (i=0;ps->data_offset < ps->buffer_size;i++) { - if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*(i+1))) goto fail; - if (!io_@TYPE@("@ELEM@...", ps, depth+1, &il->@ELEM@[i], @FLAGS@)) goto fail; - } - } - else - { - int i = -1; - /* HACK ALERT! */ - do { - i++; - if (!io_@TYPE@("@ELEM@...", ps, depth+1, &il->@ELEM@[i], @FLAGS@)) goto fail; - } while (il->@ELEM@[i].tag2 != 0); - } diff --git a/source3/aparser/templates/prs_break.tpl b/source3/aparser/templates/prs_break.tpl deleted file mode 100644 index eb540f7be8..0000000000 --- a/source3/aparser/templates/prs_break.tpl +++ /dev/null @@ -1 +0,0 @@ - break; diff --git a/source3/aparser/templates/prs_case.tpl b/source3/aparser/templates/prs_case.tpl deleted file mode 100644 index 06c1bd3ae6..0000000000 --- a/source3/aparser/templates/prs_case.tpl +++ /dev/null @@ -1 +0,0 @@ - case @CASE@: diff --git a/source3/aparser/templates/prs_case_end.tpl b/source3/aparser/templates/prs_case_end.tpl deleted file mode 100644 index eb540f7be8..0000000000 --- a/source3/aparser/templates/prs_case_end.tpl +++ /dev/null @@ -1 +0,0 @@ - break; diff --git a/source3/aparser/templates/prs_element.tpl b/source3/aparser/templates/prs_element.tpl deleted file mode 100644 index e8bf5180ce..0000000000 --- a/source3/aparser/templates/prs_element.tpl +++ /dev/null @@ -1 +0,0 @@ - if (!io_@TYPE@("@ELEM@", ps, depth+1, @PTR@il->@ELEM@, @FLAGS@)) goto fail; diff --git a/source3/aparser/templates/prs_pointer.tpl b/source3/aparser/templates/prs_pointer.tpl deleted file mode 100644 index 4ebcf19d83..0000000000 --- a/source3/aparser/templates/prs_pointer.tpl +++ /dev/null @@ -1,2 +0,0 @@ - if (!io_pointer("@ELEM@_ptr", ps, depth+1, - (void **)&il->@ELEM@, @FLAGS@)) goto fail; diff --git a/source3/aparser/templates/prs_struct.tpl b/source3/aparser/templates/prs_struct.tpl deleted file mode 100644 index ab8246db8e..0000000000 --- a/source3/aparser/templates/prs_struct.tpl +++ /dev/null @@ -1 +0,0 @@ - if (!@MODULE@_io_@TYPE@("@ELEM@", &il->@ELEM@, ps, depth+1)) goto fail; diff --git a/source3/aparser/templates/prs_struct_alloc.tpl b/source3/aparser/templates/prs_struct_alloc.tpl deleted file mode 100644 index 9eae5c92fc..0000000000 --- a/source3/aparser/templates/prs_struct_alloc.tpl +++ /dev/null @@ -1 +0,0 @@ - if (!@MODULE@_io_@TYPE@_alloc("@ELEM@", &il->@ELEM@, ps, depth+1)) goto fail; diff --git a/source3/aparser/templates/prs_uint16.tpl b/source3/aparser/templates/prs_uint16.tpl deleted file mode 100644 index b40d6d4216..0000000000 --- a/source3/aparser/templates/prs_uint16.tpl +++ /dev/null @@ -1 +0,0 @@ - if (!io_uint16("@ELEM@", ps, depth+1, &il->@ELEM@)) goto fail; diff --git a/source3/aparser/templates/prs_uint32.tpl b/source3/aparser/templates/prs_uint32.tpl deleted file mode 100644 index eb76715d28..0000000000 --- a/source3/aparser/templates/prs_uint32.tpl +++ /dev/null @@ -1 +0,0 @@ - if (!io_uint32("@ELEM@", ps, depth+1, &il->@ELEM@)) goto fail; diff --git a/source3/aparser/templates/prs_uint8s.tpl b/source3/aparser/templates/prs_uint8s.tpl deleted file mode 100644 index 967162213f..0000000000 --- a/source3/aparser/templates/prs_uint8s.tpl +++ /dev/null @@ -1,2 +0,0 @@ - if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*(il->@ARRAY_LEN@))) goto fail; - if (!io_uint8s("@ELEM@", ps, depth+1, &il->@ELEM@, il->@ARRAY_LEN@, @FLAGS@)) goto fail; diff --git a/source3/aparser/templates/prs_uint8s_fixed.tpl b/source3/aparser/templates/prs_uint8s_fixed.tpl deleted file mode 100644 index 26597f419f..0000000000 --- a/source3/aparser/templates/prs_uint8s_fixed.tpl +++ /dev/null @@ -1 +0,0 @@ - if (!io_uint8s_fixed("@ELEM@", ps, depth+1, il->@ELEM@, @ARRAY_LEN@, @FLAGS@)) goto fail; diff --git a/source3/aparser/templates/prs_wstring.tpl b/source3/aparser/templates/prs_wstring.tpl deleted file mode 100644 index 4de46f093c..0000000000 --- a/source3/aparser/templates/prs_wstring.tpl +++ /dev/null @@ -1,2 +0,0 @@ - if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*(il->@ARRAY_LEN@))) goto fail; - if (!io_wstring("@ELEM@", ps, depth+1, il->@ELEM@, il->@ARRAY_LEN@, @FLAGS@)) goto fail; diff --git a/source3/aparser/templates/prs_wstring_fixed.tpl b/source3/aparser/templates/prs_wstring_fixed.tpl deleted file mode 100644 index e33f7c3d5d..0000000000 --- a/source3/aparser/templates/prs_wstring_fixed.tpl +++ /dev/null @@ -1,2 +0,0 @@ - if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*(@ARRAY_LEN@))) goto fail; - if (!io_wstring("@ELEM@", ps, depth+1, il->@ELEM@, @ARRAY_LEN@, @FLAGS@)) goto fail; diff --git a/source3/aparser/templates/union_end.tpl b/source3/aparser/templates/union_end.tpl deleted file mode 100644 index 511adbcf60..0000000000 --- a/source3/aparser/templates/union_end.tpl +++ /dev/null @@ -1,5 +0,0 @@ - default: - DEBUG(5,("No handler for case %d in @FUNCNAME@\n", - (int)il->@SWITCH@)); - goto fail; - } diff --git a/source3/aparser/templates/union_start.tpl b/source3/aparser/templates/union_start.tpl deleted file mode 100644 index aa052be697..0000000000 --- a/source3/aparser/templates/union_start.tpl +++ /dev/null @@ -1 +0,0 @@ - switch (il->@SWITCH@) { diff --git a/source3/aparser/token.awk b/source3/aparser/token.awk deleted file mode 100644 index fb2982f077..0000000000 --- a/source3/aparser/token.awk +++ /dev/null @@ -1,180 +0,0 @@ -# tokenise the input file - -function parse_error(msg) { - printf("PARSE ERROR: %s\nLine "NR" : "$0"\n", msg); - exit 1; -} - -# ignore multi-line C comments. -{ - if (t = index($0, "/*")) { - if (t > 1) - tmp = substr($0, 1, t - 1) - else - tmp = "" - u = index(substr($0, t + 2), "*/") - while (u == 0) { - getline - t = -1 - u = index($0, "*/") - } - if (u <= length($0) - 2) - $0 = tmp substr($0, t + u + 3) - else - $0 = tmp - } -} - -# ignore blank lines -/^[ \t]*$/ { - next; -} - -/^\#define.*/ { - split($0,a,"[ \t;]*"); - parse_define(a[2], a[3]); - next; -} - -# ignore comments -/^[ \t]*\#/ { - next; -} - -/^[ \t]*module/ { - {if (module!="") parse_error("you can only specify one module name");} - start_module($2); - next; -} - -{if (module=="") parse_error("you must specify the module name first");} - -/^[ \t]*option/ { - set_option($2, $3); - next; -} - -/^[ \t]*typedef struct.*\{/ { - {if (current_struct!="") parse_error("you cannot have nested structures");} - start_struct($3); - next; -} - -/^[ \t]*struct.*\{/ { - {if (current_struct!="") parse_error("you cannot have nested structures");} - start_struct($2); - next; -} - -/^[ \t]*typedef union.*\{/ { - {if (current_struct!="") parse_error("this cannot appear inside a structure");} - split($0,a,"[ \t;()]*"); - start_union_encap(a[4], a[6], a[7], a[8]); - next; -} - -/^[ \t]*void.*\(/ { - {if (current_struct!="") parse_error("you cannot have nested structures");} - split($0,a,"[ \t;()]*"); - start_function(a[2], a[3]); - return_result="void"; - next; -} - -/^[ \t]*STATUS.*\(|^[ \t]*void.*\(/ { - {if (current_struct!="") parse_error("you cannot have nested structures");} - split($0,a,"[ \t;()]*"); - start_function(a[2], a[3]); - return_result="STATUS"; - next; -} - -{if (current_struct=="") parse_error("this must appear inside a structure");} - -/^[ \t]*union.*\{/ { - {if (current_union!="") parse_error("you cannot have nested unions");} - start_union($2); - next; -} - -/^[ \t]*\[switch_is.*union.*\{/ { - {if (current_union!="") parse_error("you cannot have nested unions");} - split($0,a,"[ \t;()]*"); - start_union_notencap(a[3]); - next; -} - -/^[ \t]*case.*;/ { - {if (current_union=="") parse_error("this must appear inide a union");} - split($0,a,"[ \t;]*"); - parse_case(a[3],a[4],a[5]); - next; -} - -/^[ \t]*\[case(.*)\].*;/ { - {if (current_union=="") parse_error("this must appear inide a union");} - split($0,a,"[ \t;()[\]]*"); - parse_case(a[6],a[8],a[9]); - next; -} - -/^[ \t]*\}$/ { - {if (current_union=="") parse_error("this must appear inside a union");} - end_union(""); - next; -} - -/^[ \t]*\} .*;/ { - if (current_union!="") { - split($2,a,"[ \t;]*"); - end_union(a[1]); - next; - } -} - -{if (current_union!="") parse_error("this cannot appear inside a union");} - -/^[ \t]*\};/ { - end_struct(""); - next; -} - -/^[ \t]*\} .*;/ { - split($2,a,"[ \t;]*"); - end_struct(a[1]); - next; -} - -/^[ \t]*\);/ { - end_function(); - return_result=""; - next; -} - -/^.*size_is.*\*.*;/ { - split($0,a,"[ \t;()]*"); - add_sizeis_array(a[3], a[5], a[6]); - next; -} - -/^.*;/ { - split($0,a,"[ \t;]*"); - add_struct_elem(a[2], a[3]); - next; -} - -/^[\t ]*void/ { - next; -} - -/^[ \t]*\[.*\].*/ { - split($0,a,"[ \t;]*"); - split(a[4], b, "[,]"); - add_function_param(a[2], a[3], b[1]); - next; -} - -{ - parse_error("Unknown construct."); -} - diff --git a/source3/aparser/util.awk b/source3/aparser/util.awk deleted file mode 100644 index 6c5594da68..0000000000 --- a/source3/aparser/util.awk +++ /dev/null @@ -1,39 +0,0 @@ -function isaptr(elem) -{ - if (substr(elem, 1, 1) == "*") { - return 1; - } - return 0; -} - -function noptr(elem) -{ - if (!isaptr(elem)) return elem; - return substr(elem, 2); -} - -function xprintf(f, fmt, v1, v2, v3, v4, v5, v6, v7) -{ - printf(fmt, v1, v2, v3, v4, v5, v6) > f; -} - -function fatal(why) -{ - printf("FATAL: %s\n", why); - exit 1; -} - -function numlines(fname, - LOCAL, line, count) -{ - count=0; - while ((getline line < fname) > 0) count++; - close(fname); - return count; -} - -# return 1 if the string is a constant -function is_constant(s) -{ - return match(s,"^[0-9]+$"); -} diff --git a/source3/aparser/util.c b/source3/aparser/util.c deleted file mode 100644 index ffa84dbfab..0000000000 --- a/source3/aparser/util.c +++ /dev/null @@ -1,112 +0,0 @@ -#include "parser.h" - - -/******************************************************************* - Count the number of characters (not bytes) in a unicode string. -********************************************************************/ -size_t strlen_w(void *src) -{ - size_t len; - - for (len = 0; SVAL(src, len*2); len++) ; - - return len; -} - -/**************************************************************************** -expand a pointer to be a particular size -****************************************************************************/ -void *Realloc(void *p,size_t size) -{ - void *ret=NULL; - - if (size == 0) { - if (p) free(p); - DEBUG(5,("Realloc asked for 0 bytes\n")); - return NULL; - } - - if (!p) - ret = (void *)malloc(size); - else - ret = (void *)realloc(p,size); - - if (!ret) - DEBUG(0,("Memory allocation error: failed to expand to %d bytes\n",(int)size)); - - return(ret); -} - - -char *tab_depth(int depth) -{ - static pstring spaces; - memset(spaces, ' ', depth * 4); - spaces[depth * 4] = 0; - return spaces; -} - -void print_asc(int level, uchar const *buf, int len) -{ - int i; - for (i = 0; i < len; i++) - { - DEBUGADD(level, ("%c", isprint(buf[i]) ? buf[i] : '.')); - } -} - -void dump_data(int level, char *buf1, int len) -{ - uchar const *buf = (uchar const *)buf1; - int i = 0; - if (buf == NULL) - { - DEBUG(level, ("dump_data: NULL, len=%d\n", len)); - return; - } - if (len < 0) - return; - if (len == 0) - { - DEBUG(level, ("\n")); - return; - } - - DEBUG(level, ("[%03X] ", i)); - for (i = 0; i < len;) - { - DEBUGADD(level, ("%02X ", (int)buf[i])); - i++; - if (i % 8 == 0) - DEBUGADD(level, (" ")); - if (i % 16 == 0) - { - print_asc(level, &buf[i - 16], 8); - DEBUGADD(level, (" ")); - print_asc(level, &buf[i - 8], 8); - DEBUGADD(level, ("\n")); - if (i < len) - DEBUGADD(level, ("[%03X] ", i)); - } - } - - if (i % 16 != 0) /* finish off a non-16-char-length row */ - { - int n; - - n = 16 - (i % 16); - DEBUGADD(level, (" ")); - if (n > 8) - DEBUGADD(level, (" ")); - while (n--) - DEBUGADD(level, (" ")); - - n = MIN(8, i % 16); - print_asc(level, &buf[i - (i % 16)], n); - DEBUGADD(level, (" ")); - n = (i % 16) - n; - if (n > 0) - print_asc(level, &buf[i - n], n); - DEBUGADD(level, ("\n")); - } -} diff --git a/source3/aparser/vluke.c b/source3/aparser/vluke.c deleted file mode 100644 index d3868f2753..0000000000 --- a/source3/aparser/vluke.c +++ /dev/null @@ -1,41 +0,0 @@ -#include "parser.h" -#include "test.h" - -int main(int argc, char *argv[]) -{ - BOOL ret; - char *fname, *test; - int fd; - struct stat st; - io_struct ps; - - if (argc < 3) { - printf("usage: vluke \n"); - exit(1); - } - - test = argv[1]; - fname = argv[2]; - - fd = open(fname,O_RDONLY); - if (fd == -1) { - perror(fname); - exit(1); - } - fstat(fd, &st); - - io_init(&ps, 0, MARSHALL); - ps.is_dynamic=True; - io_read(&ps, fd, st.st_size, 0); - ps.data_offset = 0; - ps.buffer_size = ps.grow_size; - ps.io = UNMARSHALL; - ps.autoalign = OPTION_autoalign; - ret = run_test(test, &ps, PARSE_SCALARS|PARSE_BUFFERS); - printf("\nret=%s\n", ret?"OK":"Bad"); - printf("Trailer is %d bytes\n\n", ps.grow_size - ps.data_offset); - if (ps.grow_size - ps.data_offset > 0) { - dump_data(0, ps.data_p + ps.data_offset, ps.grow_size - ps.data_offset); - } - return !ret; -} -- cgit