System information
Appendix D. JAVA Example Code
D-21
public byte[] to_link_state_packet()
{
// form the packet header + body (less the framing characters)
byte[] rtn = new byte[storage_len + 12];
int i;
rtn[0] = (byte)((link_state << 4) | (byte)((dest_address & 0x0F00)
>> 8));
rtn[1] = (byte)(dest_address & 0x00FF);
rtn[2] = (byte)((expect_more_code << 6) | (byte)(priority << 4) |
(byte)((src_address & 0x0F00) >> 8));
rtn[3] = (byte)(src_address & 0x00FF);
rtn[4] = (byte)((hi_protocol_code << 4) | (byte)((dest_address &
0x0F00) >> 8));
rtn[5] = rtn[1];
rtn[6] = (byte)((src_address & 0x0F00) >> 8);
rtn[7] = rtn[3];
rtn[8] = message_type;
rtn[9] = tran_no;
for(i = 0; i < storage_len; ++i)
rtn[10 + i] = storage[i];
// add the signature nullifier
char sig_null = calcSigNullifier(calcSigFor(rtn,storage_len +
10,(char)0xAAAA));
rtn[10 + i] = (byte)((sig_null & 0xFF00) >> 8);
rtn[10 + i + 1] = (byte)(sig_null & 0x00FF);
return rtn;
}
} //Packet class
/** class ColumnDef
*
* Defines an object that holds meta-information for a column within a
* table. This information includes the column number, column name,
* field type, processing string, units string, description string,
* begin index, piece size, and array dimension information
*/
protected static class ColumnDef
{
public int column_no;
public String column_name;
public boolean read_only;
public byte field_type;
public String processing;
public String units;
public String description;
public int begin_index;
public int piece_size;
public ColumnDef(int column_no_, byte field_type_, Packet msg) throws
Exception
{
String alias;
column_no = column_no_;
field_type = field_type_;
if((field_type & 0x80) != 0)
{
field_type &= 0x80;
read_only = true;
}
else