]> git.sesse.net Git - mlt/blob - src/miracle/miracle_connection.h
Some fixes for alpha masks
[mlt] / src / miracle / miracle_connection.h
1 /*
2  * miracle_connection.h -- DV Connection Handler
3  * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
4  * Author: Charles Yates <charles.yates@pandora.be>
5  *
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.
10  *
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.
15  *
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.
19  */
20
21 #ifndef _DV_CONNECTION_H_
22 #define _DV_CONNECTION_H_
23
24 #include <sys/types.h>
25 #include <sys/socket.h>
26 #include <netinet/in.h>
27
28 #include <valerie/valerie_parser.h>
29 #include <valerie/valerie_tokeniser.h>
30
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35
36 /** Connection structure
37 */
38
39 typedef struct 
40 {
41         mlt_properties owner;
42         int fd;
43         struct sockaddr_in sin;
44         valerie_parser parser;
45
46 connection_t;
47
48 /** Enumeration for responses.
49 */
50
51 typedef enum 
52 {
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,
63         RESPONSE_ERROR = 500
64
65 response_codes;
66
67 /* the following struct is passed as the single argument 
68    to all command callback functions */
69
70 typedef struct 
71 {
72         valerie_parser    parser;
73         valerie_response  response;
74         valerie_tokeniser tokeniser;
75         char         *command;
76         int           unit;
77         void         *argument;
78         char         *root_dir;
79
80 command_argument_t, *command_argument;
81
82 /* A handler is defined as follows. */
83 typedef int (*command_handler_t) ( command_argument );
84
85
86 extern void *parser_thread( void *arg );
87
88 #ifdef __cplusplus
89 }
90 #endif
91
92 #endif