~ubuntu-branches/debian/stretch/libnice/stretch

« back to all changes in this revision

Viewing changes to stun/stunmessage.h

  • Committer: Package Import Robot
  • Author(s): Simon McVittie
  • Date: 2014-05-14 12:00:13 UTC
  • mfrom: (1.2.9) (5.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20140514120013-fi5mh9bexrjnwnd8
Tags: 0.1.7-1
* New upstream release 0.1.6, 0.1.7
  - fixes various compiler warnings that were mistakenly fatal in 0.1.5
    (Closes: #743232, #743233)
  - update symbols file for new API
* Explicitly disable -Werror, even if we package a non-release in future
* Don't run tests during the build. We were ignoring failures already,
  and they sometimes hang until the buildd terminates them.
  Upstream (Olivier Crête) says they are stable enough to be useful
  for developers, but not for integration testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
645
645
 * %STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS if the address family is unknown.
646
646
 */
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);
649
649
 
650
650
/**
651
651
 * stun_message_find_xor_addr:
664
664
 * %STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS if the address family is unknown.
665
665
 */
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);
668
668
 
669
669
/**
670
670
 * stun_message_find_xor_addr_full:
684
684
 * %STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS if the address family is unknown.
685
685
 */
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);
689
689
 
690
690
 
811
811
 * %STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS if the address family is unknown.
812
812
 */
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);
815
815
 
816
816
/**
817
817
 * stun_message_append_xor_addr_full:
828
828
 * %STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS if the address family is unknown.
829
829
 */
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);
833
833
 
834
834
/**
879
879
    bool has_padding);
880
880
 
881
881
/**
 
882
 * StunInputVector:
 
883
 * @buffer: a buffer containing already-received binary data
 
884
 * @size: length of @buffer, in bytes
 
885
 *
 
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
 
889
 * received data.
 
890
 *
 
891
 * This is guaranteed to be layed out identically in memory to #GInputVector.
 
892
 *
 
893
 * Since: 0.1.5
 
894
 */
 
895
typedef struct {
 
896
  const uint8_t *buffer;
 
897
  size_t size;
 
898
} StunInputVector;
 
899
 
 
900
/**
 
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
 
907
 *
 
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
 
910
 * at all.
 
911
 *
 
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.
 
917
 *
 
918
 * Returns: The length of the valid STUN message in the buffer, or zero or -1 on
 
919
 * failure
 
920
 * <para> See also: #STUN_MESSAGE_BUFFER_INCOMPLETE </para>
 
921
 * <para> See also: #STUN_MESSAGE_BUFFER_INVALID </para>
 
922
 *
 
923
 * Since: 0.1.5
 
924
 */
 
925
ssize_t stun_message_validate_buffer_length_fast (StunInputVector *buffers,
 
926
    unsigned int n_buffers, size_t total_length, bool has_padding);
 
927
 
 
928
/**
882
929
 * stun_message_id:
883
930
 * @msg: The #StunMessage
884
931
 * @id: The #StunTransactionId to fill