2 * miracle_connection.h -- DV Connection Handler
3 * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
4 * Author: Charles Yates <charles.yates@pandora.be>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program 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 General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #ifndef _DV_CONNECTION_H_
22 #define _DV_CONNECTION_H_
24 #include <sys/types.h>
25 #include <sys/socket.h>
26 #include <netinet/in.h>
28 #include <valerie/valerie_parser.h>
29 #include <valerie/valerie_tokeniser.h>
36 /** Connection structure
43 struct sockaddr_in sin
;
44 valerie_parser parser
;
48 /** Enumeration for responses.
53 RESPONSE_SUCCESS
= 200,
54 RESPONSE_SUCCESS_N
= 201,
55 RESPONSE_SUCCESS_1
= 202,
56 RESPONSE_UNKNOWN_COMMAND
= 400,
57 RESPONSE_TIMEOUT
= 401,
58 RESPONSE_MISSING_ARG
= 402,
59 RESPONSE_INVALID_UNIT
= 403,
60 RESPONSE_BAD_FILE
= 404,
61 RESPONSE_OUT_OF_RANGE
= 405,
62 RESPONSE_TOO_MANY_FILES
= 406,
67 /* the following struct is passed as the single argument
68 to all command callback functions */
72 valerie_parser parser
;
73 valerie_response response
;
74 valerie_tokeniser tokeniser
;
80 command_argument_t
, *command_argument
;
82 /* A handler is defined as follows. */
83 typedef int (*command_handler_t
) ( command_argument
);
86 extern void *parser_thread( void *arg
);