~ubuntu-branches/ubuntu/saucy/ncbi-tools6/saucy-proposed

« back to all changes in this revision

Viewing changes to connect/ncbi_socket.h

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2009-08-11 22:03:47 UTC
  • mfrom: (1.4.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: james.westby@ubuntu.com-20090811220347-g4b6lzdvphvvbpiu
* New upstream release.
* debian/libncbi6.symbols: update accordingly.
* debian/control: clean up obsolete or redundant relationship declarations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef CONNECT___NCBI_SOCKET__H
2
2
#define CONNECT___NCBI_SOCKET__H
3
3
 
4
 
/* $Id: ncbi_socket.h,v 6.70 2008/10/31 11:25:51 kazimird Exp $
 
4
/* $Id: ncbi_socket.h,v 6.71 2009/05/04 15:54:29 kazimird Exp $
5
5
 * ===========================================================================
6
6
 *
7
7
 *                            PUBLIC DOMAIN NOTICE
33
33
 *   Plain portable TCP/IP socket API for:  UNIX, MS-Win, MacOS
34
34
 *   Platform-specific library requirements:
35
35
 *     [UNIX ]   -DNCBI_OS_UNIX     -lresolv -lsocket -lnsl
36
 
 *     [MSWIN]   -DNCBI_OS_MSWIN    wsock32.lib
37
 
 *     [MacOS]   -DNCBI_OS_MAC      NCSASOCK -- BSD-style socket emulation lib
 
36
 *     [MSWIN]   -DNCBI_OS_MSWIN    ws2_32.lib
38
37
 *
39
38
 *********************************
40
39
 * Generic:
452
451
    fSOCK_LogDefault   = eDefault,
453
452
    fSOCK_BindAny      = 0,      /** bind to 0.0.0.0 (i.e. any), default     */
454
453
    fSOCK_BindLocal    = 0x10,   /** bind to 127.0.0.1 only                  */
455
 
    fSOCK_KeepOnExec   = 0x20,   /** can be applied to most sockets          */
456
 
    fSOCK_CloseOnExec  = 0,      /** can be applied to most sockets          */
 
454
    fSOCK_KeepOnExec   = 0x20,   /** can be applied to all sockets           */
 
455
    fSOCK_CloseOnExec  = 0,      /** can be applied to all sockets           */
457
456
    fSOCK_Secure       = 0x40,   /** subsumes CloseOnExec regardless of Keep */
458
 
    fSOCK_KeepOnClose  = 0x80,   /** do not close OS handle on SOCK_Close    */
459
 
    fSOCK_CloseOnClose = 0,      /** do     close OS handle on SOCK_Close    */
 
457
    fSOCK_KeepOnClose  = 0x80,   /** do not close OS handle on SOCK_Close[Ex]*/
 
458
    fSOCK_CloseOnClose = 0,      /** do     close OS handle on SOCK_Close[Ex]*/
460
459
    fSOCK_ReadOnWrite       = 0x100,
461
460
    fSOCK_InterruptOnSignal = 0x200
462
461
} ESOCK_Flags;
483
482
 * @param backlog
484
483
 *  [in]  maximal # of pending connections
485
484
 *  <b>NOTE:</b> on some systems, "backlog" can be silently limited
486
 
 *  down to 128 (or 5).
 
485
 *  down to 128 (or 5), or completely ignored whatsoever.
487
486
 * @param lsock
488
487
 *  [out] handle of the created listening socket
489
488
 * @param flags
507
506
 * @param backlog
508
507
 *  [in]  maximal # of pending connections
509
508
 *  <b>NOTE:</b> on some systems, "backlog" can be silently limited
510
 
 *  down to 128 (or 5).
 
509
 *  down to 128 (or 5), or completely ignored whatsoever.
511
510
 * @param lsock
512
511
 *  [out] handle of the created listening socket
513
512
 * @sa
1123
1122
 * Break actual connection if any was established.
1124
1123
 * Do not attempt to send anything upon SOCK_Close().
1125
1124
 * This call is available for stream sockets only.
 
1125
 * NB:  Even though the underlying OS socket handle may have been marked for
 
1126
 *      preservation via fSOCK_KeepOnClose, this call always and unconditially
 
1127
 *      closes and destroys the actual OS handle.
1126
1128
 * @param sock
1127
1129
 * Socket handle
1128
1130
 */
1175
1177
 * @param buf
1176
1178
 *  [out] pointer to provided buffer to store the text to
1177
1179
 * @param buflen
1178
 
 *  [in] usable size of the buffer above 
 
1180
 *  [in]  usable size of the buffer above 
 
1181
 * @param format
 
1182
 *  [in]  what parts of address to include
1179
1183
 * @return
1180
1184
 *  On success, return its "buf" argument; return 0 on error.
1181
 
*/
 
1185
 */
 
1186
typedef enum {
 
1187
    eSAF_Full = 0,  /** address in full, native form                      */
 
1188
    eSAF_Port,      /** only numeric port if INET socket, empty otherwise */
 
1189
    eSAF_IP         /** only numeric IP if INET socket,   empty otherwise */  
 
1190
} ESOCK_AddressFormat;
 
1191
 
 
1192
extern NCBI_XCONNECT_EXPORT char* SOCK_GetPeerAddressStringEx
 
1193
(SOCK                sock,
 
1194
 char*               buf,
 
1195
 size_t              buflen,
 
1196
 ESOCK_AddressFormat format
 
1197
 );
 
1198
 
 
1199
 
 
1200
/** Equivalent to SOCK_GetPeerAddressStringEx(.,.,.,eSAF_Full) */
1182
1201
extern NCBI_XCONNECT_EXPORT char* SOCK_GetPeerAddressString
1183
1202
(SOCK   sock,
1184
 
 char*  buf,       
1185
 
 size_t buflen     
 
1203
 char*  buf,
 
1204
 size_t buflen
1186
1205
 );
1187
1206
 
1188
1207
 
1197
1216
 */
1198
1217
extern NCBI_XCONNECT_EXPORT EIO_Status SOCK_GetOSHandle
1199
1218
(SOCK   sock,
1200
 
 void*  handle_buf,  
1201
 
 size_t handle_size  
 
1219
 void*  handle_buf,
 
1220
 size_t handle_size
1202
1221
 );
1203
1222
 
1204
1223