1 /*
2  *   cddbp - CDDB1 Protocol
3  *
4  *   Copyright (C) 1993-2004  Ti Kan
5  *   E-mail: xmcd@amb.org
6  *
7  *   This program is free software; you can redistribute it and/or modify
8  *   it under the terms of the GNU General Public License as published by
9  *   the Free Software Foundation; either version 2 of the License, or
10  *   (at your option) any later version.
11  *
12  *   This program is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with this program; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  *
21  */
22 #ifndef __CDDBP_H__
23 #define __CDDBP_H__
24 
25 #ifndef lint
26 static char *_cddbp_h_ident_ = "@(#)cddbp.h	1.6 03/12/12";
27 #endif
28 
29 
30 /*
31  * Server response code (three-digit code)
32  *
33  * First digit (general-status):
34  * 1xx	Informative message
35  * 2xx	Command OK
36  * 3xx	Command OK so far, continue
37  * 4xx	Command OK, but cannot be performed for some specified reasons
38  * 5xx	Command unimplemented, incorrect, or program error
39  * 6xx	Client-specific internal status
40  *
41  * Second digit (sub-status):
42  * x0x     Ready for further commands
43  * x1x     More server-to-client output follows (until terminating marker)
44  * x2x     More client-to-server input follows (until terminating marker)
45  * x3x     Connection will close
46  *
47  * Third digit:
48  * xx[0-9] Command-specific code
49  */
50 
51 
52 /*
53  * Definitions for the first digit
54  */
55 #define STAT_GEN_INFO		'1'	/* Informative message */
56 #define STAT_GEN_OK		'2'	/* Command OK */
57 #define STAT_GEN_OKCONT		'3'	/* Command OK so far, continue */
58 #define STAT_GEN_OKFAIL		'4'	/* Command OK, but cannot be performed
59 					 * for some specified reasons
60 					 */
61 #define STAT_GEN_ERROR		'5'	/* Command unimplemented, incorrect,
62 					 * or program error
63 					 */
64 #define STAT_GEN_CLIENT		'6'	/* Client internal status codes */
65 
66 /*
67  * Definitions for the second digit
68  */
69 #define STAT_SUB_READY		'0'	/* Ready for further commands */
70 #define STAT_SUB_OUTPUT		'1'	/* More server-to-client output
71 					 * follows (until terminating marker)
72 					 */
73 #define STAT_SUB_INPUT		'2'	/* More client-to-server input follows
74 					 * (until terminating marker)
75 					 */
76 #define STAT_SUB_CLOSE		'3'	/* Connection will close */
77 
78 /*
79  * Definitions for the third digit
80  */
81 
82 /* Sign on banner */
83 #define STAT_BANR_RDWR		'0'	/* OK, read/write allowed */
84 #define STAT_BANR_RDONLY	'1'	/* OK, read only */
85 #define STAT_BANR_PERM		'2'	/* No connection: permission denied */
86 #define STAT_BANR_USERS		'3'	/* No connection: too many users */
87 #define STAT_BANR_LOAD		'4'	/* No connection: load too high */
88 
89 /* Set proto level */
90 #define STAT_PROTO_OK		'0'	/* OK, display curr and max levels */
91 #define STAT_PROTO_SET		'1'	/* OK, set to specified level */
92 #define STAT_PROTO_ERR		'1'	/* Illegal level specified */
93 #define STAT_PROTO_NOCHG	'2'	/* Already at specified level */
94 
95 /* Hello handshake */
96 #define STAT_HELO_OK		'0'	/* Handshake successful */
97 #define STAT_HELO_FAIL		'1'	/* Handshake failed */
98 
99 /* Query */
100 #define STAT_QURY_EXACT		'0'	/* Found exact match */
101 #define STAT_QURY_INEXACT	'1'	/* Found inexact match */
102 #define STAT_QURY_NONE		'2'	/* No match found */
103 #define STAT_QURY_AUTHFAIL	'3'	/* Proxy authorization failure */
104 
105 /* Read */
106 #define STAT_READ_OK		'0'	/* OK, CDDB data follows (until
107 					 * terminating marker)
108 					 */
109 #define STAT_READ_FAIL		'1'	/* Specified CDDB entry not found */
110 
111 /* Write: pre-data */
112 #define STAT_WRIT_OK		'0'	/* OK, CDDB data follows (until
113 					 * terminating marker)
114 					 */
115 #define STAT_WRIT_PERM		'1'	/* Permission denied */
116 #define STAT_WRIT_FSFULL	'2'	/* Server file system full */
117 
118 /* Write: post-data */
119 #define STAT_WRIT_ACCEPT	'0'	/* CDDB entry accepted */
120 #define STAT_WRIT_REJECT	'1'	/* CDDB entry rejected */
121 
122 /* Help */
123 #define STAT_HELP_OK		'0'	/* OK, help info follows (until
124 					 * terminating marker)
125 					 */
126 #define STAT_HELP_FAIL		'1'	/* No help information available */
127 
128 /* Quit */
129 #define STAT_QUIT_OK		'0'	/* OK, closing connection */
130 
131 
132 #define CDDBP_CMDLEN		2048	/* Command buffer length */
133 
134 #endif	/* __CDDBP_H__ */
135 
136