kopia lustrzana https://gitlab.com/sane-project/website
111 wiersze
5.3 KiB
HTML
111 wiersze
5.3 KiB
HTML
<!-- received="Mon Apr 21 15:41:12 1997 MST" -->
|
|
<!-- sent="Mon, 21 Apr 1997 15:33:41 -0700" -->
|
|
<!-- name="David Mosberger-Tang" -->
|
|
<!-- email="davidm@azstarnet.com" -->
|
|
<!-- subject="Re: Connecting SANE and Java?" -->
|
|
<!-- id="199704212233.PAA04519@panda.mosberger" -->
|
|
<!-- inreplyto="Connecting SANE and Java?" -->
|
|
<title>sane-devel: Re: Connecting SANE and Java?</title>
|
|
<h1>Re: Connecting SANE and Java?</h1>
|
|
<b>David Mosberger-Tang</b> (<a href="mailto:davidm@azstarnet.com"><i>davidm@azstarnet.com</i></a>)<br>
|
|
<i>Mon, 21 Apr 1997 15:33:41 -0700</i>
|
|
<p>
|
|
<ul>
|
|
<li> <b>Messages sorted by:</b> <a href="date.html#69">[ date ]</a><a href="index.html#69">[ thread ]</a><a href="subject.html#69">[ subject ]</a><a href="author.html#69">[ author ]</a>
|
|
<!-- next="start" -->
|
|
<li> <b>Next message:</b> <a href="0070.html">Gordon Matzigkeit: "Re: PINT driver patches"</a>
|
|
<li> <b>Previous message:</b> <a href="0068.html">Guido Muesch: "Connecting SANE and Java?"</a>
|
|
<li> <b>Maybe in reply to:</b> <a href="0068.html">Guido Muesch: "Connecting SANE and Java?"</a>
|
|
<!-- nextthread="start" -->
|
|
<li> <b>Next in thread:</b> <a href="0076.html">David Mosberger-Tang: "Re: Connecting SANE and Java?"</a>
|
|
<!-- reply="end" -->
|
|
</ul>
|
|
<!-- body="start" -->
|
|
<i>>>>>> On Tue, 22 Apr 1997 00:02:20 +0200 (MET DST), Guido Muesch <<a href="mailto:odiug@faho.rwth-aachen.de">odiug@faho.rwth-aachen.de</a>> said:</i><br>
|
|
<p>
|
|
Guido> It seems to me that the netprotocol was designed to closely<br>
|
|
Guido> resemble the C interface. It is RPC based and I do not know<br>
|
|
Guido> how to use that from Java (especially the pointer to the<br>
|
|
Guido> devicelist).<br>
|
|
<p>
|
|
Not really. The netprotocol is _documented_ using a C-like<br>
|
|
convention, but on the wire, there are of course no pointers<br>
|
|
whatsoever. The sanei_net.h and sanei_wire.h routines are taking care<br>
|
|
of converting C pointers etc into the linear wire format. In the<br>
|
|
documentation, the mapping from C structure to the wire format is<br>
|
|
documented in Sections 4.4.1-4.4.3. A small example might help:<br>
|
|
assume we had the following C type:<br>
|
|
<p>
|
|
typedef struct<br>
|
|
{<br>
|
|
char *name;<br>
|
|
int cap;<br>
|
|
}<br>
|
|
*Simple;<br>
|
|
<p>
|
|
Assume PTR is of type Simple and points to a structure whose NAME<br>
|
|
member points to the string "This is an Example" and whose CAP member<br>
|
|
has a value of 7. Then encoding PTR according to Sections 4.4.1-4.4.3<br>
|
|
would give you the following values on the wire:<br>
|
|
<p>
|
|
<p>
|
|
00000001 # PTR is not a NULL<br>
|
|
# next follows the value that PTR points to<br>
|
|
# a structure is represented by the sequence of it's members<br>
|
|
# first, we have the NAME member, which is a pointer itself<br>
|
|
00000001 # NAME is not a NULL pointer<br>
|
|
00000013 # the string NAME points to is 19 bytes long<br>
|
|
This is an Example\000 # the value of the string<br>
|
|
# next, we have the value of the CAP member:<br>
|
|
00000007<br>
|
|
<br>
|
|
So, as you can see, no pointers at all. Now, there are a few places<br>
|
|
where the SANE C API makes use of NULL pointers (e.g., to terminate<br>
|
|
the device-list, for example). In Java, you'd not do this. Instead,<br>
|
|
you'd probably create an array of device records whose length is<br>
|
|
specified explicitly. I'm not familiar enough with Java to give you a<br>
|
|
concrete type, but the point is that SANE does not depend on pointers<br>
|
|
per se (the C API does, however).<br>
|
|
<p>
|
|
Guido> Well I must admit that I do not know much about RPCs. And my<br>
|
|
Guido> experience with Java is not much more than having written a<br>
|
|
Guido> 'Hello World' program.<br>
|
|
<p>
|
|
Don't pay too much attention to the RPC word. All that's really<br>
|
|
needed for the SANE net protocol is the ability to write/read an<br>
|
|
arbitrary byte-stream to/from TCP connections.<br>
|
|
<p>
|
|
<i> >> From what I see the netprotocol does not fit well into</i><br>
|
|
<i> >> Java. Maybe one</i><br>
|
|
<p>
|
|
No, the net-protocol is language-independent. The description of it<br>
|
|
is oriented to C and that may be what's confusing you. If the above<br>
|
|
example doesn't clarify things, let me know and I'll try to do better.<br>
|
|
<p>
|
|
Guido> Well, I have really not looked deeper into all of this, and<br>
|
|
Guido> these are only suggestions. I don't know how many people on<br>
|
|
Guido> the mailinglist are experienced in Java to give me a hint.<br>
|
|
<p>
|
|
Can't help (much) with Java, but if there are any questions regarding<br>
|
|
the net protocol, drop me a note (and yes, I do plan on finishing up<br>
|
|
the docs and improving them soon).<br>
|
|
<p>
|
|
--david<br>
|
|
<p>
|
|
<pre>
|
|
--
|
|
Source code, list archive, and docs: <a href="http://www.azstarnet.com/~axplinux/sane/">http://www.azstarnet.com/~axplinux/sane/</a>
|
|
To unsubscribe: mail -s unsubscribe <a href="mailto:sane-devel-request@listserv.azstarnet.com">sane-devel-request@listserv.azstarnet.com</a>
|
|
</pre>
|
|
<!-- body="end" -->
|
|
<p>
|
|
<ul>
|
|
<!-- next="start" -->
|
|
<li> <b>Next message:</b> <a href="0070.html">Gordon Matzigkeit: "Re: PINT driver patches"</a>
|
|
<li> <b>Previous message:</b> <a href="0068.html">Guido Muesch: "Connecting SANE and Java?"</a>
|
|
<li> <b>Maybe in reply to:</b> <a href="0068.html">Guido Muesch: "Connecting SANE and Java?"</a>
|
|
<!-- nextthread="start" -->
|
|
<li> <b>Next in thread:</b> <a href="0076.html">David Mosberger-Tang: "Re: Connecting SANE and Java?"</a>
|
|
<!-- reply="end" -->
|
|
</ul>
|