summaryrefslogtreecommitdiff
path: root/source3/aparser
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-05-22 09:09:37 +0000
committerAndrew Tridgell <tridge@samba.org>2000-05-22 09:09:37 +0000
commit943340a5a3f5d725e2cd35ab47f33083837cb904 (patch)
tree9e94688083bb5cc54cb44e4ac194fc3772345435 /source3/aparser
parent74d677ec591a715e28dba29a33ee40e1b1c2f830 (diff)
downloadsamba-943340a5a3f5d725e2cd35ab47f33083837cb904.tar.gz
samba-943340a5a3f5d725e2cd35ab47f33083837cb904.tar.bz2
samba-943340a5a3f5d725e2cd35ab47f33083837cb904.zip
more aparser stuff - we now handle everything but the idl headers in srvsvc.idl
(This used to be commit 5f1e8422d0ebc589cdfe95f1001a8e55cb60af4a)
Diffstat (limited to 'source3/aparser')
-rwxr-xr-xsource3/aparser/build2
-rw-r--r--source3/aparser/parser.c17
-rw-r--r--source3/aparser/parser.h5
-rw-r--r--source3/aparser/parsetree.awk115
-rw-r--r--source3/aparser/srvsvc2.struct631
-rw-r--r--source3/aparser/templates/fn_end.tpl4
-rw-r--r--source3/aparser/token.awk63
-rw-r--r--source3/aparser/vluke.c2
8 files changed, 699 insertions, 140 deletions
diff --git a/source3/aparser/build b/source3/aparser/build
index a8b49451f6..3c212cfe41 100755
--- a/source3/aparser/build
+++ b/source3/aparser/build
@@ -8,6 +8,6 @@ if ! igawk -f main.awk $file; then
fi
echo compiling vluke
-gcc -Wall -g -o vluke parser.c vluke.c
+gcc -Wall -o vluke parser.c vluke.c
echo done.
diff --git a/source3/aparser/parser.c b/source3/aparser/parser.c
index bcd317b57e..0e5f29b2bc 100644
--- a/source3/aparser/parser.c
+++ b/source3/aparser/parser.c
@@ -129,12 +129,11 @@ char *prs_mem_get(prs_struct *ps, uint32 extra_size)
Initialise a parse structure - malloc the data if requested.
********************************************************************/
-BOOL prs_init(prs_struct *ps, uint32 size, uint8 align, BOOL io)
+BOOL prs_init(prs_struct *ps, uint32 size, BOOL io)
{
ZERO_STRUCTP(ps);
ps->io = io;
ps->bigendian_data = False;
- ps->align = align;
ps->is_dynamic = False;
ps->data_offset = 0;
ps->buffer_size = 0;
@@ -168,12 +167,12 @@ void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name)
zeros.
********************************************************************/
-BOOL prs_align(prs_struct *ps)
+BOOL prs_align(prs_struct *ps, int align)
{
- uint32 mod = ps->data_offset & (ps->align-1);
+ uint32 mod = ps->data_offset & (align-1);
- if (ps->align != 0 && mod != 0) {
- uint32 extra_space = (ps->align - mod);
+ if (align != 0 && mod != 0) {
+ uint32 extra_space = (align - mod);
if(!prs_grow(ps, extra_space))
return False;
memset(&ps->data_p[ps->data_offset], '\0', (size_t)extra_space);
@@ -257,6 +256,8 @@ BOOL io_uint32(char *name, prs_struct *ps, int depth, uint32 *data32, unsigned f
if (!(flags & PARSE_SCALARS)) return True;
+ if (!prs_align(ps, 4)) return False;
+
q = prs_mem_get(ps, sizeof(uint32));
if (q == NULL) return False;
@@ -275,6 +276,8 @@ BOOL io_uint16(char *name, prs_struct *ps, int depth, uint16 *data16, unsigned f
if (!(flags & PARSE_SCALARS)) return True;
+ if (!prs_align(ps, 2)) return False;
+
q = prs_mem_get(ps, sizeof(uint16));
if (q == NULL) return False;
@@ -326,6 +329,8 @@ BOOL io_wstring(char *name, prs_struct *ps, int depth, uint16 *data16s, int len,
if (!(flags & PARSE_SCALARS)) return True;
+ if (!prs_align(ps, 2)) return False;
+
q = prs_mem_get(ps, len * sizeof(uint16));
if (q == NULL) return False;
diff --git a/source3/aparser/parser.h b/source3/aparser/parser.h
index 5c3a14c66f..52d1b83941 100644
--- a/source3/aparser/parser.h
+++ b/source3/aparser/parser.h
@@ -48,7 +48,6 @@ typedef struct _prs_struct
* always little-endian.
*/
BOOL bigendian_data;
- uint8 align; /* data alignment */
BOOL is_dynamic; /* Do we own this memory or not ? */
uint32 data_offset; /* Current working offset into data. */
uint32 buffer_size; /* Current size of the buffer. */
@@ -58,9 +57,9 @@ typedef struct _prs_struct
char *prs_mem_get(prs_struct *ps, uint32 extra_size);
-BOOL prs_init(prs_struct *ps, uint32 size, uint8 align, BOOL io);
+BOOL prs_init(prs_struct *ps, uint32 size, BOOL io);
void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name);
-BOOL prs_align(prs_struct *ps);
+BOOL prs_align(prs_struct *ps, int align);
void print_asc(int level, unsigned char *buf,int len);
BOOL prs_read(prs_struct *ps, int fd, size_t len, int timeout);
void dump_data(int level,char *buf1,int len);
diff --git a/source3/aparser/parsetree.awk b/source3/aparser/parsetree.awk
index 6fee6e2a4a..832cd5f2e8 100644
--- a/source3/aparser/parsetree.awk
+++ b/source3/aparser/parsetree.awk
@@ -1,5 +1,14 @@
# build the parse tree for a struct file
+function find_structure(name,
+ LOCAL, i)
+{
+ for (i=0;i<num_structs;i++) {
+ if (structs[i, "name"] == name) return i;
+ }
+ return "-1";
+}
+
function start_module(name)
{
module=name;
@@ -81,15 +90,119 @@ function start_union(elem)
unions[current_union, "num_elems"] = 0;
}
+function start_union_notencap(switch)
+{
+ add_struct_elem("uint32", "switch_"switch);
+ start_union("UNKNOWN[switch_"switch"]");
+}
+
+function start_union_encap(struct, type, switch, union)
+{
+ start_struct(struct);
+ add_struct_elem(type, switch);
+ add_struct_elem(type, "switch_"switch);
+ start_union(union"[switch_"switch"]");
+ encap_union="1";
+}
+
function parse_case(case, type, elem,
LOCAL, elem_num)
{
+ split(case, a, "[:]");
+ case = a[1];
elem_num = unions[current_union, "num_elems"];
unions[current_union, elem_num] = add_element(type, elem, case);
unions[current_union, "num_elems"]++;
}
-function end_union()
+function end_union(name)
{
+ if (name!="") {
+ elements[current_union, "elem"] = name;
+ }
current_union="";
+ if (encap_union=="1") {
+ end_struct(name);
+ encap_union="0";
+ }
+}
+
+function delete_element(struct, elnum,
+ LOCAL, i)
+{
+ for (i=elnum;i<structs[struct,"num_elems"]-1;i++) {
+ structs[struct, i] = structs[struct, i+1];
+ }
+ structs[struct, "num_elems"]--;
+}
+
+function copy_struct(from, to,
+ LOCAL, i)
+{
+ for (i=0;i<structs[from,"num_elems"];i++) {
+ structs[to, i] = structs[from, i];
+ }
+ structs[to, "name"] = structs[from, "name"];
+ structs[to, "num_elems"] = structs[from, "num_elems"];
+ structs[to, "num_unions"] = structs[from, "num_unions"];
}
+
+function add_sizeis_array(count, type, elem)
+{
+ copy_struct(current_struct, current_struct+1);
+ elem=substr(elem,2);
+ start_struct("array_"current_struct"_"elem);
+ add_struct_elem("uint32", count);
+ add_struct_elem(type, elem"["count"]");
+ end_struct("");
+ current_struct=num_structs;
+ add_struct_elem("array_"current_struct-1"_"elem, "*"elem"_ptr");
+}
+
+
+function start_function(type, fname)
+{
+ start_struct(fname);
+ add_function_param("[in,out]",".trailer", "");
+}
+
+function end_function(LOCAL, i)
+{
+ copy_struct(num_structs, num_structs+1);
+ structs[num_structs, "name"] = "Q_"structs[num_structs, "name"];
+ for (i=0;i<structs[num_structs, "num_elems"];i++) {
+ if (match(elements[structs[num_structs, i], "properties"], "in") == 0) {
+ delete_element(num_structs, i);
+ i--;
+ }
+ }
+ end_struct();
+ current_struct=num_structs;
+ structs[num_structs, "name"] = "R_"structs[num_structs, "name"];
+ for (i=0;i<structs[num_structs, "num_elems"];i++) {
+ if (match(elements[structs[num_structs, i], "properties"], "out") == 0) {
+ delete_element(num_structs, i);
+ i--;
+ }
+ }
+ add_function_param("[out]", "STATUS", "status");
+ end_struct();
+}
+
+function add_function_param(properties, type, elem,
+ LOCAL, elnum, len)
+{
+ len=length(type);
+ if (substr(type, len) == "*") {
+ type=substr(type, 1, len-1);
+ elem="*"elem;
+ }
+ if (substr(elem,1,1) == "*" &&
+ (match(properties,"in") == 0 ||
+ find_structure(type) != "-1")) {
+ elem=substr(elem, 2);
+ }
+ elnum = add_struct_elem(type, elem);
+ elements[elnum, "properties"] = properties;
+}
+
diff --git a/source3/aparser/srvsvc2.struct b/source3/aparser/srvsvc2.struct
index 8c7c2e4155..bc80d3bc05 100644
--- a/source3/aparser/srvsvc2.struct
+++ b/source3/aparser/srvsvc2.struct
@@ -1,9 +1,9 @@
module srvsvc
-#define BOOL uint32;
-#define LONG uint32;
-#define DWORD uint32;
-#define STATUS uint32;
+#define BOOL uint32
+#define LONG uint32
+#define DWORD uint32
+#define STATUS uint32
typedef struct _UNISTR2 {
uint32 max_len;
@@ -16,6 +16,8 @@ struct LPWSTR {
UNISTR2 *str;
};
+
+
/* -- CHARACTER DEVICE INFORMATION -- */
typedef struct _CHARDEV_INFO_0 {
@@ -29,64 +31,289 @@ struct LPWSTR {
DWORD dwTime;
} CHARDEV_INFO_1;
- typedef struct _CHARDEV_INFO {
- DWORD dwLevel;
- union ctr[dwLevel] {
- case 1 CHARDEV_INFO_0 *ci0;
- case 2 CHARDEV_INFO_1 *ci1;
- }
+ typedef union _CHARDEV_INFO switch (DWORD dwLevel) ctr {
+ case 1: CHARDEV_INFO_0 *ci0;
+ case 2: CHARDEV_INFO_1 *ci1;
} CHARDEV_INFO;
typedef struct _CHARDEV_ENUM_0 {
DWORD dwEntries;
- CHARDEV_INFO_0 ci0[dwEntries];
+ [size_is(dwEntries)] CHARDEV_INFO_0 *ci0;
} CHARDEV_ENUM_0;
typedef struct _CHARDEV_ENUM_1 {
DWORD dwEntries;
- CHARDEV_INFO_1 ci1[dwEntries];
+ [size_is(dwEntries)] CHARDEV_INFO_1 *ci1;
} CHARDEV_ENUM_1;
typedef struct _CHARDEV_ENUM {
DWORD dwLevel;
- union ctr[dwLevel] {
- case 0 CHARDEV_ENUM_0 *ce0;
- case 1 CHARDEV_ENUM_1 *ce1;
- }
+ [switch_is(dwLevel)] union {
+ [case(0)] CHARDEV_ENUM_0 *ce0;
+ [case(1)] CHARDEV_ENUM_1 *ce1;
+ } ctr;
} CHARDEV_ENUM;
- struct Q_NetrCharDevEnum {
- .trailer;
- LPWSTR pszServer;
- CHARDEV_ENUM *pCharDevEnum;
- DWORD dwMaxLen;
- DWORD *hResume;
- };
+ STATUS NetrCharDevEnum( /* Function 0x00 */
+ [in,unique] LPWSTR pszServer,
+ [in,out] CHARDEV_ENUM* pCharDevEnum,
+ [in] DWORD dwMaxLen,
+ [out] DWORD* dwEntries,
+ [in,out] DWORD* hResume
+ );
+
+ STATUS NetrCharDevGetInfo( /* Function 0x01 */
+ [in,unique] LPWSTR pszServer,
+ [in,ref] LPWSTR pszDevice,
+ [in] DWORD dwLevel,
+ [out] CHARDEV_INFO* pCharDevInfo
+ );
+
+ STATUS NetrCharDevControl( /* Function 0x02 */
+ [in,unique] LPWSTR pszServer,
+ [in,ref] LPWSTR pszDevice,
+ [in] DWORD dwOpcode
+ );
+
+ /* -- CHARACTER DEVICE QUEUE INFORMATION -- */
+
+ typedef struct _CHARDEVQ_INFO_0 {
+ LPWSTR pszName;
+ } CHARDEVQ_INFO_0;
- struct R_NetrCharDevEnum {
- CHARDEV_ENUM *pCharDevEnum;
- DWORD *dwEntries;
- DWORD *hResume;
- .trailer;
- STATUS status;
- };
+ typedef struct _CHARDEVQ_INFO_1 {
+ LPWSTR pszName;
+ DWORD dwPriority;
+ LPWSTR pszDevices;
+ DWORD dwNumUsers;
+ DWORD dwNumAhead;
+ } CHARDEVQ_INFO_1;
+
+ typedef union _CHARDEVQ_INFO switch (DWORD dwLevel) ctr {
+ case 1: CHARDEVQ_INFO_0 *ci0;
+ case 2: CHARDEVQ_INFO_1 *ci1;
+ } CHARDEVQ_INFO;
+
+ typedef struct _CHARDEVQ_ENUM_0 {
+ DWORD dwEntries;
+ [size_is(dwEntries)] CHARDEVQ_INFO_0 *ci0;
+ } CHARDEVQ_ENUM_0;
+ typedef struct _CHARDEVQ_ENUM_1 {
+ DWORD dwEntries;
+ [size_is(dwEntries)] CHARDEVQ_INFO_1 *ci1;
+ } CHARDEVQ_ENUM_1;
+ typedef struct _CHARDEVQ_ENUM {
+ DWORD dwLevel;
+ [switch_is(dwLevel)] union {
+ [case(0)] CHARDEVQ_ENUM_0 *ce0;
+ [case(1)] CHARDEVQ_ENUM_1 *ce1;
+ } ctr;
+ } CHARDEVQ_ENUM;
+
+ STATUS NetrCharDevQEnum( /* Function 0x03 */
+ [in,unique] LPWSTR pszServer,
+ [in,unique] LPWSTR pszUser,
+ [in,out] CHARDEVQ_ENUM* pCharDevQEnum,
+ [in] DWORD dwMaxLen,
+ [out] DWORD* dwEntries,
+ [in,out] DWORD* hResume
+ );
+
+ STATUS NetrCharDevQGetInfo( /* Function 0x04 */
+ [in,unique] LPWSTR pszServer,
+ [in,ref] LPWSTR pszQueue,
+ [in,ref] LPWSTR pszUser,
+ [in] DWORD dwLevel,
+ [out] CHARDEVQ_INFO* pCharDevQInfo
+ );
+
+ STATUS NetrCharDevQSetInfo( /* Function 0x05 */
+ [in,unique] LPWSTR pszServer,
+ [in,ref] LPWSTR pszQueue,
+ [in] DWORD dwLevel,
+ [in] CHARDEVQ_INFO* pCharDevQInfo,
+ [in,out] DWORD* dwParmError
+ );
+
+ STATUS NetrCharDevQPurge( /* Function 0x06 */
+ [in,unique] LPWSTR pszServer,
+ [in,ref] LPWSTR pszQueue
+ );
+
+ STATUS NetrCharDevQPurgeSelf( /* Function 0x07 */
+ [in,unique] LPWSTR pszServer,
+ [in,ref] LPWSTR pszQueue,
+ [in,ref] LPWSTR pszComputer
+ );
+
+ /* -- CONNECTION INFORMATION -- */
+
+ typedef struct _CONNECTION_INFO_0 {
+ DWORD dwConnID;
+ } CONNECTION_INFO_0;
+
+ typedef struct _CONNECTION_INFO_1 {
+ DWORD dwConnID;
+ DWORD dwType;
+ DWORD dwNumOpens;
+ DWORD dwNumUsers;
+ DWORD dwTime;
+ LPWSTR pszUser;
+ LPWSTR pszShare;
+ } CONNECTION_INFO_1;
+
+ typedef struct _CONNECTION_ENUM_0 {
+ DWORD dwEntries;
+ [size_is(dwEntries)] CONNECTION_INFO_0 *ci0;
+ } CONNECTION_ENUM_0;
+ typedef struct _CONNECTION_ENUM_1 {
+ DWORD dwEntries;
+ [size_is(dwEntries)] CONNECTION_INFO_1 *ci1;
+ } CONNECTION_ENUM_1;
-# STATUS NetrCharDevGetInfo( /* Function 0x01 */
-# [in,unique] LPWSTR pszServer,
-# [in,ref] LPWSTR pszDevice,
-# [in] DWORD dwLevel,
-# [out] CHARDEV_INFO* pCharDevInfo
-# );
+ typedef struct _CONNECTION_ENUM {
+ DWORD dwLevel;
+ [switch_is(dwLevel)] union {
+ [case(0)] CONNECTION_ENUM_0 *ce0;
+ [case(1)] CONNECTION_ENUM_1 *ce1;
+ } ctr;
+ } CONNECTION_ENUM;
+
+ STATUS NetrConnectionEnum( /* Function 0x08 */
+ [in,unique] LPWSTR pszServer,
+ [in,unique] LPWSTR pszClient,
+ [in,out] CONNECTION_ENUM* pConnectionEnum,
+ [in] DWORD dwMaxLen,
+ [out] DWORD* dwEntries,
+ [in,out] DWORD* hResume
+ );
+
+ /* -- FILE INFORMATION -- */
+
+ typedef struct _FILE_INFO_2 {
+ DWORD dwFileID;
+ } FILE_INFO_2;
+
+ typedef struct _FILE_INFO_3 {
+ DWORD dwFileID;
+ DWORD dwPermissions;
+ DWORD dwNumLocks;
+ LPWSTR pszPath;
+ LPWSTR pszUser;
+ } FILE_INFO_3;
+
+ typedef union _FILE_INFO switch (DWORD dwLevel) ctr {
+ case 2: FILE_INFO_2 *fi2;
+ case 3: FILE_INFO_3 *fi3;
+ } FILE_INFO;
+
+ typedef struct _FILE_ENUM_2 {
+ DWORD dwEntries;
+ [size_is(dwEntries)] FILE_INFO_2 *fi2;
+ } FILE_ENUM_2;
-# STATUS NetrCharDevControl( /* Function 0x02 */
-# [in,unique] LPWSTR pszServer,
-# [in,ref] LPWSTR pszDevice,
-# [in] DWORD dwOpcode
-# );
+ typedef struct _FILE_ENUM_3 {
+ DWORD dwEntries;
+ [size_is(dwEntries)] FILE_INFO_3 *fi3;
+ } FILE_ENUM_3;
+ typedef struct _FILE_ENUM {
+ DWORD dwLevel;
+ [switch_is(dwLevel)] union {
+ [case(2)] FILE_ENUM_2 *fe2;
+ [case(3)] FILE_ENUM_3 *fe3;
+ } ctr;
+ } FILE_ENUM;
+
+ STATUS NetrFileEnum( /* Function 0x09 */
+ [in,unique] LPWSTR pszServer,
+ [in,unique] LPWSTR pszBasePath,
+ [in,unique] LPWSTR pszUser,
+ [in,out] FILE_ENUM* pFileEnum,
+ [in] DWORD dwMaxLen,
+ [out] DWORD* dwEntries,
+ [in,out] DWORD* hResume
+ );
+
+ STATUS NetrFileGetInfo( /* Function 0x0A */
+ [in,unique] LPWSTR pszServer,
+ [in] DWORD dwFileID,
+ [in] DWORD dwLevel,
+ [out] FILE_INFO* pFileInfo
+ );
+
+ STATUS NetrFileClose( /* Function 0x0B */
+ [in,unique] LPWSTR pszServer,
+ [in] DWORD dwFileID
+ );
+
+ /* -- SESSION INFORMATION -- */
+
+ typedef struct _SESSION_INFO_0 {
+ LPWSTR pszClient;
+ } SESSION_INFO_0;
+
+ typedef struct _SESSION_INFO_1 {
+ LPWSTR pszClient;
+ LPWSTR pszUser;
+ DWORD dwOpens;
+ DWORD dwTime;
+ DWORD dwIdleTime;
+ DWORD dwUserFlags;
+ } SESSION_INFO_1;
+
+ typedef struct _SESSION_INFO_2 {
+ LPWSTR pszClient;
+ LPWSTR pszUser;
+ DWORD dwOpens;
+ DWORD dwTime;
+ DWORD dwIdleTime;
+ DWORD dwUserFlags;
+ LPWSTR pszClientType;
+ } SESSION_INFO_2;
+
+ typedef struct _SESSION_ENUM_0 {
+ DWORD dwEntries;
+ [size_is(dwEntries)] SESSION_INFO_0 *si0;
+ } SESSION_ENUM_0;
+
+ typedef struct _SESSION_ENUM_1 {
+ DWORD dwEntries;
+ [size_is(dwEntries)] SESSION_INFO_1 *si1;
+ } SESSION_ENUM_1;
+
+ typedef struct _SESSION_ENUM_2 {
+ DWORD dwEntries;
+ [size_is(dwEntries)] SESSION_INFO_2 *si2;
+ } SESSION_ENUM_2;
+
+ typedef struct _SESSION_ENUM {
+ DWORD dwLevel;
+ [switch_is(dwLevel)] union {
+ [case(0)] SESSION_ENUM_0 *se0;
+ [case(1)] SESSION_ENUM_1 *se1;
+ [case(2)] SESSION_ENUM_2 *se2;
+ } ctr;
+ } SESSION_ENUM;
+
+ STATUS NetrSessionEnum( /* Function 0x0C */
+ [in,unique] LPWSTR pszServer,
+ [in,unique] LPWSTR pszClient,
+ [in,unique] LPWSTR pszUser,
+ [in,out] SESSION_ENUM* pFileEnum,
+ [in] DWORD dwMaxLen,
+ [out] DWORD* dwEntries,
+ [in,out] DWORD* hResume
+ );
+
+ STATUS NetrSessionDel( /* Function 0x0D */
+ [in,unique] LPWSTR pszServer,
+ [in,ref] LPWSTR pszClient,
+ [in,ref] LPWSTR pszUser
+ );
/* -- SHARE INFORMATION -- */
@@ -111,58 +338,83 @@ struct LPWSTR {
LPWSTR pszPasswd;
} SHARE_INFO_2;
- typedef struct _SHARE_INFO {
- DWORD dwLevel;
- union ctr[dwLevel] {
- case 0 SHARE_INFO_0 *si0;
- case 1 SHARE_INFO_1 *si1;
- case 2 SHARE_INFO_2 *si2;
- }
+ typedef union _SHARE_INFO switch (DWORD dwLevel) ctr {
+ case 0: SHARE_INFO_0 *si0;
+ case 1: SHARE_INFO_1 *si1;
+ case 2: SHARE_INFO_2 *si2;
} SHARE_INFO;
typedef struct _SHARE_ENUM_0 {
DWORD dwEntries;
- SHARE_INFO_0 si0[dwEntries];
+ [size_is(dwEntries)] SHARE_INFO_0 *si0;
} SHARE_ENUM_0;
typedef struct _SHARE_ENUM_1 {
DWORD dwEntries;
- SHARE_INFO_1 si1[dwEntries];
+ [size_is(dwEntries)] SHARE_INFO_1 *si1;
} SHARE_ENUM_1;
typedef struct _SHARE_ENUM_2 {
DWORD dwEntries;
- SHARE_INFO_2 si2[dwEntries];
+ [size_is(dwEntries)] SHARE_INFO_2 *si2;
} SHARE_ENUM_2;
typedef struct _SHARE_ENUM {
DWORD dwLevel;
- union ctr[dwLevel] {
- case 0 SHARE_ENUM_0 *se0;
- case 1 SHARE_ENUM_1 *se1;
- case 2 SHARE_ENUM_2 *se2;
- }
+ [switch_is(dwLevel)] union {
+ [case(0)] SHARE_ENUM_0 *se0;
+ [case(1)] SHARE_ENUM_1 *se1;
+ [case(2)] SHARE_ENUM_2 *se2;
+ } ctr;
} SHARE_ENUM;
- struct Q_NetrShareEnum {
- .trailer;
- LPWSTR pszServer;
- uint32 level;
- SHARE_ENUM pShareEnum;
- DWORD *hResume;
- DWORD dwMaxLen;
- DWORD dummy;
- };
-
- struct R_NetrShareEnum {
- DWORD level;
- SHARE_ENUM pShareEnum;
- DWORD *dwEntries;
- DWORD *hResume;
- .trailer;
- STATUS status;
- };
-
+ STATUS NetrShareAdd( /* Function 0x0E */
+ [in,unique] LPWSTR pszServer,
+ [in] DWORD dwLevel,
+ [out] SHARE_INFO* pShareInfo,
+ [in,out] DWORD* dwParmError
+ );
+
+ STATUS NetrShareEnum( /* Function 0x0F */
+ [in,unique] LPWSTR pszServer,
+ [in,out] SHARE_ENUM* pShareEnum,
+ [in] DWORD dwMaxLen,
+ [out] DWORD* dwEntries,
+ [in,out] DWORD* hResume
+ );
+
+ STATUS NetrShareGetInfo( /* Function 0x10 */
+ [in,unique] LPWSTR pszServer,
+ [in,ref] LPWSTR pszShare,
+ [in] DWORD dwLevel,
+ [out] SHARE_INFO* pShareInfo
+ );
+
+ STATUS NetrShareSetInfo( /* Function 0x11 */
+ [in,unique] LPWSTR pszServer,
+ [in,ref] LPWSTR pszShare,
+ [in] DWORD dwLevel,
+ [in] SHARE_INFO* pShareInfo,
+ [in] DWORD dwReserved
+ );
+
+ STATUS NetrShareDel( /* Function 0x12 */
+ [in,unique] LPWSTR pszServer,
+ [in,ref] LPWSTR pszShare,
+ [in] DWORD dwReserved
+ );
+
+ STATUS NetrShareDelSticky( /* Function 0x13 */
+ [in,unique] LPWSTR pszServer,
+ [in,ref] LPWSTR pszShare,
+ [in] DWORD dwReserved
+ );
+
+ STATUS NetrShareCheck( /* Function 0x14 */
+ [in,unique] LPWSTR pszServer,
+ [in,ref] LPWSTR pszDevice,
+ [out] DWORD* dwType
+ );
/* --- SERVER INFORMATION --- */
@@ -196,70 +448,203 @@ struct LPWSTR {
LPWSTR pszUserPath;
} SERVER_INFO_102;
- typedef struct _SERVER_INFO {
- DWORD dwLevel;
- union ctr[dwLevel] {
- case 100 SERVER_INFO_100 *sv100;
- case 101 SERVER_INFO_101 *sv101;
- case 102 SERVER_INFO_102 *sv102;
- }
+ typedef union _SERVER_INFO switch (DWORD dwLevel) ctr {
+ case 100: SERVER_INFO_100 *sv100;
+ case 101: SERVER_INFO_101 *sv101;
+ case 102: SERVER_INFO_102 *sv102;
} SERVER_INFO;
- struct Q_NetrServerGetInfo {
- .trailer;
- LPWSTR pszServerName;
- DWORD dwLevel;
- };
+ STATUS NetrServerGetInfo( /* Function 0x15 */
+ [in,unique] LPWSTR pszServerName,
+ [in] DWORD dwLevel,
+ [out] SERVER_INFO* pServerInfo
+ );
+
+ STATUS NetrServerSetInfo( /* Function 0x16 */
+ [in,unique] LPWSTR pszServerName,
+ [in] DWORD dwLevel,
+ [in] SERVER_INFO* pServerInfo,
+ [in] DWORD dwReserved
+ );
- struct R_NetrServerGetInfo {
- SERVER_INFO pServerInfo;
- .trailer;
- STATUS status;
- };
+ typedef struct _DISK_INFO {
+ LPWSTR pszName;
+ } DISK_INFO;
+ typedef struct _DISK_ENUM {
+ DWORD dwEntries;
+ [size_is(dwEntries)] DISK_INFO *di;
+ } DISK_ENUM;
+
+ STATUS NetrServerDiskEnum( /* Function 0x17 */
+ [in,unique] LPWSTR pszServer,
+ [in] DWORD dwLevel,
+ [in,out] DISK_ENUM* pDiskEnum,
+ [in] DWORD dwMaxLen,
+ [out] DWORD* dwEntries,
+ [in,out] DWORD* hResume
+ );
+
+ typedef struct _STAT_SERVER {
+ DWORD dwStart;
+ DWORD dwFOpens;
+ DWORD dwDevOpens;
+ DWORD dwJobsQueued;
+ DWORD dwSOpens;
+ DWORD dwSTimedOut;
+ DWORD dwSErrors;
+ DWORD dwPWErrors;
+ DWORD dwPermErrors;
+ DWORD dwSysErrors;
+ DWORD dwBytesSentLow;
+ DWORD dwBytesSentHigh;
+ DWORD dwBytesRcvdLow;
+ DWORD dwBytesRcvdHigh;
+ DWORD dwAVResponse;
+ DWORD dwReqBufNeed;
+ DWORD dwBigBufNeed;
+ } STAT_SERVER;
+
+ STATUS NetrServerStatisticsGet( /* Function 0x18 */
+ [in,unique] LPWSTR pszServer,
+ [in] DWORD dwLevel,
+ [in] DWORD dwOptions,
+ [out] STAT_SERVER* pStatServer
+ );
typedef struct _TRANSPORT_INFO_0 {
LPWSTR pszName;
} TRANSPORT_INFO_0;
- typedef struct _TRANSPORT_INFO {
- DWORD dwLevel;
- union ctr[dwLevel] {
- case 0 TRANSPORT_INFO_0 *ti0;
- }
+ typedef union _TRANSPORT_INFO switch (DWORD dwLevel) ctr {
+ case 0: TRANSPORT_INFO_0 *ti0;
} TRANSPORT_INFO;
typedef struct _TRANSPORT_ENUM_0 {
- DWORD level;
- DWORD dwEntries;
- TRANSPORT_INFO_0 ti0[dwEntries];
+ DWORD dwEntries;
+ [size_is(dwEntries)] TRANSPORT_INFO_0 *ti0;
} TRANSPORT_ENUM_0;
typedef struct _TRANSPORT_ENUM {
DWORD dwLevel;
- DWORD dummy;
- union ctr[dwLevel] {
- case 0 TRANSPORT_ENUM_0 *te0;
- }
+ [switch_is(dwLevel)] union {
+ [case(0)] TRANSPORT_ENUM_0 *te0;
+ } ctr;
} TRANSPORT_ENUM;
+ STATUS NetrServerTransportAdd( /* Function 0x19 */
+ [in,unique] LPWSTR pszServer,
+ [in] DWORD dwLevel,
+ [out] TRANSPORT_INFO* pTransportInfo
+ );
+
+ STATUS NetrServerTransportEnum( /* Function 0x1a */
+ [in,unique] LPWSTR pszServer,
+ [in,out] TRANSPORT_ENUM* pTransportEnum,
+ [in] DWORD dwMaxLen,
+ [out] DWORD* dwEntries,
+ [in,out] DWORD* hResume
+ );
+
+ STATUS NetrServerTransportDel( /* Function 0x1b */
+ [in,unique] LPWSTR pszServer,
+ [in] DWORD dwLevel,
+ [out] TRANSPORT_INFO* pTransportInfo
+ );
+
+ typedef struct _TIME_OF_DAY {
+ DWORD dwElapsedTime;
+ DWORD dwMsecs;
+ DWORD dwHours;
+ DWORD dwMins;
+ DWORD dwSecs;
+ DWORD dwHunds;
+ LONG lTimeZone;
+ DWORD dwInterval;
+ DWORD dwDay;
+ DWORD dwMonth;
+ DWORD dwYear;
+ DWORD dwWeekday;
+ } TIME_OF_DAY;
+
+ STATUS NetrRemoteTOD( /* Function 0x1c */
+ [in,unique] LPWSTR pszServer,
+ [out] TIME_OF_DAY* pTOD
+ );
+
+ STATUS NetrServerSetServiceBits( /* Function 0x1d */
+ [in,unique] LPWSTR pszServer,
+ [in] DWORD hServiceStatus, /* ?? */
+ [in] DWORD dwServiceBits,
+ [in] BOOL bSetBitsOn,
+ [in] BOOL bUpdateImmediately
+ );
+
+ /* --- PATH INFORMATION --- */
+
+ STATUS NetprPathType( /* Function 0x1e */
+ void /* Not known */
+ );
+
+ STATUS NetprPathCanonicalize( /* Function 0x1f */
+ void /* Not known */
+ );
+
+ STATUS NetprPathCompare( /* Function 0x20 */
+ void /* Not known */
+ );
+
+ STATUS NetprNameValidate( /* Function 0x21 */
+ void /* Not known */
+ );
+
+ STATUS NetprNameCanonicalize( /* Function 0x22 */
+ void /* Not known */
+ );
+
+ STATUS NetprNameCompare( /* Function 0x23 */
+ void /* Not known */
+ );
+
+ /* --- LATER ADDITIONS --- */
+
+ STATUS NetrShareEnumSticky( /* Function 0x24 */
+ [in,unique] LPWSTR pszServer,
+ [in,out] SHARE_ENUM* pShareEnum,
+ [in] DWORD dwMaxLen,
+ [out] DWORD* dwEntries,
+ [in,out] DWORD* hResume
+ );
+
+ STATUS NetrShareDelStart( /* Function 0x25 */
+ [in,unique] LPWSTR pszServer,
+ [in,ref] LPWSTR pszShare,
+ [in] DWORD dwReserved /* ? */
+ );
+
+ STATUS NetrShareDelCommit( /* Function 0x26 */
+ [in,unique] LPWSTR pszServer
+ );
+
+ STATUS NetrpGetFileSecurity( /* Function 0x27 */
+ void /* Not known */
+ );
+
+ STATUS NetrpSetFileSecurity( /* Function 0x28 */
+ void /* Not known */
+ );
+
+ STATUS NetrServerTransportAddEx( /* Function 0x29 */
+ [in,unique] LPWSTR pszServer,
+ [in] DWORD dwLevel,
+ [out] TRANSPORT_INFO* pTransportInfo
+ );
+
+ STATUS NetrServerSetServiceBitsEx( /* Function 0x30 */
+ [in,unique] LPWSTR pszServer,
+ [in] DWORD hServiceStatus, /* ?? */
+ [in] DWORD dwServiceBits,
+ [in] BOOL bSetBitsOn,
+ [in] BOOL bUpdateImmediately
+ );
- struct Q_NetrServerTransportEnum {
- .trailer;
- LPWSTR pszServer;
- TRANSPORT_ENUM pTransportEnum;
- DWORD dwMaxLen;
- LPWSTR server2;
- DWORD *hResume;
- DWORD preferred_length;
- STATUS *status;
- };
-
- struct R_NetrServerTransportEnum {
- DWORD level;
- TRANSPORT_ENUM pTransportEnum;
- DWORD *dwEntries;
- DWORD *hResume;
- .trailer;
- STATUS status;
- };
diff --git a/source3/aparser/templates/fn_end.tpl b/source3/aparser/templates/fn_end.tpl
index 38cf10d1b2..df62f6c0ac 100644
--- a/source3/aparser/templates/fn_end.tpl
+++ b/source3/aparser/templates/fn_end.tpl
@@ -1,8 +1,6 @@
end:
- /* the parse is OK, just align and end */
- if (!prs_align(ps)) goto fail;
-
+ /* the parse is OK */
return True;
fail:
diff --git a/source3/aparser/token.awk b/source3/aparser/token.awk
index d0703439e9..0c4c7f65b1 100644
--- a/source3/aparser/token.awk
+++ b/source3/aparser/token.awk
@@ -10,7 +10,7 @@ function parse_error(msg) {
next;
}
-/^\#define.*;/ {
+/^\#define.*/ {
split($0,a,"[ \t;]*");
parse_define(a[2], a[3]);
next;
@@ -46,6 +46,20 @@ function parse_error(msg) {
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]*STATUS.*\(/ {
+ {if (current_struct!="") parse_error("you cannot have nested structures");}
+ split($0,a,"[ \t;()]*");
+ start_function(a[2], a[3]);
+ next;
+}
+
{if (current_struct=="") parse_error("this must appear inside a structure");}
/^[ \t]*union.*\{/ {
@@ -54,6 +68,13 @@ function parse_error(msg) {
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;]*");
@@ -61,12 +82,27 @@ function parse_error(msg) {
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();
+ 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]*\};/ {
@@ -80,12 +116,35 @@ function parse_error(msg) {
next;
}
+/^[ \t]*\);/ {
+ end_function();
+ 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/vluke.c b/source3/aparser/vluke.c
index d26d1d04de..15608ae01a 100644
--- a/source3/aparser/vluke.c
+++ b/source3/aparser/vluke.c
@@ -31,7 +31,7 @@ int main(int argc, char *argv[])
}
fstat(fd, &st);
- prs_init(&ps, 0, 4, MARSHALL);
+ prs_init(&ps, 0, MARSHALL);
ps.is_dynamic=True;
prs_read(&ps, fd, st.st_size, 0);
ps.data_offset = 0;