4 * @NICE_COMPATIBILITY_MSN: Use compatibility for MSN Messenger specs
5 * @NICE_COMPATIBILITY_WLM2009: Use compatibility with Windows Live Messenger
7 + * @NICE_COMPATIBILITY_OC2007R2: Use compatibility with Microsoft Office
8 + * Communicator 2007 R2
9 * @NICE_COMPATIBILITY_DRAFT19: Use compatibility for ICE Draft 19 specs
10 * @NICE_COMPATIBILITY_LAST: Dummy last compatibility mode
13 NICE_COMPATIBILITY_GOOGLE,
14 NICE_COMPATIBILITY_MSN,
15 NICE_COMPATIBILITY_WLM2009,
16 + NICE_COMPATIBILITY_OC2007R2,
17 NICE_COMPATIBILITY_DRAFT19 = NICE_COMPATIBILITY_RFC5245,
18 - NICE_COMPATIBILITY_LAST = NICE_COMPATIBILITY_WLM2009,
19 + NICE_COMPATIBILITY_LAST = NICE_COMPATIBILITY_OC2007R2,
24 * This function will set the value of the SOFTWARE attribute to be added to
25 * STUN requests, responses and error responses sent during connectivity checks.
27 - * The SOFTWARE attribute will only be added in the #NICE_COMPATIBILITY_RFC5245
28 - * and #NICE_COMPATIBILITY_WLM2009 compatibility modes.
29 + * The SOFTWARE attribute will only be added in the #NICE_COMPATIBILITY_RFC5245,
30 + * #NICE_COMPATIBILITY_WLM2009 and #NICE_COMPATIBILITY_OC2007R2 compatibility
39 STUN_USAGE_ICE_COMPATIBILITY_GOOGLE :
40 agent->compatibility == NICE_COMPATIBILITY_MSN ?
41 STUN_USAGE_ICE_COMPATIBILITY_MSN :
42 + agent->compatibility == NICE_COMPATIBILITY_OC2007R2 ?
43 + STUN_USAGE_ICE_COMPATIBILITY_OC2007R2 :
44 STUN_USAGE_ICE_COMPATIBILITY_RFC5245;
48 agent->compatibility == NICE_COMPATIBILITY_MSN ?
49 STUN_USAGE_TURN_COMPATIBILITY_MSN :
50 agent->compatibility == NICE_COMPATIBILITY_WLM2009 ?
51 + STUN_USAGE_TURN_COMPATIBILITY_MSN :
52 + agent->compatibility == NICE_COMPATIBILITY_OC2007R2 ?
53 STUN_USAGE_TURN_COMPATIBILITY_MSN : STUN_USAGE_TURN_COMPATIBILITY_DRAFT9;
57 STUN_COMPATIBILITY_RFC3489,
58 STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS |
59 STUN_AGENT_USAGE_FORCE_VALIDATER);
60 - } else if (agent->compatibility == NICE_COMPATIBILITY_WLM2009) {
61 + } else if (agent->compatibility == NICE_COMPATIBILITY_WLM2009 ||
62 + agent->compatibility == NICE_COMPATIBILITY_OC2007R2) {
63 stun_agent_init (&agent->stun_agent, STUN_ALL_KNOWN_ATTRIBUTES,
64 STUN_COMPATIBILITY_WLM2009,
65 STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS |
67 --- a/agent/conncheck.c
68 +++ b/agent/conncheck.c
70 uname, uname_len, password, password_len,
71 agent->controlling_mode, agent->controlling_mode, priority,
73 - agent_to_ice_compatibility (agent));
74 + agent_to_ice_compatibility (agent),
77 nice_debug ("Agent %p: conncheck created %d - %p",
78 agent, buf_len, p->keepalive.stun_message.buffer);
81 memcpy (dest + len, local, local_len);
83 - } else if (agent->compatibility == NICE_COMPATIBILITY_WLM2009 &&
84 + } else if ((agent->compatibility == NICE_COMPATIBILITY_WLM2009 ||
85 + agent->compatibility == NICE_COMPATIBILITY_OC2007R2) &&
86 dest_len >= remote_len + local_len + 4 ) {
87 memcpy (dest, remote, remote_len);
90 uname, uname_len, password, password_len,
91 cand_use, controlling, priority,
93 - agent_to_ice_compatibility (agent));
94 + agent_to_ice_compatibility (agent),
97 nice_debug ("Agent %p: conncheck created %d - %p", agent, buffer_len, pair->stun_message.buffer);
100 * aggressive nomination mode, send a new triggered
101 * check to nominate the pair */
102 if ((agent->compatibility == NICE_COMPATIBILITY_RFC5245 ||
103 - agent->compatibility == NICE_COMPATIBILITY_WLM2009) &&
104 + agent->compatibility == NICE_COMPATIBILITY_WLM2009 ||
105 + agent->compatibility == NICE_COMPATIBILITY_OC2007R2) &&
106 agent->controlling_mode)
107 priv_conn_check_initiate (agent, p);
110 --- a/stun/usages/ice.h
111 +++ b/stun/usages/ice.h
113 * implementation of ICE
114 * @STUN_USAGE_ICE_COMPATIBILITY_MSN: The ICE compatibility with MSN's
115 * implementation of ICE
116 + * @STUN_USAGE_ICE_COMPATIBILITY_OC2007R2: The ICE compatibility with Microsoft
117 + * Office Communicator 2007 R2 implementation of ICE
118 * @STUN_USAGE_ICE_COMPATIBILITY_DRAFT19: The ICE compatibility with draft 19
120 * This enum defines which compatibility modes this ICE usage can use
122 STUN_USAGE_ICE_COMPATIBILITY_RFC5245,
123 STUN_USAGE_ICE_COMPATIBILITY_GOOGLE,
124 STUN_USAGE_ICE_COMPATIBILITY_MSN,
125 + STUN_USAGE_ICE_COMPATIBILITY_OC2007R2,
126 STUN_USAGE_ICE_COMPATIBILITY_DRAFT19 = STUN_USAGE_ICE_COMPATIBILITY_RFC5245,
127 } StunUsageIceCompatibility;
129 @@ -132,10 +135,14 @@
130 * ICE-CONTROLLING attribute
131 * @compatibility: The compatibility mode to use for building the conncheck
133 + * @candidate_identifier: The foundation value to put in the
134 + * CANDIDATE-IDENTIFIER attribute
136 * Builds an ICE connectivity check STUN message.
137 * If the compatibility is not #STUN_USAGE_ICE_COMPATIBILITY_RFC5245, the
138 * @cand_use, @controlling, @priority and @tie arguments are not used.
139 + * If the compatibility is not #STUN_USAGE_ICE_COMPATIBILITY_OC2007R2, the
140 + * @candidate_identifier argument is not used.
141 * Returns: The length of the message built.
145 const uint8_t *username, const size_t username_len,
146 const uint8_t *password, const size_t password_len,
147 bool cand_use, bool controlling, uint32_t priority,
148 - uint64_t tie, StunUsageIceCompatibility compatibility);
150 + uint64_t tie, StunUsageIceCompatibility compatibility,
151 + const char *candidate_identifier);
154 * stun_usage_ice_conncheck_process:
156 --- a/stun/usages/ice.c
157 +++ b/stun/usages/ice.c
165 #include <winsock2.h>
167 const uint8_t *username, const size_t username_len,
168 const uint8_t *password, const size_t password_len,
169 bool cand_use, bool controlling, uint32_t priority,
170 - uint64_t tie, StunUsageIceCompatibility compatibility)
171 + uint64_t tie, StunUsageIceCompatibility compatibility,
172 + const char *candidate_identifier)
174 StunMessageReturn val;
176 stun_agent_init_request (agent, msg, buffer, buffer_len, STUN_BINDING);
178 - if (compatibility == STUN_USAGE_ICE_COMPATIBILITY_RFC5245) {
179 + if (compatibility == STUN_USAGE_ICE_COMPATIBILITY_RFC5245 ||
180 + compatibility == STUN_USAGE_ICE_COMPATIBILITY_OC2007R2) {
183 val = stun_message_append_flag (msg, STUN_ATTRIBUTE_USE_CANDIDATE);
185 username, username_len);
186 if (val != STUN_MESSAGE_RETURN_SUCCESS)
190 + if (compatibility == STUN_USAGE_ICE_COMPATIBILITY_OC2007R2) {
191 + size_t identifier_len = strlen(candidate_identifier);
192 + size_t buffer_len = identifier_len;
193 + int modulo4 = identifier_len % 4;
197 + buffer_len += 4 - modulo4;
199 + buf = malloc(buffer_len);
200 + memset(buf, 0, buffer_len);
201 + memcpy(buf, candidate_identifier, identifier_len);
203 + val = stun_message_append_bytes (msg, STUN_ATTRIBUTE_CANDIDATE_IDENTIFIER,
208 + if (val != STUN_MESSAGE_RETURN_SUCCESS)
212 return stun_agent_finish_message (agent, msg, password, password_len);
214 --- a/stun/stunmessage.h
215 +++ b/stun/stunmessage.h
217 * defined by ICE draft 19
218 * @STUN_ATTRIBUTE_ICE_CONTROLLING: The ICE-CONTROLLING optional attribute as
219 * defined by ICE draft 19
220 + * @STUN_ATTRIBUTE_CANDIDATE_IDENTIFIER: The CANDIDATE-IDENTIFIER attribute as
221 + * defined by [MS-ICE2]
223 * Known STUN attribute types as defined by various RFCs and drafts
226 STUN_ATTRIBUTE_FINGERPRINT=0x8028, /* RFC5389 */
227 STUN_ATTRIBUTE_ICE_CONTROLLED=0x8029, /* ICE-19 */
228 STUN_ATTRIBUTE_ICE_CONTROLLING=0x802A, /* ICE-19 */
229 - /* 0x802B-0xFFFF */ /* reserved */
230 + /* 0x802B-0x8053 */ /* reserved */
231 + STUN_ATTRIBUTE_CANDIDATE_IDENTIFIER=0x8054 /* MS-ICE2 */
232 + /* 0x8055-0xFFFF */ /* reserved */