Layer 5 buffer structure, Application layer header, Message header – Echelon OpenLDV User Manual

Page 70: Message, Header

Advertising
background image

62

Sending and Receiving Messages with the OpenLDV API

Domain length (2 bits)

Data (variable length, depending on the packet type and the data)

CRC

The cyclic redundancy check (CRC) is computed over the NPDU and the Layer 2

Header. The CRC is generated using the ITU-T (CCITT) CRC-16 standard

polynomial. When the link layer receives a packet with a CRC error, or a packet

that is less than 8 bytes in length, a transmission error statistic is incremented; if

a packet is received that is too long for the input buffer, or if there are no input

buffers, the missed packet statistic is incremented.

Layer 5 Buffer Structure

The following sections describe the Layer 5 buffer structure shown in Figure 6.

Bit transmission order within a byte is “most significant first”, meaning that the

most significant bit is transmitted first. Byte transmission order is also “most

significant first”, meaning that the most significant byte of a field is transmitted

first.
For a more complete description of the Layer 5 buffer structure, see the ISO/IEC

14908-1 Interconnection of information technology equipment – Control Network

Protocol - Part 1: Protocol Stack.

Application Layer Header

The application layer header contains the network interface command (and

queue) and a byte that indicates the length of the rest of the message. The most

significant nibble of the network interface command contains the command code

(niCOMM for network messages or niNETMGMT for local network interfaces

messages), and the least significant nibble contains the queue code. These

nibbles combine to form the command/queue byte, which is the network interface

command.
An OpenLDV application sends these commands using the ldv_write() function,

and receives them using the ldv_read() function. The OpenLDV Developer

Example contains an example implementation of a network interface API. You

can use the NiSendMsgWait() and NiSendResponse() functions, included as

part of this example API, to send enqueued commands more conveniently. You

can also use the application-specific message dispatcher, also implemented as

part of the OpenLDV Developer Example, to receive these messages.
See Network Interface Commands on page 76 for a description of the network

interface commands.

Message Header

The message header describes the various attributes of the LonTalk message

contained in the data field. The message header field is defined by the union of

two structures:

ExpMsgHdr — for sending and receiving explicit messages that are not

processed by the network interface

Advertising