summaryrefslogtreecommitdiff
authorkorovkin <korovkin>2007-01-24 18:38:04 (UTC)
committer korovkin <korovkin>2007-01-24 18:38:04 (UTC)
commita4a7bd22feb060a80e20c81cded43cc24f5cd423 (patch) (unidiff)
tree5d92d27b96ad235f3815014f98d49c766461a678
parent8644340455a433f4d6e3b31b329479f1e7983f78 (diff)
downloadopie-a4a7bd22feb060a80e20c81cded43cc24f5cd423.zip
opie-a4a7bd22feb060a80e20c81cded43cc24f5cd423.tar.gz
opie-a4a7bd22feb060a80e20c81cded43cc24f5cd423.tar.bz2
OBEX push server has a more common description.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/obexserver.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/obex/obexserver.cpp b/core/obex/obexserver.cpp
index 25d8224..f1fb205 100644
--- a/core/obex/obexserver.cpp
+++ b/core/obex/obexserver.cpp
@@ -292,97 +292,97 @@ sdp_session_t* ObexServer::addOpushSvc(uint8_t chan, const char* name)
292 apseq = sdp_list_append(apseq, proto[2]); 292 apseq = sdp_list_append(apseq, proto[2]);
293 293
294 aproto = sdp_list_append(0, apseq); 294 aproto = sdp_list_append(0, apseq);
295 sdp_set_access_protos(&record, aproto); 295 sdp_set_access_protos(&record, aproto);
296 296
297 for (i = 0; i < sizeof(formats); i++) 297 for (i = 0; i < sizeof(formats); i++)
298 { 298 {
299 dtds[i] = &dtd; 299 dtds[i] = &dtd;
300 values[i] = &formats[i]; 300 values[i] = &formats[i];
301 } 301 }
302 sflist = sdp_seq_alloc(dtds, values, sizeof(formats)); 302 sflist = sdp_seq_alloc(dtds, values, sizeof(formats));
303 sdp_attr_add(&record, SDP_ATTR_SUPPORTED_FORMATS_LIST, sflist); 303 sdp_attr_add(&record, SDP_ATTR_SUPPORTED_FORMATS_LIST, sflist);
304 304
305 sdp_set_info_attr(&record, name, 0, 0); 305 sdp_set_info_attr(&record, name, 0, 0);
306 306
307 // connect to the local SDP server, register the service record, and 307 // connect to the local SDP server, register the service record, and
308 // disconnect 308 // disconnect
309 lsession = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY); 309 lsession = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY);
310 if (lsession == NULL) 310 if (lsession == NULL)
311 goto errout; 311 goto errout;
312 err = sdp_record_register(lsession, &record, 0); 312 err = sdp_record_register(lsession, &record, 0);
313 if (err) { 313 if (err) {
314 sdp_close(lsession); 314 sdp_close(lsession);
315 lsession = NULL; 315 lsession = NULL;
316 } 316 }
317errout: 317errout:
318 sdp_data_free(channel); 318 sdp_data_free(channel);
319 sdp_list_free(proto[0], 0); 319 sdp_list_free(proto[0], 0);
320 sdp_list_free(proto[1], 0); 320 sdp_list_free(proto[1], 0);
321 sdp_list_free(proto[2], 0); 321 sdp_list_free(proto[2], 0);
322 sdp_list_free(apseq, 0); 322 sdp_list_free(apseq, 0);
323 sdp_list_free(aproto, 0); 323 sdp_list_free(aproto, 0);
324 324
325 return lsession; 325 return lsession;
326} 326}
327 327
328int ObexServer::initObex(void) 328int ObexServer::initObex(void)
329{ 329{
330 int channel = 10; //Channel on which we do listen 330 int channel = 10; //Channel on which we do listen
331 if (m_obex) 331 if (m_obex)
332 return 0; 332 return 0;
333 m_obex = ::OBEX_Init(transport, obex_event, 0); 333 m_obex = ::OBEX_Init(transport, obex_event, 0);
334 if (!m_obex) { 334 if (!m_obex) {
335 printf("OBEX initialization error %d\n", errno); 335 printf("OBEX initialization error %d\n", errno);
336 return -1; 336 return -1;
337 } 337 }
338 if (transport == OBEX_TRANS_BLUETOOTH) { 338 if (transport == OBEX_TRANS_BLUETOOTH) {
339 ::BtOBEX_ServerRegister(m_obex, NULL, channel); 339 ::BtOBEX_ServerRegister(m_obex, NULL, channel);
340 m_session = addOpushSvc(channel, "OBEX push service"); 340 m_session = addOpushSvc(channel, "OBEX Object Push");
341 if (!m_session) { 341 if (!m_session) {
342 printf("OBEX registration error %d\n", errno); 342 printf("OBEX registration error %d\n", errno);
343 ::OBEX_Cleanup(m_obex); 343 ::OBEX_Cleanup(m_obex);
344 m_obex = NULL; 344 m_obex = NULL;
345 return -1; 345 return -1;
346 } 346 }
347 } else if (transport == OBEX_TRANS_IRDA) 347 } else if (transport == OBEX_TRANS_IRDA)
348 ::IrOBEX_ServerRegister(m_obex, "OBEX"); 348 ::IrOBEX_ServerRegister(m_obex, "OBEX");
349 return 0; 349 return 0;
350} 350}
351 351
352bool ObexServer::start(RunMode runmode, Communication comm) 352bool ObexServer::start(RunMode runmode, Communication comm)
353{ 353{
354 if ( runs ) 354 if ( runs )
355 { 355 {
356 return false; // cannot start a process that is already running 356 return false; // cannot start a process that is already running
357 // or if no executable has been assigned 357 // or if no executable has been assigned
358 } 358 }
359 run_mode = runmode; 359 run_mode = runmode;
360 status = 0; 360 status = 0;
361 361
362 if ( !setupCommunication( comm ) ) 362 if ( !setupCommunication( comm ) )
363 qWarning( "Could not setup Communication!" ); 363 qWarning( "Could not setup Communication!" );
364 364
365 // We do this in the parent because if we do it in the child process 365 // We do this in the parent because if we do it in the child process
366 // gdb gets confused when the application runs from gdb. 366 // gdb gets confused when the application runs from gdb.
367 uid_t uid = getuid(); 367 uid_t uid = getuid();
368 gid_t gid = getgid(); 368 gid_t gid = getgid();
369#ifdef HAVE_INITGROUPS 369#ifdef HAVE_INITGROUPS
370 370
371 struct passwd *pw = getpwuid( uid ); 371 struct passwd *pw = getpwuid( uid );
372#endif 372#endif
373 373
374 int fd[ 2 ]; 374 int fd[ 2 ];
375 if ( 0 > pipe( fd ) ) 375 if ( 0 > pipe( fd ) )
376 { 376 {
377 fd[ 0 ] = fd[ 1 ] = 0; // Pipe failed.. continue 377 fd[ 0 ] = fd[ 1 ] = 0; // Pipe failed.. continue
378 } 378 }
379 379
380 runs = true; 380 runs = true;
381 381
382 QApplication::flushX(); 382 QApplication::flushX();
383 383
384 // WABA: Note that we use fork() and not vfork() because 384 // WABA: Note that we use fork() and not vfork() because
385 // vfork() has unclear semantics and is not standardized. 385 // vfork() has unclear semantics and is not standardized.
386 pid_ = fork(); 386 pid_ = fork();
387 387
388 if ( 0 == pid_ ) 388 if ( 0 == pid_ )