Changeset 1275 for pjproject/trunk/pjnath/include/pjnath/stun_msg.h
- Timestamp:
- May 15, 2007 10:42:56 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/include/pjnath/stun_msg.h
r1154 r1275 133 133 #define PJ_STUN_IS_REQUEST(msg_type) (((msg_type) & 0x0110) == 0x0000) 134 134 135 /** 136 * Determine if the message type is a successful response. 137 */ 138 #define PJ_STUN_IS_SUCCESS_RESPONSE(msg_type) (((msg_type) & 0x0110) == 0x0100) 139 140 /** 141 * The response bit in the message type. 142 */ 143 #define PJ_STUN_RESPONSE_BIT (0x0100) 144 145 /** 146 * Determine if the message type is an error response. 147 */ 148 #define PJ_STUN_IS_ERROR_RESPONSE(msg_type) (((msg_type) & 0x0110) == 0x0110) 149 150 /** 151 * The error response bit in the message type. 152 */ 153 #define PJ_STUN_ERROR_RESPONSE_BIT (0x0110) 135 154 136 155 /** 137 156 * Determine if the message type is a response. 138 157 */ 139 #define PJ_STUN_IS_SUCCESS_RESPONSE(msg_type) (((msg_type) & 0x0110) == 0x0100) 140 141 142 /** 143 * The response bit in the message type. 144 */ 145 #define PJ_STUN_RESPONSE_BIT (0x0100) 146 147 /** 148 * Determine if the message type is an error response. 149 */ 150 #define PJ_STUN_IS_ERROR_RESPONSE(msg_type) (((msg_type) & 0x0110) == 0x0110) 151 152 153 /** 154 * The error response bit in the message type. 155 */ 156 #define PJ_STUN_ERROR_RESPONSE_BIT (0x0110) 157 158 #define PJ_STUN_IS_RESPONSE(msg_type) (((msg_type) & 0x0100) == 0x0100) 158 159 159 160 /** … … 1149 1150 * sent to remote destination. This function will take care about 1150 1151 * calculating the MESSAGE-INTEGRITY digest as well as FINGERPRINT 1151 * value. 1152 * 1153 * If MESSAGE-INTEGRITY attribute is present, the function assumes 1154 * that application wants to include credential (short or long term) 1155 * in the message, and this function will calculate the HMAC digest 1156 * from the message using the supplied password in the parameter. 1157 * If REALM attribute is present, the HMAC digest is calculated as 1158 * long term credential, otherwise as short term credential. 1152 * value, if these attributes are present in the message. 1153 * 1154 * If application wants to apply credential to the message, it MUST 1155 * include a blank MESSAGE-INTEGRITY attribute in the message, as the 1156 * last attribute or the attribute before FINGERPRINT. This function will 1157 * calculate the HMAC digest from the message using the supplied key in 1158 * the parameter. The key should be set to the password if short term 1159 * credential is used, or calculated from the MD5 hash of the realm, 1160 * username, and password using #pj_stun_create_key() if long term 1161 * credential is used. 1159 1162 * 1160 1163 * If FINGERPRINT attribute is present, this function will calculate 1161 * the FINGERPRINT CRC attribute for the message. 1164 * the FINGERPRINT CRC attribute for the message. The FINGERPRINT MUST 1165 * be added as the last attribute of the message. 1162 1166 * 1163 1167 * @param msg The STUN message to be printed. Upon return, … … 1167 1171 * @param buf_size Size of the buffer. 1168 1172 * @param options Options, which currently must be zero. 1169 * @param password Password to be used when credential is to be1170 * included. This parameter MUST be specified when1171 * the message contains MESSAGE-INTEGRITY attribute.1173 * @param key Authentication key to calculate MESSAGE-INTEGRITY 1174 * value. Application can create this key by using 1175 * #pj_stun_create_key() function. 1172 1176 * @param p_msg_len Upon return, it will be filed with the size of 1173 1177 * the packet in bytes, or negative value on error. … … 1179 1183 unsigned buf_size, 1180 1184 unsigned options, 1181 const pj_str_t * password,1185 const pj_str_t *key, 1182 1186 unsigned *p_msg_len); 1187 1188 1189 /** 1190 * Create authentication key to be used for encoding the message with 1191 * MESSAGE-INTEGRITY. If short term credential is used (i.e. the realm 1192 * argument is NULL or empty), the key will be copied from the password. 1193 * If long term credential is used, the key will be calculated from the 1194 * MD5 hash of the realm, username, and password. 1195 * 1196 * @param pool Pool to allocate memory for the key. 1197 * @param key String to receive the key. 1198 * @param realm The realm of the credential, if long term credential 1199 * is to be used. If short term credential is wanted, 1200 * application can put NULL or empty string here. 1201 * @param username The username. 1202 * @param passwd The clear text password. 1203 */ 1204 PJ_DECL(void) pj_stun_create_key(pj_pool_t *pool, 1205 pj_str_t *key, 1206 const pj_str_t *realm, 1207 const pj_str_t *username, 1208 const pj_str_t *passwd); 1209 1210 1183 1211 1184 1212 /**
Note: See TracChangeset
for help on using the changeset viewer.