~ubuntu-branches/ubuntu/warty/ncbi-tools6/warty

« back to all changes in this revision

Viewing changes to ctools/asn_connection.h

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2002-04-04 22:13:09 UTC
  • Revision ID: james.westby@ubuntu.com-20020404221309-vfze028rfnlrldct
Tags: upstream-6.1.20011220a
ImportĀ upstreamĀ versionĀ 6.1.20011220a

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef NCBI_ASN_CONNECTION__H
 
2
#define NCBI_ASN_CONNECTION__H
 
3
 
 
4
/*  $Id: asn_connection.h,v 1.4 2001/12/02 21:17:28 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 ANS streams on top of CONN (connection).
 
33
 *
 
34
 * --------------------------------------------------------------------------
 
35
 * $Log: asn_connection.h,v $
 
36
 * Revision 1.4  2001/12/02 21:17:28  lavr
 
37
 * Fix in comment
 
38
 *
 
39
 * Revision 1.3  2001/09/24 20:32:34  lavr
 
40
 * +SSERVICE_Extra* parameter in CreateAsnConn_ServiceEx()
 
41
 *
 
42
 * Revision 1.2  2001/06/28 23:01:53  vakatov
 
43
 * Typo fixed (self-#include)
 
44
 *
 
45
 * Revision 1.1  2001/06/28 21:59:24  lavr
 
46
 * Initial revision
 
47
 *
 
48
 * ==========================================================================
 
49
 */
 
50
 
 
51
#include <connect/ncbi_connection.h>
 
52
#include <asn.h>
 
53
 
 
54
 
 
55
#ifdef __cplusplus
 
56
extern "C" {
 
57
#endif
 
58
 
 
59
 
 
60
typedef enum {
 
61
    eAsnConn_Input,
 
62
    eAsnConn_Output
 
63
} EAsnConn_Direction;
 
64
 
 
65
 
 
66
typedef enum {
 
67
    eAsnConn_Binary,
 
68
    eAsnConn_Text
 
69
} EAsnConn_Format;
 
70
 
 
71
 
 
72
/* Build ASN stream on top of CONN (connection) handle.
 
73
 * According to arguments, the stream is created
 
74
 * either for reading or writing, and is capable to handle
 
75
 * either binary or text ASN.
 
76
 * Return ASN stream pointer on success, or 0 on error.
 
77
 * NOTE: Returned stream is valid while the underlying conn exists. After call
 
78
 *       to CONN_Close() the stream becomes invalid, and should not be used.
 
79
 */
 
80
AsnIoPtr CreateAsnConn
 
81
(CONN               conn,
 
82
 EAsnConn_Direction direction,
 
83
 EAsnConn_Format    fmt
 
84
 );
 
85
 
 
86
 
 
87
/* Create service connection using provided service name,
 
88
 * type and connection parameters, info (use default connection
 
89
 * parameters if info is passed NULL).
 
90
 * Create two ASN streams based on the connection -- one stream is for
 
91
 * input and one is for output. Return pointers to the streams 
 
92
 * via 'input' and 'output' arguments.
 
93
 * No corresponding stream is created if pointer is passed NULL.
 
94
 * On success, return created CONN handle; otherwise, return 0.
 
95
 * NOTE: Returned ASN stream pointers are valid as long as connection
 
96
 *       handle exists, that is after the connection handle is passed to
 
97
 *       CONN_Close(), both pointers become invalid, and should not be used.
 
98
 */
 
99
CONN CreateAsnConn_ServiceEx
 
100
(const char*           service,
 
101
 EAsnConn_Format       input_fmt,
 
102
 AsnIoPtr*             input,
 
103
 EAsnConn_Format       output_fmt,
 
104
 AsnIoPtr*             output,
 
105
 TSERV_Type            type,
 
106
 const SConnNetInfo*   net_info,
 
107
 const SSERVICE_Extra* params
 
108
 );
 
109
 
 
110
 
 
111
/* Equivalent of CreateAsnConn_ServiceEx with zeroes in last three arguments.
 
112
 */
 
113
CONN CreateAsnConn_Service
 
114
(const char*     service,
 
115
 EAsnConn_Format input_fmt,
 
116
 AsnIoPtr*       input,
 
117
 EAsnConn_Format output_fmt,
 
118
 AsnIoPtr*       output
 
119
 );
 
120
 
 
121
 
 
122
#ifdef __cplusplus
 
123
}  /* extern "C" */
 
124
#endif
 
125
 
 
126
#endif /* NCBI_ASN_CONNECTION__H */