File: ijs.h

package info (click to toggle)
ghostscript 8.71~dfsg2-9+squeeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 79,896 kB
  • ctags: 80,654
  • sloc: ansic: 501,432; sh: 25,689; python: 4,853; cpp: 3,633; perl: 3,597; tcl: 1,480; makefile: 1,187; lisp: 407; asm: 284; xml: 263; awk: 66; csh: 17; yacc: 15
file content (124 lines) | stat: -rw-r--r-- 3,198 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/**
 * Copyright (C) 2001-2004 Artifex Software, Inc.
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy,
 * modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
**/

/* This file contains common data types for IJS */

/* IJS_VERSION is decimal version number times 100 */
#define IJS_VERSION 35

typedef int ijs_bool;

#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif

typedef enum {
  IJS_CMD_ACK,
  IJS_CMD_NAK,
  IJS_CMD_PING,
  IJS_CMD_PONG,
  IJS_CMD_OPEN,
  IJS_CMD_CLOSE,
  IJS_CMD_BEGIN_JOB,
  IJS_CMD_END_JOB,
  IJS_CMD_CANCEL_JOB,
  IJS_CMD_QUERY_STATUS,
  IJS_CMD_LIST_PARAMS,
  IJS_CMD_ENUM_PARAM,
  IJS_CMD_SET_PARAM,
  IJS_CMD_GET_PARAM,
  IJS_CMD_BEGIN_PAGE,
  IJS_CMD_SEND_DATA_BLOCK,
  IJS_CMD_END_PAGE,
  IJS_CMD_EXIT
} IjsCommand;

typedef int IjsJobId;

#define IJS_EIO            -2  /* I/O error */
#define IJS_EPROTO         -3  /* protocol error */
#define IJS_ERANGE         -4  /* out of range */
#define IJS_EINTERNAL      -5  /* internal error */
#define IJS_ENYI           -6  /* not yet implemented */
#define IJS_ESYNTAX        -7  /* syntax error */
#define IJS_ECOLORSPACE    -8  /* unknown color space */
#define IJS_EUNKPARAM      -9  /* unknown parameter */
#define IJS_EJOBID        -10  /* job id doesn't match */
#define IJS_ETOOMANYJOBS  -11  /* reached limit of server's #jobs */
#define IJS_EBUF          -12  /* buffer isn't big enough */

#define IJS_HELO_STR "IJS\n\252v1\n"
#define IJS_RESP_STR "IJS\n\253v1\n"

typedef struct {
  int fd;
  char buf[4096];
  int buf_size;
} IjsSendChan;

typedef struct {
  int fd;
  char buf[4096];
  int buf_size;
  int buf_idx;
} IjsRecvChan;

void
ijs_send_init (IjsSendChan *ch, int fd);

int
ijs_send_int (IjsSendChan *ch, int val);

int
ijs_send_begin (IjsSendChan *ch, IjsCommand cmd);

int
ijs_send_block (IjsSendChan *ch, const char *buf, int len);

int
ijs_send_buf (IjsSendChan *ch);

int
ijs_get_int (const char *p);

void
ijs_recv_init (IjsRecvChan *ch, int fd);

int
ijs_recv_read (IjsRecvChan *ch, char *buf, int size);

int
ijs_recv_buf (IjsRecvChan *ch);

int
ijs_recv_ack (IjsRecvChan *ch);

int
ijs_recv_int (IjsRecvChan *ch, int *val);

int
ijs_recv_block (IjsRecvChan *ch, char *buf, int buf_size);