ucs1 / ucs2

Bits and byte level questions, ideas and suggestions for the CITP protocol.
Posts: 2
Joined: Tue Feb 04, 2014 12:35 pm

ucs1 / ucs2

Postby mx_w » Tue Feb 04, 2014 2:59 pm

Hi All,

i had a look at the protocol, and i have a few questions about the strings. for example this struct:

Code: Select all

struct CITP_PINF_PLoc

It carries three strings with variable length in it. The spec says the ucs1 are
Open arrays of ucs1 or ucs2 are null terminated strings.
but in c99 open arrays ( they call it "flexible array member" ) must be the last element of a struct.

So - to avoid massively shooting down other lighting consoles :D - let us assume we have for the above case

Code: Select all

Type = "LightingConsole" (16 incl. \0)
Name = "MyCoolName" (11 incl. \0)
State = "Idle" (5 incl. \0)

How is the struct supposed to be in layout?
Do the strings have a specified size, like eg 256?

Code: Select all


Or a dynamic layout like

Code: Select all


and if so, are the strings concatenated or does the parser expect
three pointers with the strings appended to the end?

Best regards + thank you very much,

User avatar
Site Admin
Posts: 72
Joined: Sat Sep 25, 2010 7:44 am
Location: Gothenburg, Sweden

Re: ucs1 / ucs2

Postby lasso » Sun Mar 09, 2014 8:59 am


I realize the use of the keyword struct is probably what is causing the confusion here, so I will remove that from the spec. The second sentence of the first paragraph under section 2 is supposed to clarify this, but... well.

Anyway, the message definitions are not to be interpreted as C structs - they describe the contents of a binary data stream. I would recommend never memcpy'ing network data straight into C structs.
Lars Wernlund
Technical Manager, Capture Sweden

Return to “Design - For developers”

Who is online

Users browsing this forum: No registered users and 1 guest