Passa al contenuto principale

Appendix A. C Snippet to Determine STUN Message Types (Frammento C per determinare i tipi di messaggi STUN)

Dato un valore di tipo di messaggio STUN a 16 bit nell'ordine dei byte dell'host nel parametro msg_type, le seguenti sono macro C per determinare il tipo di messaggio STUN:

#define IS_REQUEST(msg_type)       (((msg_type) & 0x0110) == 0x0000)
#define IS_INDICATION(msg_type) (((msg_type) & 0x0110) == 0x0010)
#define IS_SUCCESS_RESP(msg_type) (((msg_type) & 0x0110) == 0x0100)
#define IS_ERR_RESP(msg_type) (((msg_type) & 0x0110) == 0x0110)