What is the correct way to pass in the "handle" parameter to xdrrec_create()?
I've seen examples such as:
...
...
XDR *xdrs = (XDR *)malloc(sizeof(XDR));
memset(xdrs, 0, sizeof(XDR));
...
xdrrec_create(&xdrs, 0, 0, (char *)xdrs, readFunc, writeFunc);
...
...
Note that the xdrs variable is being used as the XDR structure and as the
handle. The examples that I have found online imply that this will work.
Why doesn't the other structure members in the XDR struct get overwritten by
the characters in the buffer? It seems like the proper way to use
xdrrec_create() would be to either:
1. Create a char buffer and pass that in.
char buffer[some_size];
xdrrec_create(xdrs, 0, 0, buffer, readFunc, writeFunc);
2. Pass in the x_public structure member.
xdrrec_create(xdrs, 0, 0, &xdrs->x_public, readFunc, writeFunc);
Is there a really good example available online on the proper way to use
xdrrec_create()?
Thanks,
David.
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code