1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

added the ".trailer" type, to mark where a packet turns into a trailer

this now gives us enough to parse complete function calls, including
the return values
This commit is contained in:
Andrew Tridgell
-
parent 1df80cd1e8
commit ca8f1e92ad
6 changed files with 100 additions and 61 deletions

View File

@ -27,6 +27,7 @@ function parse_element(f, v, elnum, flags,
LOCAL, type, elem)
{
type = elements[elnum, "type"];
if (substr(type,1,1) == ".") return;
elem = elements[elnum, "elem"];
if (elements[elnum,"ptr"] == "") {
v["PTR"] = "\\&";
@ -117,24 +118,33 @@ function parse_buffers(f, v, elnum, flags,
}
function struct_parser(f, v, struct_num,
LOCAL, i)
LOCAL, i, n1)
{
v["STRUCTNAME"] = structs[struct_num, "name"];
v["FUNCNAME"] = "io_" v["STRUCTNAME"];
print_template(f, "fn_start.tpl", v);
for (n1=0;n1<structs[struct_num, "num_elems"];n1++) {
if (elements[structs[struct_num, n1], "type"] == ".trailer") break;
}
# first all the structure pointers, scalars and arrays
for (i=0;i<structs[struct_num, "num_elems"];i++) {
for (i=0;i<n1;i++) {
parse_scalars(f, v, structs[struct_num, i], "PARSE_SCALARS");
}
print_template(f, "fn_mid.tpl", v);
# now the buffers
for (i=0;i<structs[struct_num, "num_elems"];i++) {
for (i=0;i<n1;i++) {
parse_buffers(f, v, structs[struct_num, i], "PARSE_BUFFERS");
}
# and any trailers
for (i=n1;i<structs[struct_num, "num_elems"];i++) {
parse_buffers(f, v, structs[struct_num, i], "PARSE_SCALARS");
}
print_template(f, "fn_end.tpl", v);
}