comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Binary and XML serialization of types
Date: Fri, 24 Jan 2014 16:22:15 +0100
Date: 2014-01-24T16:22:15+01:00	[thread overview]
Message-ID: <1txs6yifzioke$.30cghpl6qq1j$.dlg@40tude.net> (raw)
In-Reply-To: b5196a27-ae54-43a6-a6ec-4650edcb3b83@googlegroups.com

On Fri, 24 Jan 2014 06:44:39 -0800 (PST), hanslad@gmail.com wrote:

>> In the case 2, you should consider using packets instead of a raw octet
>> stream. Typically you would form an outgoing packet in the memory, using
>> whatever means (e.g. by a string-mapped stream) and then send the packet
>> out as a whole. It is especially important to do if you are going to use
>> NO_DELAY socket option.
> 
> This sounds interesting. Do you know any good examples of this? 

I am not sure I understand your question. Examples of what? Of the
protocols using NO_DELAY?

>> Is it a custom protocol you are going to invent? Anyway, the protocols
>> usually deploy some sort of packet header to describe the request and the
>> body of. The most efficient way is when the body length can be determined
>> from the header. You read the body into memory and then parse it, e.g.
>> using a string-mapped stream.
> 
> The protocol is certanly not invented by me(OPC UA), but I want to
> implement it in Ada as a long term hobby project. The base types(int,
> IEEE-754 float) is encoded with the least significant byte appearing first
> (i.e. little endian).

In that case you can use the implementations from Simple Components.

I cannot verify about endianness. I used OPC only once with a commercial
client from Softing GmbH. OPC is too slow and uncomfortable to use in
automation systems.

Are you going to develop an OPC server or an OPC client? Are you sure you
really want OPC? Because, for instance, an SPS can be communicated through
ModBus or ITOT, both far easier and faster than OPC.

>>> For me it would be locical to separate all the "wire information" from the
>>> type information. Today, the binary and xml encoding scheme is defined,
>>> and I had hope to be able to separate this in different packages.
>> 
>> That is doable.
> 
> A simple example would be great!

> As a total Ada beginner, any code examples or references to it will help me alot.

Well, it is not simple in general. You can take a look how Simple
Components deal with TCP/IP servers in a protocol-independent way.

http://www.dmitry-kazakov.de/ada/components.htm#multiple_GNAT.Sockets.Servers

Specifically regarding Ada, there are many ways how to handle OSI
hierarchy. Major approaches are:

1. Generics: other layers are formal parameters;
2. Inheritance, tagged types: other layers are parent or derived types;
3. Mix-in inheritance: other layers are access discriminants.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2014-01-24 15:22 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-23 18:53 Binary and XML serialization of types hanslad
2014-01-23 19:15 ` adambeneschan
2014-01-23 19:17   ` adambeneschan
2014-01-23 19:58     ` hanslad
2014-01-23 20:03       ` adambeneschan
2014-01-23 21:00       ` Dmitry A. Kazakov
2014-01-24  8:54         ` hanslad
2014-01-24 10:01           ` Dmitry A. Kazakov
2014-01-24 14:44             ` hanslad
2014-01-24 15:22               ` Dmitry A. Kazakov [this message]
2014-01-31  9:51                 ` hanslad
2014-01-31 10:49                   ` Dmitry A. Kazakov
2014-02-04 10:33                     ` AdaMagica
2014-02-04 11:14                       ` Dmitry A. Kazakov
2014-02-04 11:20                         ` AdaMagica
2014-02-04 13:04                           ` Dmitry A. Kazakov
2014-02-04 17:16                             ` AdaMagica
2014-02-04 17:57                               ` Dmitry A. Kazakov
2014-02-04 22:34                               ` Simon Wright
2014-02-05  9:02                                 ` AdaMagica
2014-02-05  9:39                                   ` Simon Wright
2014-02-05 10:35                                   ` Dmitry A. Kazakov
2014-02-05 13:03                                     ` AdaMagica
2014-02-05 13:44                                       ` G.B.
2014-02-05 15:34                                       ` Niklas Holsti
2014-02-06  1:32                                       ` adambeneschan
2014-01-24 17:36             ` Simon Wright
2014-01-24  8:44       ` Georg Bauhaus
2014-01-24 17:13         ` Simon Wright
2014-01-23 22:44   ` Simon Wright
2014-01-23 23:43     ` adambeneschan
2014-01-24  0:58       ` Randy Brukardt
2014-01-24  8:29       ` Oliver Kleinke
2014-01-24 16:22         ` adambeneschan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox