Subject: [Ietf-behave] Question regarding rfc3489bis-03

From: Nils Ohlmeier <[email-masked]>
Date: Tue, 4 Jul 2006 06:02:35 -0700 (PDT)

Hello,

while reading through the document draft-ietf-behave-rfc3489bis-03.txt we 
stumbled across the sentence "The most significant two bits of every STUN 
message are 0b00." on page 10.
I think this an error because '0b00' implies that the value is given in 
hexadecimal (because of the b). But in this case '0b00' would two bytes and 
not two bits.
No matter if we are talking about two bits or bytes I do not get how the value 
0x0b00 should appear in the beginning of a STUN message (in the message type 
field).
Any comment or thoughts about this are welcome.

Thanks
  Nils Ohlmeier

---

From: Nils Ohlmeier <[email-masked]>
Date: Tue, 4 Jul 2006 07:26:34 -0700 (PDT)

> hexadecimal (because of the b). But in this case '0b00' would two bytes and

If the b stands for binary notation forget my posting :-)

Allthough it seems like this notation is not very obvious ;-)

  Nils

---

From: Jim Dixon <[email-masked]>
Date: Tue, 4 Jul 2006 07:39:36 -0700 (PDT)

> hexadecimal (because of the b). But in this case '0b00' would two bytes and

It's common practice to represent binary numbers as a string beginning
with "0b", just as hex numbers are represented as strings beginning with
"0x".

> 0x0b00 should appear in the beginning of a STUN message (in the message type

The field beginning with 0b00 is interpreted as a big-endian binary
number.  Its two high order bits are both zero.

--
Jim Dixon  jdd@xxxxxxxxxx   tel +44 117 982 0786  mobile +44 797 373 7881
http://xlattice.sourceforge.net         p2p communications infrastructure

---

From: Guilherme Balena Versiani <[email-masked]>
Date: Wed, 5 Jul 2006 04:51:12 -0700 (PDT)

Maybe if you use some pseudo-code in draft-ietf-behave-rfc3489bis-03.txt 
things become clear:

#define IS_STUN(packet)
   (((packet)[0] & 0xc0) == 0x00)   /* 0xc0 = 0b11000000 */
Regards,

Guilherme Balena Versiani.
ComunIP S/A
Jim Dixon escreveu:

hile reading through the document draft-ietf-behave-rfc3489bis-03.txt we
stumbled across the sentence "The most significant two bits of every STUN
message are 0b00." on page 10.

It's common practice to represent binary numbers as a string beginning
with "0b", just as hex numbers are represented as strings beginning with
"0x".
o matter if we are talking about two bits or bytes I do not get how the value
0x0b00 should appear in the beginning of a STUN message (in the message type
field).

begin:vcard
fn:Guilherme Balena Versiani
n:Versiani;Guilherme
org:ComunIP S/A
adr;quoted-printable;quoted-printable:Bairro Funcion=C3=A1rios;;Rua Cl=C3=A1udio Manoel, 237;Belo Horizonte;MG;30140-100;Brasil
email;internet:guibv@xxxxxxxxxxxxxx
tel;work:(+55/31) 3284-1007
url:http://www.comunip.com.br
version:2.1
end:vcard

---

From: Guilherme Balena Versiani <[email-masked]>
Date: Wed, 5 Jul 2006 04:56:56 -0700 (PDT)

Just another version, this time considering the STUN magic cookie:

#define STUN_MAGIC_COOKIE 0x2112A442
#define IS_STUN(packet) \
  ((((packet)[0] & 0xc0) == 0x00) && \
   (((uint32_t *) packet)[1] == htonl(STUN_MAGIC_COOKIE))
Guilherme Balena Versiani escreveu:

Maybe if you use some pseudo-code in 
draft-ietf-behave-rfc3489bis-03.txt things become clear:

#define IS_STUN(packet)

hile reading through the document 
draft-ietf-behave-rfc3489bis-03.txt we
stumbled across the sentence "The most significant two bits of every 
STUN
message are 0b00." on page 10.   
It's common practice to represent binary numbers as a string beginning
with "0b", just as hex numbers are represented as strings beginning with
"0x".
o matter if we are talking about two bits or bytes I do not get how 
the value
0x0b00 should appear in the beginning of a STUN message (in the 
message type
field).   
The field beginning with 0b00 is interpreted as a big-endian binary
number.  Its two high order bits are both zero.

begin:vcard

---

From: Jonathan Rosenberg <[email-masked]>
Date: Wed, 5 Jul 2006 14:11:22 -0700 (PDT)

Generally IESG frowns upon pseudcocode. Here its really not needed 
anyway. I removed the 0b00 terminology and simply stated that the first 
two bits are both zeroes.

-Jonathan R.

Guilherme Balena Versiani wrote:

#define IS_STUN(packet)

_______________________________________________
Ietf-behave mailing list
Ietf-behave@xxxxxxxxxxxxxxxxxxx
https://list.sipfoundry.org/mailman/listinfo/ietf-behave
--
Jonathan D. Rosenberg, Ph.D.                   600 Lanidex Plaza
Cisco Fellow                                   Parsippany, NJ 07054-2711
Cisco Systems
jdrosen@xxxxxxxxx                              FAX:   (973) 952-5050
http://www.jdrosen.net                         PHONE: (973) 952-5000
http://www.cisco.com

---

From: "Rohan Mahy" <[email-masked]>
Date: Wed, 5 Jul 2006 14:35:21 -0700 (PDT)

Hi Jim,

Well it really isn't *common* practice to represent binary this way.
It is a convention, but it is hardly used these days and is likely to
be unfamiliar to many.  the 0x notation for hex is common practice,
but binary and octal notation are going the way of the dodo.
thanks,
-rohan
On 7/4/06, Jim Dixon <jdd@xxxxxxxxxx> wrote: