OSDN Git Service

fc19aa4cb4c4136588350ac1a5b4b6214cfd1a9d
[modchxj/mod_chxj.git] / include / chxj_specified_device.h
1 /*
2  * Copyright (C) 2005 QSDN,Inc. All rights reserved.
3  * Copyright (C) 2005 Atsushi Konno All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef __CHXJ_SPECIFIED_DEVICE_H__
18 #define __CHXJ_SPECIFIED_DEVICE_H__
19
20 typedef enum {
21   CHXJ_SPEC_UNKNOWN=0,
22   CHXJ_SPEC_Chtml_1_0,
23   CHXJ_SPEC_Chtml_2_0,
24   CHXJ_SPEC_Chtml_3_0,
25   CHXJ_SPEC_Chtml_4_0,
26   CHXJ_SPEC_Chtml_5_0,
27   CHXJ_SPEC_XHtml_Mobile_1_0,
28   CHXJ_SPEC_Hdml,
29   CHXJ_SPEC_Jhtml,
30   CHXJ_SPEC_HTML,
31 } spec_type;
32
33 #define CHXJ_PIC_OK                (0x01)
34 #define CHXJ_PIC_NG                (0x00)
35
36 #include "mod_chxj.h"
37 #include "chxj_cookie.h"
38
39
40 typedef struct _device_table_t {
41   struct _device_table_t* next;
42   const char* device_id;
43   const char* device_name;
44   spec_type html_spec_type;
45   int width;
46   int heigh;
47   /*--------------------------------------------------------------------------*/
48   /* Walll Paper Size                                                         */
49   /*--------------------------------------------------------------------------*/
50   int wp_width;
51   int wp_heigh;
52   /*--------------------------------------------------------------------------*/
53   /* Cache Size                                                               */
54   /*--------------------------------------------------------------------------*/
55   int cache;
56   /*--------------------------------------------------------------------------*/
57   /* Correspondence image format                                              */
58   /* 1: It is possible to display it.                                         */
59   /* 0: It is not possible to display it.                                     */
60   /*--------------------------------------------------------------------------*/
61   int available_gif;
62   int available_jpeg;
63   int available_png;
64   int available_bmp2;
65   int available_bmp4;
66   /*--------------------------------------------------------------------------*/
67   /* Resolution                                                               */
68   /*--------------------------------------------------------------------------*/
69   int dpi_width;
70   int dpi_heigh;
71   /*--------------------------------------------------------------------------*/
72   /* Color number type                                                        */
73   /* 2       : 2        Colors                                                */
74   /* 4       : 4        Colors                                                */
75   /* 256     : 256      Colors                                                */
76   /* 4096    : 4096     Colors                                                */
77   /* 65536   : 65536    Colors                                                */
78   /* 262144  : 262144   Colors                                                */
79   /* 15680000: 15680000 over colors                                           */
80   /*--------------------------------------------------------------------------*/
81   int color;
82   char* emoji_type;
83
84
85 } device_table;
86
87 typedef struct _device_table_list_t {
88   struct _device_table_list_t* next;
89   char* pattern;
90   ap_regex_t* regexp;
91   device_table* table;
92   device_table* tail;
93 } device_table_list;
94
95 typedef struct converter_t converter_t;
96
97 struct converter_t {
98   /* convert routine */
99   char* (*converter)(request_rec*               r,
100                     struct _device_table_t*     spec,
101                     const char*                 src, 
102                     apr_size_t                  srclen, 
103                     apr_size_t*                 dstlen,
104                     struct _chxjconvrule_entry* entryp,
105                     cookie_t*                   cookie);
106
107   char* (*encoder)(request_rec* r,
108                    const char*  src,
109                    apr_size_t*  len);
110 };
111
112 extern converter_t convert_routine[];
113
114 device_table* chxj_specified_device(request_rec* r, const char* user_agent);
115
116 #endif