diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-05-16 14:02:31 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-05-16 14:02:31 +0000 |
commit | 058ecd89b45bf4e52194595a320e140483c93d30 (patch) | |
tree | 83b41715b4014109459f8470af4060588aaf4673 /source3 | |
parent | 128026c9a2de83a8ac6214e733fa871440c6b77f (diff) | |
download | samba-058ecd89b45bf4e52194595a320e140483c93d30.tar.gz samba-058ecd89b45bf4e52194595a320e140483c93d30.tar.bz2 samba-058ecd89b45bf4e52194595a320e140483c93d30.zip |
take the sructure name to run through vluke on the command line
(This used to be commit 03fbe1b1514774c9f3c4d553ca3b5b019ba0b11f)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/aparser/harness.awk | 19 | ||||
-rw-r--r-- | source3/aparser/main.awk | 2 | ||||
-rw-r--r-- | source3/aparser/parsefn.awk | 3 | ||||
-rw-r--r-- | source3/aparser/parsetree.awk | 1 | ||||
-rw-r--r-- | source3/aparser/srvsvc.struct | 82 | ||||
-rw-r--r-- | source3/aparser/templates/harness_start.tpl | 11 | ||||
-rw-r--r-- | source3/aparser/vluke.c | 14 |
7 files changed, 98 insertions, 34 deletions
diff --git a/source3/aparser/harness.awk b/source3/aparser/harness.awk index 00e3f44a68..f63863d638 100644 --- a/source3/aparser/harness.awk +++ b/source3/aparser/harness.awk @@ -1,13 +1,22 @@ function produce_harness(f, - LOCAL, v, struct_num) + LOCAL, v, struct_num, i) { struct_num=structs[test]; v["MODULE"]=module; - v["TEST"]=test; - v["TEST_FUNC"]=moduletest; - v["STRUCTNAME"] = structs[struct_num, "name"]; - v["FUNCNAME"] = "io_" v["STRUCTNAME"]; print_template(f, "harness_start.tpl", v); + + for (i=0;i<num_tests;i++) { + v["TEST"] = tests[i]; + print_template(f, "harness.tpl", v); + } + + print_template(f, "harness_end.tpl", v); +} + +function add_test(test) +{ + tests[num_tests] = test; + num_tests++; } diff --git a/source3/aparser/main.awk b/source3/aparser/main.awk index d891970c68..5d67f123c7 100644 --- a/source3/aparser/main.awk +++ b/source3/aparser/main.awk @@ -14,7 +14,7 @@ } /^test/ { - test=$2; + add_test($2); next; } diff --git a/source3/aparser/parsefn.awk b/source3/aparser/parsefn.awk index 3f1e3e8093..4c88cdeab8 100644 --- a/source3/aparser/parsefn.awk +++ b/source3/aparser/parsefn.awk @@ -142,7 +142,8 @@ function struct_parser(f, v, struct_num, # and any trailers for (i=n1;i<structs[struct_num, "num_elems"];i++) { - parse_buffers(f, v, structs[struct_num, i], "PARSE_SCALARS"); + parse_scalars(f, v, structs[struct_num, i], "PARSE_SCALARS"); + parse_buffers(f, v, structs[struct_num, i], "PARSE_BUFFERS"); } print_template(f, "fn_end.tpl", v); diff --git a/source3/aparser/parsetree.awk b/source3/aparser/parsetree.awk index 6f2697ec91..cd4e442c9b 100644 --- a/source3/aparser/parsetree.awk +++ b/source3/aparser/parsetree.awk @@ -6,6 +6,7 @@ function start_module(name) num_structs=0; num_elements=0; num_unions=0; + num_tests=0; } function start_struct(name) diff --git a/source3/aparser/srvsvc.struct b/source3/aparser/srvsvc.struct index 44d88944cb..f8dd94a2e6 100644 --- a/source3/aparser/srvsvc.struct +++ b/source3/aparser/srvsvc.struct @@ -1,5 +1,16 @@ module srvsvc +test SRV_R_NET_SHARE_ENUM test SRV_R_NET_SERVER_INFO +test SRV_Q_NET_SERVER_INFO + +#define SRV_NETCONNENUM 0x08 +#define SRV_NETFILEENUM 0x09 +#define SRV_NETSESSENUM 0x0c +#define SRV_NETSHAREENUM 0x0f +#define SRV_NET_SHARE_GET_INFO 0x10 +#define SRV_NET_SRV_GET_INFO 0x15 +#define SRV_NET_SRV_SET_INFO 0x16 +#define SRV_NET_REMOTE_TOD 0x1c struct UNISTR2 { uint32 max_len; @@ -12,6 +23,40 @@ struct LPWSTR { UNISTR2 *str; }; +struct ENUM_HND { + uint32 *handle; /* enumeration handle */ +}; + +/* function 8 */ +struct CONN_INFO_0 { + uint32 id; /* connection id. */ +}; + +struct CONN_INFO_1 { + uint32 id; + uint32 type; + uint32 num_opens; + uint32 num_users; + uint32 open_time; + LPWSTR usr_name; + LPWSTR net_name; +}; + +struct SRV_R_NET_CONN_ENUM { + uint32 level; + uint32 level2; + uint32 num_entries; + union *info[level] { + case 0 CONN_INFO_0 info0[num_entries]; + case 1 CONN_INFO_1 info1[num_entries]; + } + .trailer; + uint32 count; + ENUM_HND handle; + uint32 status1; + uint32 status2; +}; + /* function 15 */ struct SRV_SHARE_INFO_1 { LPWSTR uni_netname; @@ -63,28 +108,35 @@ struct SERVER_INFO_101 { }; struct SERVER_INFO_102 { - uint32 dwPlatformID; + uint32 dwPlatformID; LPWSTR pszName; - uint32 dwVerMajor; - uint32 dwVerMinor; - uint32 dwType; + uint32 dwVerMajor; + uint32 dwVerMinor; + uint32 dwType; LPWSTR pszComment; - uint32 dwUsers; - uint32 lDisc; - uint32 bHidden; - uint32 dwAnnounce; - uint32 dwAnnDelta; - uint32 dwLicenses; + uint32 dwUsers; + uint32 lDisc; + uint32 bHidden; + uint32 dwAnnounce; + uint32 dwAnnDelta; + uint32 dwLicenses; LPWSTR pszUserPath; }; struct SRV_R_NET_SERVER_INFO { + .trailer; uint32 level; - union info[level] { - case 100 SERVER_INFO_100 *sv100; - case 101 SERVER_INFO_101 *sv101; - case 102 SERVER_INFO_102 *sv102; + union *info[level] { + case 100 SERVER_INFO_100 sv100; + case 101 SERVER_INFO_101 sv101; + case 102 SERVER_INFO_102 sv102; } - .trailer; uint32 status; }; + +struct SRV_Q_NET_SERVER_INFO { + .trailer; + LPWSTR server; + uint32 level; +}; + diff --git a/source3/aparser/templates/harness_start.tpl b/source3/aparser/templates/harness_start.tpl index 7e6ab9dc3a..e6cf18a163 100644 --- a/source3/aparser/templates/harness_start.tpl +++ b/source3/aparser/templates/harness_start.tpl @@ -1,7 +1,8 @@ -#define TEST_STRUCT @STRUCTNAME@ -#define TEST_NAME "@TEST@" -#define TEST_FUNC @FUNCNAME@ - - #include "prs_@MODULE@.h" #include "prs_@MODULE@.c" + +static BOOL run_test(char *test, prs_struct *ps) +{ + BOOL ret; + +
\ No newline at end of file diff --git a/source3/aparser/vluke.c b/source3/aparser/vluke.c index f5612a773d..5a64e06eb0 100644 --- a/source3/aparser/vluke.c +++ b/source3/aparser/vluke.c @@ -11,18 +11,19 @@ int main(int argc, char *argv[]) { BOOL ret; - TEST_STRUCT *il; - char *desc = TEST_NAME; - char *fname = argv[1]; + char *fname, *test; int fd; struct stat st; prs_struct ps; - if (argc < 2) { - printf("usage: vluke <file>\n"); + if (argc < 3) { + printf("usage: vluke <structure> <file>\n"); exit(1); } + test = argv[1]; + fname = argv[2]; + fd = open(fname,O_RDONLY); fstat(fd, &st); @@ -31,8 +32,7 @@ int main(int argc, char *argv[]) prs_read(&ps, fd, st.st_size, 0); ps.data_offset = 0; ps.io = UNMARSHALL; - il = (TEST_STRUCT *)malloc(sizeof(*il)); - ret = TEST_FUNC(desc, &ps, 1, il, PARSE_SCALARS|PARSE_BUFFERS); + ret = run_test(test, &ps); printf("\nret=%s\n", ret?"OK":"Bad"); printf("Trailer is %d bytes\n\n", ps.grow_size - ps.data_offset); dump_data(0, ps.data_p, ps.grow_size); |