NCBI C Toolkit Cross Reference

C/ctools/asn_connection.h


  1 #ifndef CTOOLS___ASN_CONNECTION__H
  2 #define CTOOLS___ASN_CONNECTION__H
  3 
  4 /*  $Id: asn_connection.h,v 1.10 2009/08/13 14:58:22 lavr Exp $
  5  * ===========================================================================
  6  *
  7  *                            PUBLIC DOMAIN NOTICE
  8  *               National Center for Biotechnology Information
  9  *
 10  *  This software/database is a "United States Government Work" under the
 11  *  terms of the United States Copyright Act.  It was written as part of
 12  *  the author's official duties as a United States Government employee and
 13  *  thus cannot be copyrighted.  This software/database is freely available
 14  *  to the public for use. The National Library of Medicine and the U.S.
 15  *  Government have not placed any restriction on its use or reproduction.
 16  *
 17  *  Although all reasonable efforts have been taken to ensure the accuracy
 18  *  and reliability of the software and data, the NLM and the U.S.
 19  *  Government do not and cannot warrant the performance or results that
 20  *  may be obtained by using this software or data. The NLM and the U.S.
 21  *  Government disclaim all warranties, express or implied, including
 22  *  warranties of performance, merchantability or fitness for any particular
 23  *  purpose.
 24  *
 25  *  Please cite the author in any work or product based on this material.
 26  *
 27  * ===========================================================================
 28  *
 29  * Author:  Denis Vakatov, Anton Lavrentiev
 30  *
 31  * File Description:
 32  *    Build C Toolkit ASN streams on top of CONN (connection).
 33  *
 34  */
 35 
 36 #include <connect/ncbi_connection.h>
 37 #include <connect/ncbi_service_connector.h>
 38 #include <asn.h>
 39 
 40 
 41 /** @addtogroup CToolsASNConn
 42  *
 43  * @{
 44  */
 45 
 46 
 47 #ifdef __cplusplus
 48 extern "C" {
 49 #endif
 50 
 51 
 52 typedef enum {
 53     eAsnConn_Input,
 54     eAsnConn_Output
 55 } EAsnConn_Direction;
 56 
 57 
 58 typedef enum {
 59     eAsnConn_Binary,
 60     eAsnConn_Text
 61 } EAsnConn_Format;
 62 
 63 
 64 /* Build ASN stream on top of CONN (connection) handle.
 65  * According to arguments, the stream is created for
 66  * either reading or writing, and is capable to handle
 67  * either binary or text ASN.
 68  * Return ASN stream pointer on success, or 0 on error.
 69  * NOTE: Returned stream is valid while the underlying conn exists. After call
 70  *       to CONN_Close() the stream becomes invalid, and should not be used.
 71  *       Don't destroy the ASN stream explicitly using AsnIoFree!
 72  */
 73 AsnIoPtr CreateAsnConn
 74 (CONN               conn,
 75  EAsnConn_Direction direction,
 76  EAsnConn_Format    fmt
 77  );
 78 
 79 
 80 /* Create service connection using the service name,
 81  * type and connection parameters, info (use default connection
 82  * parameters if info is passed NULL).
 83  * Create two ASN streams based on the connection -- one stream is for
 84  * input and one is for output. Return pointers to the streams 
 85  * via 'input' and 'output' arguments.
 86  * No corresponding stream is created if either pointer is passed NULL.
 87  * On success, return created CONN handle; otherwise, return 0.
 88  * NOTE: Returned ASN stream pointers are valid as long as connection
 89  *       handle exists, that is after the connection handle is passed to
 90  *       CONN_Close(), both pointers become invalid, and should not be used.
 91  *       Don't destroy the ASN streams explicitly using AsnIoFree!
 92  */
 93 CONN CreateAsnConn_ServiceEx
 94 (const char*           service,
 95  EAsnConn_Format       input_fmt,
 96  AsnIoPtr*             input,
 97  EAsnConn_Format       output_fmt,
 98  AsnIoPtr*             output,
 99  TSERV_Type            type,
100  const SConnNetInfo*   net_info,
101  const SSERVICE_Extra* params
102  );
103 
104 
105 /* Equivalent of CreateAsnConn_ServiceEx with zeroes in last three arguments.
106  */
107 CONN CreateAsnConn_Service
108 (const char*     service,
109  EAsnConn_Format input_fmt,
110  AsnIoPtr*       input,
111  EAsnConn_Format output_fmt,
112  AsnIoPtr*       output
113  );
114 
115 
116 #ifdef __cplusplus
117 }  /* extern "C" */
118 #endif
119 
120 
121 /* @} */
122 
123 
124 /*
125  * ===========================================================================
126  * $Log: asn_connection.h,v $
127  * Revision 1.10  2009/08/13 14:58:22  lavr
128  * Inline doc fixed of duplicates
129  *
130  * Revision 1.9  2004/11/23 16:14:25  lavr
131  * +<connect/ncbi_service_connector.h>
132  *
133  * Revision 1.8  2003/11/13 15:58:47  lavr
134  * Guard macro changed
135  *
136  * Revision 1.7  2003/04/11 17:46:29  siyan
137  * Added doxygen support
138  *
139  * Revision 1.6  2003/01/17 15:39:38  lavr
140  * Slightly modify API description for clarity
141  *
142  * Revision 1.5  2002/03/14 22:45:45  vakatov
143  * Warn against explicit destruction of ASN streams
144  *
145  * Revision 1.4  2001/12/02 21:17:28  lavr
146  * Fix in comment
147  *
148  * Revision 1.3  2001/09/24 20:32:34  lavr
149  * +SSERVICE_Extra* parameter in CreateAsnConn_ServiceEx()
150  *
151  * Revision 1.2  2001/06/28 23:01:53  vakatov
152  * Typo fixed (self-#include)
153  *
154  * Revision 1.1  2001/06/28 21:59:24  lavr
155  * Initial revision
156  *
157  * ==========================================================================
158  */
159 
160 #endif /* CTOOLS___ASN_CONNECTION__H */
161 

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.