From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bc1361a952ec75ca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-07 21:56:01 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newshub2.home.com!news.home.com!news1.rdc2.on.home.com.POSTED!not-for-mail Message-ID: <3B70C665.BBC5F000@home.com> From: "Warren W. Gay VE3WWG" X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How Ada could have prevented the Red Code distributed denial of service attack. References: <3b690498.1111845720@news.worldonline.nl> <9kbu15$9bj@augusta.math.psu.edu> <9kbvsr$a02@augusta.math.psu.edu> <3B69DB35.4412459E@home.com> <3B6F312F.DA4E178E@home.com> <23lok9.ioi.ln@10.0.0.2> <3B70AB15.35845A98@home.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Wed, 08 Aug 2001 04:56:00 GMT NNTP-Posting-Host: 24.141.193.224 X-Complaints-To: abuse@home.net X-Trace: news1.rdc2.on.home.com 997246560 24.141.193.224 (Tue, 07 Aug 2001 21:56:00 PDT) NNTP-Posting-Date: Tue, 07 Aug 2001 21:56:00 PDT Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: archiver1.google.com comp.lang.ada:11577 Date: 2001-08-08T04:56:00+00:00 List-Id: David Bolen wrote: > "Warren W. Gay VE3WWG" writes: > > Bart.Vanhauwaert@nowhere.be wrote: > (...) > > > I have never felt the need to know the size of a certain struct. Why > > > don't you give an example where it is needed? > > > > What? You've never written a structure to a file? A socket? A message queue? > > To piggy back on this slightly to ask a related question - I'd > normally say "no" to your question because a direct write of a > structure in any of those situations would be non-portable in most > languages/libraries I've used, except when using an official > standardized marshalling interface for such I/O, in which case the > overall structure size is generally unimportant. Instead you'd want > to define what needs to be marshalled on a field by field basis or in > dynamic situations let introspection handle it. Are you suggesting that every binary file that you've ever done I/O on, is don'e in a perfectly portable fashion? Really? I rather doubt it, because I've seen a lot of code in the form of Open Sourced projects that do just that. For example, if you were to write cpio, excluding the portable format (-c), are you not going to write the binary header out directly? Sure you are. You don't have to of course, but this is different from general experience. EVEN IF YOU IGNORE FILEs, you don't have portability concerns when you write to pipes, UNIX sockets (ie. local to the same host), call msgsnd() and msgrcv() for message queues. These do not require any endian issues because you're talking to processes within the same host. It would simply be a _waste_ to write to your process on the same host, in an endian neutral way (depending upon the endian orientation). In all of these cases, you'll want to know what the "real" length is. Of course, you could take the "I don't care about a byte or two of extra waste", and depending upon the situation, I might agree. I only point out, that in C/C++, that these issues do arise in practical situations. > Does Ada support simply performing I/O on such structures to > constructs as files, sockets or message queues in a portable way > (without explicit marshalling), such that some other Ada application > (even with a different compiler and/or platform) would receive the > structure intact? It can, as can C++. But not out of the box. In Ada, you can define how the object is read or written. Ada's streams work differently than C++'s streams, but the ideas are similar. There is however, another "distributed systems annex?", to which I must confess ignorance of at the moment (I have not yet tried it), that does the equivalence of RPC (or at least I think GNAT does it this way). Now I am not certain of this point, but it is _likely_, though probably not guaranteed, that XDR formats will be used for this (big endian format, portable etc.) But please don't quote me on this, since this particular answer is entirely _wild_ _speculation_ on my part. Someone with more Ada experience can help us out on this point, if they are willing. -- Warren W. Gay VE3WWG http://members.home.net/ve3wwg