Changeset 806
- Timestamp:
- Nov 19, 2006 2:59:13 PM (18 years ago)
- Location:
- pjproject/branches/symbian
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/symbian/pjlib/src/pj/addr_resolv_symbian.cpp
- Property svn:eol-style set to native
- Property svn:keywords set to id
r791 r806 40 40 // Resolve! 41 41 TNameEntry nameEntry; 42 TInt rc = resv.GetByName(data, nameEntry); 43 44 if (rc != KErrNone) 45 return PJ_RETURN_OS_ERROR(rc); 42 TRequestStatus reqStatus; 43 44 resv.GetByName(data, nameEntry, reqStatus); 45 User::WaitForRequest(reqStatus); 46 47 if (reqStatus != KErrNone) 48 return PJ_RETURN_OS_ERROR(reqStatus.Int()); 46 49 47 50 // Get the resolved TInetAddr -
pjproject/branches/symbian/pjlib/src/pj/ioqueue_symbian.cpp
r789 r806 115 115 pj_ioqueue_key_t *key_; 116 116 CPjSocket *sock_; 117 const pj_ioqueue_callback *cb_;117 pj_ioqueue_callback cb_; 118 118 void *user_data_; 119 119 … … 156 156 const pj_ioqueue_callback *cb, void *user_data) 157 157 : CActive(CActive::EPriorityStandard), 158 ioqueue_(ioqueue), key_(key), sock_((CPjSocket*)sock), cb_(cb),158 ioqueue_(ioqueue), key_(key), sock_((CPjSocket*)sock), 159 159 user_data_(user_data), aBufferPtr_(NULL, 0), type_(TYPE_NONE) 160 160 { 161 pj_memcpy(&cb_, cb, sizeof(*cb)); 161 162 } 162 163 … … 166 167 CActiveScheduler::Add(this); 167 168 } 169 170 void HandleReadCompletion(); 171 CPjSocket *HandleAcceptCompletion(); 168 172 }; 169 173 … … 217 221 return PJ_EPENDING; 218 222 } else { 219 return PJ_RETURN_OS_ERROR(iStatus.Int()); 223 // Complete immediately (with success or error) 224 if (iStatus == KErrNone) { 225 *size = aBufferPtr_.Length(); 226 HandleReadCompletion(); 227 return PJ_SUCCESS; 228 } 229 else { 230 pending_data_.read_.op_key_ = NULL; 231 pending_data_.read_.addr_ = NULL; 232 pending_data_.read_.addrlen_ = NULL; 233 return PJ_RETURN_OS_ERROR(iStatus.Int()); 234 } 220 235 } 221 236 } … … 250 265 return PJ_EPENDING; 251 266 } else { 252 return PJ_RETURN_OS_ERROR(iStatus.Int()); 253 } 267 // Accept() completed immediately (with success or error). 268 if (iStatus == KErrNone) { 269 HandleAcceptCompletion(); 270 return PJ_SUCCESS; 271 } 272 else { 273 pending_data_.accept_.op_key_ = NULL; 274 pending_data_.accept_.new_sock_ = NULL; 275 pending_data_.accept_.local_ = NULL; 276 pending_data_.accept_.remote_ = NULL; 277 pending_data_.accept_.addrlen_ = NULL; 278 return PJ_RETURN_OS_ERROR(iStatus.Int()); 279 } 280 } 281 } 282 283 284 // 285 // Handle asynchronous RecvFrom() completion 286 // 287 void CIoqueueCallback::HandleReadCompletion() 288 { 289 if (pending_data_.read_.addr_) { 290 PjSymbianOS::Addr2pj(aAddress_, 291 *(pj_sockaddr_in*)pending_data_.read_.addr_); 292 pending_data_.read_.addr_ = NULL; 293 } 294 if (pending_data_.read_.addrlen_) { 295 *pending_data_.read_.addrlen_ = sizeof(pj_sockaddr_in); 296 pending_data_.read_.addrlen_ = NULL; 297 } 298 299 pending_data_.read_.op_key_ = NULL; 300 } 301 302 303 // 304 // Handle asynchronous Accept() completion. 305 // 306 CPjSocket *CIoqueueCallback::HandleAcceptCompletion() 307 { 308 CPjSocket *pjNewSock = new CPjSocket(blank_sock_); 309 310 if (pending_data_.accept_.new_sock_) { 311 *pending_data_.accept_.new_sock_ = (pj_sock_t)pjNewSock; 312 pending_data_.accept_.new_sock_ = NULL; 313 } 314 315 if (pending_data_.accept_.local_) { 316 TInetAddr aAddr; 317 pj_sockaddr_in *ptr_sockaddr; 318 319 blank_sock_.LocalName(aAddr); 320 ptr_sockaddr = (pj_sockaddr_in*)pending_data_.accept_.local_; 321 PjSymbianOS::Addr2pj(aAddr, *ptr_sockaddr); 322 pending_data_.accept_.local_ = NULL; 323 } 324 325 if (pending_data_.accept_.remote_) { 326 TInetAddr aAddr; 327 pj_sockaddr_in *ptr_sockaddr; 328 329 blank_sock_.RemoteName(aAddr); 330 ptr_sockaddr = (pj_sockaddr_in*)pending_data_.accept_.remote_; 331 PjSymbianOS::Addr2pj(aAddr, *ptr_sockaddr); 332 pending_data_.accept_.remote_ = NULL; 333 } 334 335 if (pending_data_.accept_.addrlen_) { 336 *pending_data_.accept_.addrlen_ = sizeof(pj_sockaddr_in); 337 pending_data_.accept_.addrlen_ = NULL; 338 } 339 340 return pjNewSock; 254 341 } 255 342 … … 275 362 // Handle failure condition 276 363 if (iStatus != KErrNone) { 277 cb_->on_read_complete(key_, op_key, 278 -PJ_RETURN_OS_ERROR(iStatus.Int())); 364 if (cb_.on_read_complete) { 365 cb_.on_read_complete( key_, op_key, 366 -PJ_RETURN_OS_ERROR(iStatus.Int())); 367 } 279 368 return; 280 369 } 281 370 282 if (pending_data_.read_.addr_) { 283 PjSymbianOS::Addr2pj(aAddress_, 284 *(pj_sockaddr_in*)pending_data_.read_.addr_); 285 pending_data_.read_.addr_ = NULL; 286 } 287 if (pending_data_.read_.addrlen_) { 288 *pending_data_.read_.addrlen_ = sizeof(pj_sockaddr_in); 289 pending_data_.read_.addrlen_ = NULL; 290 } 371 HandleReadCompletion(); 291 372 292 373 /* Call callback */ 293 cb_->on_read_complete(key_, op_key, aBufferPtr_.Length()); 374 if (cb_.on_read_complete) { 375 cb_.on_read_complete(key_, op_key, aBufferPtr_.Length()); 376 } 294 377 295 378 } else if (cur_type == TYPE_ACCEPT) { … … 306 389 if (pending_data_.accept_.new_sock_) 307 390 *pending_data_.accept_.new_sock_ = PJ_INVALID_SOCKET; 308 309 cb_->on_accept_complete(key_, op_key, PJ_INVALID_SOCKET, 310 -PJ_RETURN_OS_ERROR(iStatus.Int())); 391 392 if (cb_.on_accept_complete) { 393 cb_.on_accept_complete( key_, op_key, PJ_INVALID_SOCKET, 394 -PJ_RETURN_OS_ERROR(iStatus.Int())); 395 } 311 396 return; 312 397 } 313 398 314 CPjSocket *pjNewSock = new CPjSocket(blank_sock_); 315 316 if (pending_data_.accept_.new_sock_) { 317 *pending_data_.accept_.new_sock_ = (pj_sock_t)pjNewSock; 318 pending_data_.accept_.new_sock_ = NULL; 319 } 320 321 if (pending_data_.accept_.local_) { 322 TInetAddr aAddr; 323 pj_sockaddr_in *ptr_sockaddr; 324 325 blank_sock_.LocalName(aAddr); 326 ptr_sockaddr = (pj_sockaddr_in*)pending_data_.accept_.local_; 327 PjSymbianOS::Addr2pj(aAddr, *ptr_sockaddr); 328 pending_data_.accept_.local_ = NULL; 329 } 330 331 if (pending_data_.accept_.remote_) { 332 TInetAddr aAddr; 333 pj_sockaddr_in *ptr_sockaddr; 334 335 blank_sock_.RemoteName(aAddr); 336 ptr_sockaddr = (pj_sockaddr_in*)pending_data_.accept_.remote_; 337 PjSymbianOS::Addr2pj(aAddr, *ptr_sockaddr); 338 pending_data_.accept_.remote_ = NULL; 339 } 340 341 if (pending_data_.accept_.addrlen_) { 342 *pending_data_.accept_.addrlen_ = sizeof(pj_sockaddr_in); 343 pending_data_.accept_.addrlen_ = NULL; 344 } 345 399 CPjSocket *pjNewSock = HandleAcceptCompletion(); 400 346 401 // Call callback. 347 cb_->on_accept_complete(key_, op_key, (pj_sock_t)pjNewSock, 348 PJ_SUCCESS); 402 if (cb_.on_accept_complete) { 403 cb_.on_accept_complete( key_, op_key, (pj_sock_t)pjNewSock, 404 PJ_SUCCESS); 405 } 349 406 } 350 407 … … 375 432 Cancel(); 376 433 377 if (cur_type == TYPE_READ) 378 cb_->on_read_complete(key_, op_key, bytes_status); 379 else if (cur_type == TYPE_ACCEPT) 434 if (cur_type == TYPE_READ) { 435 if (cb_.on_read_complete) 436 cb_.on_read_complete(key_, op_key, bytes_status); 437 } else if (cur_type == TYPE_ACCEPT) 380 438 ; 381 439 } -
pjproject/branches/symbian/pjlib/src/pjlib-test/main_symbian.cpp
r789 r806 71 71 void MyScheduler::Error(TInt aError) const 72 72 { 73 int i = 0;73 PJ_UNUSED_ARG(aError); 74 74 } 75 75 … … 155 155 wchar_t buf16[PJ_LOG_MAX_SIZE]; 156 156 157 PJ_UNUSED_ARG(level); 158 157 159 pj_ansi_to_unicode(buf, len, buf16, PJ_ARRAY_SIZE(buf16)); 158 160 -
pjproject/branches/symbian/pjlib/src/pjlib-test/sock.c
r788 r806 67 67 #define UDP_PORT 51234 68 68 #define TCP_PORT (UDP_PORT+10) 69 #define BIG_DATA_LEN 900069 #define BIG_DATA_LEN 8192 70 70 #define ADDRESS "127.0.0.1" 71 71 … … 350 350 rc = -121; goto on_error; 351 351 } 352 352 353 353 /* Test send/recv, with sendto */ 354 354 rc = send_recv_test(PJ_SOCK_DGRAM, ss, cs, &dstaddr, NULL, … … 362 362 if (rc != 0) 363 363 goto on_error; 364 364 365 // This test will fail on S60 3rd Edition MR2 366 #if 1 365 367 /* connect() the sockets. */ 366 368 rc = pj_sock_connect(cs, &dstaddr, sizeof(dstaddr)); … … 380 382 if (rc != 0) 381 383 goto on_error; 384 #endif 382 385 383 386 on_error: … … 437 440 } 438 441 442 #if 0 443 #include "../pj/os_symbian.h" 444 static int connect_test() 445 { 446 RSocketServ rSockServ; 447 RSocket rSock; 448 TInetAddr inetAddr; 449 TRequestStatus reqStatus; 450 char buffer[16]; 451 TPtrC8 data((const TUint8*)buffer, (TInt)sizeof(buffer)); 452 int rc; 453 454 rc = rSockServ.Connect(); 455 if (rc != KErrNone) 456 return rc; 457 458 rc = rSock.Open(rSockServ, KAfInet, KSockDatagram, KProtocolInetUdp); 459 if (rc != KErrNone) 460 { 461 rSockServ.Close(); 462 return rc; 463 } 464 465 inetAddr.Init(KAfInet); 466 inetAddr.Input(_L("127.0.0.1")); 467 inetAddr.SetPort(80); 468 469 rSock.Connect(inetAddr, reqStatus); 470 User::WaitForRequest(reqStatus); 471 472 if (reqStatus != KErrNone) { 473 rSock.Close(); 474 rSockServ.Close(); 475 return rc; 476 } 477 478 rSock.Send(data, 0, reqStatus); 479 User::WaitForRequest(reqStatus); 480 481 if (reqStatus!=KErrNone) { 482 rSock.Close(); 483 rSockServ.Close(); 484 return rc; 485 } 486 487 rSock.Close(); 488 rSockServ.Close(); 489 return KErrNone; 490 } 491 #endif 492 439 493 int sock_test() 440 494 { … … 443 497 pj_create_random_string(bigdata, BIG_DATA_LEN); 444 498 499 // Enable this to demonstrate the error witn S60 3rd Edition MR2 500 #if 0 501 rc = connect_test(); 502 if (rc != 0) 503 return rc; 504 #endif 505 445 506 rc = format_test(); 446 507 if (rc != 0) -
pjproject/branches/symbian/pjsip-apps/src/samples/main_symbian.cpp
r789 r806 34 34 // 35 35 char *argv[] = { "main_symbian", NULL }; 36 37 //console->Printf(_L("Press any key to start\n")); 38 //console->Getch(); 39 36 40 int rc = pj_app_main(1, argv); 37 41 -
pjproject/branches/symbian/pjsip-apps/src/samples/sipstateless.c
r789 r806 142 142 { 143 143 pj_sockaddr_in addr; 144 pjsip_host_port a_name; 144 145 145 146 addr.sin_family = PJ_AF_INET; … … 147 148 addr.sin_port = pj_htons(5060); 148 149 149 status = pjsip_udp_transport_start( sip_endpt, &addr, NULL, 1, NULL); 150 a_name.host = pj_str("127.0.0.1"); 151 a_name.port = 5060; 152 153 status = pjsip_udp_transport_start( sip_endpt, &addr, &a_name, 1, NULL); 150 154 if (status != PJ_SUCCESS) { 151 155 char errmsg[PJ_ERR_MSG_SIZE]; -
pjproject/branches/symbian/symbian
-
Property
svn:ignore
set to
*_Data
*.cwlink
*.mcp
*.xml
-
Property
svn:ignore
set to
Note: See TracChangeset
for help on using the changeset viewer.