645
645
* %STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS if the address family is unknown.
647
647
StunMessageReturn stun_message_find_addr (const StunMessage *msg,
648
StunAttribute type, struct sockaddr *addr, socklen_t *addrlen);
648
StunAttribute type, struct sockaddr_storage *addr, socklen_t *addrlen);
651
651
* stun_message_find_xor_addr:
664
664
* %STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS if the address family is unknown.
666
666
StunMessageReturn stun_message_find_xor_addr (const StunMessage *msg,
667
StunAttribute type, struct sockaddr *addr, socklen_t *addrlen);
667
StunAttribute type, struct sockaddr_storage *addr, socklen_t *addrlen);
670
670
* stun_message_find_xor_addr_full:
684
684
* %STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS if the address family is unknown.
686
686
StunMessageReturn stun_message_find_xor_addr_full (const StunMessage *msg,
687
StunAttribute type, struct sockaddr *addr,
687
StunAttribute type, struct sockaddr_storage *addr,
688
688
socklen_t *addrlen, uint32_t magic_cookie);
811
811
* %STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS if the address family is unknown.
813
813
StunMessageReturn stun_message_append_xor_addr (StunMessage * msg,
814
StunAttribute type, const struct sockaddr *addr, socklen_t addrlen);
814
StunAttribute type, const struct sockaddr_storage *addr, socklen_t addrlen);
817
817
* stun_message_append_xor_addr_full:
828
828
* %STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS if the address family is unknown.
830
830
StunMessageReturn stun_message_append_xor_addr_full (StunMessage * msg,
831
StunAttribute type, const struct sockaddr *addr, socklen_t addrlen,
831
StunAttribute type, const struct sockaddr_storage *addr, socklen_t addrlen,
832
832
uint32_t magic_cookie);
879
879
bool has_padding);
883
* @buffer: a buffer containing already-received binary data
884
* @size: length of @buffer, in bytes
886
* Container for a single buffer which also stores its length. This is designed
887
* for vectored I/O: typically an array of #StunInputVectors is passed to
888
* functions, providing multiple buffers which store logically contiguous
891
* This is guaranteed to be layed out identically in memory to #GInputVector.
896
const uint8_t *buffer;
901
* stun_message_validate_buffer_length_fast:
902
* @buffers: (array length=n_buffers) (in caller-allocated): array of contiguous
903
* #StunInputVectors containing already-received message data
904
* @n_buffers: number of entries in @buffers
905
* @total_length: total number of valid bytes stored consecutively in @buffers
906
* @has_padding: %TRUE if attributes should be padded to 4-byte boundaries
908
* Quickly validate whether the message in the given @buffers is potentially a
909
* valid STUN message, an incomplete STUN message, or if it’s definitely not one
912
* This is designed as a first-pass validation only, and does not check the
913
* message’s attributes for validity. If this function returns success, the
914
* buffers can be compacted and a more thorough validation can be performed
915
* using stun_message_validate_buffer_length(). If it fails, the buffers
916
* definitely do not contain a complete, valid STUN message.
918
* Returns: The length of the valid STUN message in the buffer, or zero or -1 on
920
* <para> See also: #STUN_MESSAGE_BUFFER_INCOMPLETE </para>
921
* <para> See also: #STUN_MESSAGE_BUFFER_INVALID </para>
925
ssize_t stun_message_validate_buffer_length_fast (StunInputVector *buffers,
926
unsigned int n_buffers, size_t total_length, bool has_padding);
882
929
* stun_message_id:
883
930
* @msg: The #StunMessage
884
931
* @id: The #StunTransactionId to fill