~ubuntu-branches/ubuntu/precise/ncbi-tools6/precise

« back to all changes in this revision

Viewing changes to connect/ncbisock.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2005-03-27 12:00:15 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050327120015-embhesp32nj73p9r
Tags: 6.1.20041020-3
* Fix FTBFS under GCC 4.0 caused by inconsistent use of "static" on
  functions.  (Closes: #295110.)
* Add a watch file, now that we can.  (Upstream's layout needs version=3.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: ncbisock.c,v 6.5 2001/04/03 22:17:05 juran Exp $
 
1
/* $Id: ncbisock.c,v 6.11 2002/09/13 19:17:36 lavr Exp $
2
2
 * ===========================================================================
3
3
 *
4
4
 *                            PUBLIC DOMAIN NOTICE
39
39
 *
40
40
 * ---------------------------------------------------------------------------
41
41
 * $Log: ncbisock.c,v $
 
42
 * Revision 6.11  2002/09/13 19:17:36  lavr
 
43
 * Fix incomplete S2E() mapping
 
44
 *
 
45
 * Revision 6.10  2002/08/27 20:26:23  lavr
 
46
 * Fixed reference: SOCK_htonl() -> SOCK_HostToNetLong()
 
47
 *
 
48
 * Revision 6.9  2002/08/12 20:01:30  lavr
 
49
 * Fix SOCK_Write() call (misplaced argument)
 
50
 *
 
51
 * Revision 6.8  2002/08/12 19:55:46  lavr
 
52
 * Use write_mode in SOCK_Write()
 
53
 *
 
54
 * Revision 6.7  2002/08/07 18:45:17  lavr
 
55
 * Change from deprecated to current EIO_ReadMethod enums
 
56
 *
 
57
 * Revision 6.6  2002/08/07 18:34:21  lavr
 
58
 * SOCK_GetAddress() -> SOCK_GetPeerAddress()
 
59
 *
42
60
 * Revision 6.5  2001/04/03 22:17:05  juran
43
61
 * Backout previous change.
44
62
 *
107
125
  eSOCK_EClosed,
108
126
  eSOCK_EUnknown,
109
127
  eSOCK_EUnknown,
 
128
  eSOCK_EUnknown,
110
129
  eSOCK_EUnknown
111
130
};
112
131
#define S2E(status)  s_ESOCK_ErrCode[(int) status]
391
410
{
392
411
  size_t x_read;
393
412
  ESOCK_ErrCode err_code =
394
 
    S2E( SOCK_Read(sock, buf, (size_t) size, &x_read, eIO_Plain) );
 
413
    S2E( SOCK_Read(sock, buf, (size_t) size, &x_read, eIO_ReadPlain) );
395
414
  *n_read = (Nlm_Uint4) x_read;
396
415
  return err_code;
397
416
}
405
424
{
406
425
  size_t x_read;
407
426
  ESOCK_ErrCode err_code =
408
 
    S2E( SOCK_Read(sock, buf, (size_t) size, &x_read, eIO_Persist) );
 
427
    S2E( SOCK_Read(sock, buf, (size_t) size, &x_read, eIO_ReadPersist) );
409
428
  *n_read = (Nlm_Uint4) x_read;
410
429
  return err_code;
411
430
}
419
438
{
420
439
  size_t x_read;
421
440
  ESOCK_ErrCode err_code =
422
 
    S2E( SOCK_Read(sock, buf, (size_t) size, &x_read, eIO_Peek) );
 
441
    S2E( SOCK_Read(sock, buf, (size_t) size, &x_read, eIO_ReadPeek) );
423
442
  *n_read = (Nlm_Uint4) x_read;
424
443
  return err_code;
425
444
}
448
467
{
449
468
  size_t x_written;
450
469
  ESOCK_ErrCode err_code =
451
 
    S2E( SOCK_Write(sock, buf, (size_t) size, &x_written) );
 
470
    S2E( SOCK_Write(sock, buf, (size_t) size, &x_written, eIO_WritePersist) );
452
471
  if ( n_written )
453
472
    *n_written = (Nlm_Uint4) x_written;
454
473
  return err_code;
463
482
{
464
483
  if ( host ) {
465
484
    unsigned int x_host;
466
 
    SOCK_GetAddress(sock, &x_host, 0, network_byte_order ? 1 : 0);
 
485
    SOCK_GetPeerAddress(sock, &x_host, 0, network_byte_order
 
486
                        ? eNH_NetworkByteOrder : eNH_HostByteOrder);
467
487
    *host = x_host;
468
488
  }
469
489
  if ( port ) {
470
490
    unsigned short x_port;
471
 
    SOCK_GetAddress(sock, 0, &x_port, network_byte_order ? 1 : 0);
 
491
    SOCK_GetPeerAddress(sock, 0, &x_port, network_byte_order
 
492
                        ? eNH_NetworkByteOrder : eNH_HostByteOrder);
472
493
    *port = x_port;
473
494
  }
474
495
}
510
531
 
511
532
NLM_EXTERN Nlm_Uint4 Nlm_htonl(Nlm_Uint4 value)
512
533
{
513
 
  return (Nlm_Uint4) SOCK_htonl((Nlm_Uint4) value);
 
534
  return (Nlm_Uint4) SOCK_HostToNetLong((Nlm_Uint4) value);
514
535
}