Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef STUN_INTERNAL_H
00026
00027 #define STUN_INTERNAL_H
00028
00036 #ifndef SU_DEBUG
00037 #define SU_DEBUG 0
00038 #endif
00039
00040 #ifndef SU_WAIT_H
00041 #include <sofia-sip/su_wait.h>
00042 #endif
00043
00044 #ifndef SU_TAG_H
00045 #include <sofia-sip/su_tag.h>
00046 #endif
00047
00048 #ifndef STUN_H
00049 #include "sofia-sip/stun.h"
00050 #endif
00051
00052 #if defined(HAVE_OPENSSL)
00053
00054 #define OPENSSL_NO_KRB5
00055 #include <openssl/sha.h>
00056 #include <openssl/hmac.h>
00057 #include <openssl/ssl.h>
00058 #include <openssl/x509.h>
00059 #endif
00060
00061 #ifndef STUN_COMMON_H
00062 #include "sofia-sip/stun_common.h"
00063 #endif
00064
00065
00066
00067 #define SU_LOG (stun_log)
00068 #include <sofia-sip/su_debug.h>
00069
00070 #define enter (void)SU_DEBUG_9(("%s: entering.\n", __func__))
00071
00072 SOFIA_BEGIN_DECLS
00073
00074 #ifdef DOXYGEN
00075 extern char const STUN_DEBUG[];
00076 #endif
00077
00078
00079 #if 1
00080 #define STUN_LIFETIME_EST 3500
00081 #define STUN_LIFETIME_MAX 18000
00082 #define STUN_LIFETIME_CI 50
00083 #else
00084 #define STUN_LIFETIME_EST 350
00085 #define STUN_LIFETIME_MAX 1800
00086 #define STUN_LIFETIME_CI 5
00087 #endif
00088
00089 #define STUN_ERROR(err, what) \
00090 SU_DEBUG_5(("%s: %s: %s\n", __func__, #what, su_strerror(err))), \
00091 -1 \
00092
00093 int stun_is_requested(tag_type_t tag, tag_value_t value, ...);
00094
00095
00096 int stun_make_sharedsecret_req(stun_msg_t *msg);
00097
00098 int stun_send_message(su_socket_t s, su_sockaddr_t *srvr,
00099 stun_msg_t *msg, stun_buffer_t *pwd);
00100
00101 void stun_free_message_data(stun_msg_t *msg);
00102
00103 int stun_make_binding_req(stun_handle_t *se, stun_request_t *req,
00104 stun_msg_t *msg,
00105 tag_type_t, tag_value_t, ...);
00106 int stun_process_response(stun_msg_t *msg);
00107
00108 int stun_process_binding_response(stun_msg_t *msg);
00109 int stun_process_error_response(stun_msg_t *msg);
00110
00111 int stun_atoaddr(su_home_t *home, int ai_family, su_addrinfo_t *info, char const *in);
00112 int stun_add_response_address(stun_msg_t *req, struct sockaddr_in *mapped_addr);
00113
00114 SOFIA_END_DECLS
00115
00116 #endif