Changeset 1405 for pjproject/trunk/pjnath/src/pjstun-srv-test/turn_usage.c
- Timestamp:
- Jul 20, 2007 8:08:30 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjstun-srv-test/turn_usage.c
r1380 r1405 160 160 pj_status_t status; 161 161 162 PJ_ASSERT_RETURN(srv && (type== PJ_SOCK_DGRAM||type==PJ_SOCK_STREAM),162 PJ_ASSERT_RETURN(srv && (type==pj_SOCK_DGRAM()||type==pj_SOCK_STREAM()), 163 163 PJ_EINVAL); 164 164 si = pj_stun_server_get_info(srv); … … 186 186 usage_cb.on_destroy = &tu_on_destroy; 187 187 status = pj_stun_usage_create(srv, "turn%p", &usage_cb, 188 PJ_AF_INET, tu->type, 0,188 pj_AF_INET(), tu->type, 0, 189 189 &local_addr, sizeof(local_addr), 190 190 &tu->usage); … … 298 298 /* STUN message decoding flag */ 299 299 flags = 0; 300 if (tu->type == PJ_SOCK_DGRAM)300 if (tu->type == pj_SOCK_DGRAM()) 301 301 flags |= PJ_STUN_IS_DATAGRAM; 302 302 … … 362 362 363 363 /* Allocate specific port */ 364 status = pj_sock_socket( PJ_AF_INET, type, 0, &sock);364 status = pj_sock_socket(pj_AF_INET(), type, 0, &sock); 365 365 if (status != PJ_SUCCESS) 366 366 return status; … … 401 401 } 402 402 403 status = pj_sock_socket( PJ_AF_INET, type, 0, &sock);403 status = pj_sock_socket(pj_AF_INET(), type, 0, &sock); 404 404 if (status != PJ_SUCCESS) 405 405 return status; … … 511 511 sd = (struct session_data*) pj_stun_session_get_user_data(sess); 512 512 513 if (sd->tu->type == PJ_SOCK_DGRAM) {513 if (sd->tu->type == pj_SOCK_DGRAM()) { 514 514 return pj_stun_usage_sendto(sd->tu->usage, pkt, pkt_size, 0, 515 515 dst_addr, addr_len); … … 547 547 static const char *get_tp_type(int type) 548 548 { 549 if (type== PJ_SOCK_DGRAM)549 if (type==pj_SOCK_DGRAM()) 550 550 return "udp"; 551 else if (type== PJ_SOCK_STREAM)551 else if (type==pj_SOCK_STREAM()) 552 552 return "tcp"; 553 553 else … … 595 595 sd = (struct session_data*) pj_stun_session_get_user_data(sess); 596 596 597 if (sd->tu->type == PJ_SOCK_DGRAM) {597 if (sd->tu->type == pj_SOCK_DGRAM()) { 598 598 return pj_stun_usage_sendto(sd->tu->usage, pkt, pkt_size, 0, 599 599 dst_addr, addr_len); … … 952 952 return PJ_SUCCESS; 953 953 } else if (a_rt) { 954 client->sock_type = a_rt->value ? PJ_SOCK_STREAM : PJ_SOCK_DGRAM;954 client->sock_type = a_rt->value ? pj_SOCK_STREAM() : pj_SOCK_DGRAM(); 955 955 } else { 956 956 client->sock_type = client->tu->type;; … … 958 958 959 959 /* Process REQUESTED-IP attribute */ 960 if (a_rip && a_rip->sockaddr.addr.sa_family != PJ_AF_INET) {960 if (a_rip && a_rip->sockaddr.addr.sa_family != pj_AF_INET()) { 961 961 client_respond(client, msg, PJ_STUN_SC_INVALID_IP_ADDR, NULL, 962 962 src_addr, src_addr_len); … … 1131 1131 client->active_peer = NULL; 1132 1132 1133 } else if (a_raddr->sockaddr.addr.sa_family != PJ_AF_INET) {1133 } else if (a_raddr->sockaddr.addr.sa_family != pj_AF_INET()) { 1134 1134 /* Bad request (not IPv4) */ 1135 1135 client_respond(client, msg, PJ_STUN_SC_BAD_REQUEST, NULL, … … 1197 1197 return PJ_SUCCESS; 1198 1198 1199 } else if (a_raddr->sockaddr.addr.sa_family != PJ_AF_INET) {1199 } else if (a_raddr->sockaddr.addr.sa_family != pj_AF_INET()) { 1200 1200 /* REMOTE-ADDRESS present but not IPv4, discard packet */ 1201 1201 return PJ_SUCCESS; … … 1210 1210 datalen = a_data->length; 1211 1211 1212 } else if (client->sock_type == PJ_SOCK_STREAM) {1212 } else if (client->sock_type == pj_SOCK_STREAM()) { 1213 1213 /* Discard if no Data and Allocation type is TCP */ 1214 1214 return PJ_SUCCESS;
Note: See TracChangeset
for help on using the changeset viewer.