comparison libfdcore/sctp_dtls.c @ 1222:5d0d300a7cd9

Add more traces for debug
author Sebastien Decugis <sdecugis@freediameter.net>
date Tue, 18 Jun 2013 17:05:44 +0800
parents 8802d3fa5876
children 33ad82ffbdde
comparison
equal deleted inserted replaced
1221:940713a4f296 1222:5d0d300a7cd9
141 int event; 141 int event;
142 CHECK_FCT_DO( fd_sctp_recvmeta(conn, strid, buf, len, &event), return -1 ); 142 CHECK_FCT_DO( fd_sctp_recvmeta(conn, strid, buf, len, &event), return -1 );
143 switch (event) { 143 switch (event) {
144 case FDEVP_CNX_MSG_RECV: 144 case FDEVP_CNX_MSG_RECV:
145 got_data = 1; 145 got_data = 1;
146 LOG_A("Received DTLS data, type %hhd, Seq %02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx, Stream %hu", 146 LOG_A("Received DTLS data, len %zd, type %hhd, Seq %02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx, Stream %hu",
147 (*buf)[0], 147 *len, (*buf)[0],
148 (*buf)[3],(*buf)[4],(*buf)[5],(*buf)[6], (*buf)[7],(*buf)[8],(*buf)[9],(*buf)[10], 148 (*buf)[3],(*buf)[4],(*buf)[5],(*buf)[6], (*buf)[7],(*buf)[8],(*buf)[9],(*buf)[10],
149 *strid); 149 *strid);
150 break; 150 break;
151 151
152 case FDEVP_CNX_EP_CHANGE: 152 case FDEVP_CNX_EP_CHANGE:
174 int i; 174 int i;
175 175
176 176
177 while (offset + 13 <= len) { 177 while (offset + 13 <= len) {
178 next_record_len = (buf[offset+11] << 8) + buf[offset+12]; 178 next_record_len = (buf[offset+11] << 8) + buf[offset+12];
179 LOG_A("update_nextseq_from_records off:%zd Type %hhd, Ver:%02hhx.%02hhx, Seq:%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx", 179 LOG_A("update_nextseq_from_records off:%zd Type %hhd, Ver:%02hhx.%02hhx, Len:%d, Seq:%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
180 offset, 180 offset,
181 buf[offset], buf[offset+1], buf[offset+2], 181 buf[offset], buf[offset+1], buf[offset+2], (((int)buf[offset+11])<<8)+((int)buf[offset+12]),
182 buf[offset+3],buf[offset+4],buf[offset+5],buf[offset+6],buf[offset+7],buf[offset+8],buf[offset+9],buf[offset+10] 182 buf[offset+3],buf[offset+4],buf[offset+5],buf[offset+6],buf[offset+7],buf[offset+8],buf[offset+9],buf[offset+10]
183 ); 183 );
184 184
185 if (memcmp(buf + offset + DTLS_SEQ_OFFSET, conn->cc_sctp_dtls_data.nextseq, 8) != 0) { 185 if (memcmp(buf + offset + DTLS_SEQ_OFFSET, conn->cc_sctp_dtls_data.nextseq, 8) != 0) {
186 /* The next record is not the one we expect in sequence. Is it a new epoch ? */ 186 /* The next record is not the one we expect in sequence. Is it a new epoch ? */
604 { 604 {
605 /* We do not use cookies at the moment. Not sure it is useful or not */ 605 /* We do not use cookies at the moment. Not sure it is useful or not */
606 /* TODO("Cookie exchange?"); */ 606 /* TODO("Cookie exchange?"); */
607 /* gnutls_dtls_prestate_set (session, &prestate); */ 607 /* gnutls_dtls_prestate_set (session, &prestate); */
608 608
609 gnutls_dtls_set_mtu(session, DTLS_SCTP_MTU); 609 GNUTLS_TRACE( gnutls_dtls_set_mtu(session, DTLS_SCTP_MTU));
610 610
611 gnutls_dtls_set_timeouts(session, 70000, 60000); /* Set retrans > total so that there is no retransmission, since SCTP is reliable */ 611 GNUTLS_TRACE( gnutls_dtls_set_timeouts(session, 70000, 60000)); /* Set retrans > total so that there is no retransmission, since SCTP is reliable */
612 612
613 #ifdef GNUTLS_VERSION_320 613 #ifdef GNUTLS_VERSION_320
614 TODO("Disable replay protection"); 614 TODO("Disable replay protection");
615 TODO("Register hook on the Finish message to change SCTP_AUTH active key on the socket"); 615 TODO("Register hook on the Finish message to change SCTP_AUTH active key on the socket");
616 #endif /* GNUTLS_VERSION_320 */ 616 #endif /* GNUTLS_VERSION_320 */
"Welcome to our mercurial repository"