1 /* TN5250 - An implementation of the 5250 telnet protocol.
2  * Copyright (C) 1997-2008 Michael Madore
3  *
4  * This file is part of TN5250.
5  *
6  * TN5250 is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1, or (at your option)
9  * any later version.
10  *
11  * TN5250 is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this software; see the file COPYING.  If not, write to
18  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19  * Boston, MA 02111-1307 USA
20  *
21  */
22 #ifndef PRINTSESSION_H
23 #define PRINTSESSION_H
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 /****s* lib5250/Tn5250PrintSession
30  * NAME
31  *    Tn5250PrintSession
32  * SYNOPSIS
33  *    Tn5250PrintSession *ps = tn5250_print_session_new ();
34  *    tn5250_print_session_set_stream(ps,stream);
35  *    tn5250_print_session_set_output_command(ps,"scs2ascii | lpr");
36  *    tn5250_print_session_main_loop(ps);
37  *    tn5250_print_session_destroy(ps);
38  * DESCRIPTION
39  *    Manages a 5250e printer session and parses the data records.
40  *****/
41 struct _Tn5250PrintSession {
42    Tn5250Stream /*@null@*/ /*@owned@*/ *stream;
43    Tn5250Record /*@owned@*/ *rec;
44    int conn_fd;
45    FILE /*@null@*/ *printfile;
46    Tn5250CharMap *map;
47    char /*@null@*/ *output_cmd;
48    void *script_slot;
49 };
50 
51 typedef struct _Tn5250PrintSession Tn5250PrintSession;
52 
53 extern Tn5250PrintSession /*@only@*/ /*@null@*/ *tn5250_print_session_new();
54 extern void tn5250_print_session_destroy(Tn5250PrintSession /*@only@*/ * This);
55 extern void tn5250_print_session_set_fd(Tn5250PrintSession * This, SOCKET_TYPE fd);
56 extern int tn5250_print_session_get_response_code(Tn5250PrintSession * This, char /*@out@*/ *code);
57 extern void tn5250_print_session_set_stream(Tn5250PrintSession * This, Tn5250Stream /*@owned@*/ * s);
58 extern void tn5250_print_session_set_output_command(Tn5250PrintSession * This, const char *output_cmd);
59 extern void tn5250_print_session_set_char_map(Tn5250PrintSession * This, const char *map);
60 extern void tn5250_print_session_main_loop(Tn5250PrintSession * This);
61 
62 #define tn5250_print_session_stream(This) ((This)->stream)
63 
64 #ifdef __cplusplus
65 }
66 
67 #endif
68 #endif				/* PRINTSESSION_H */
69 
70 /* vi:set cindent sts=3 sw=3: */
71