OSDN Git Service

* change writting.
[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 device_table;
41
42 struct device_table_t {
43   struct device_table_t* next;
44   const char*            device_id;
45   const char*            device_name;
46   spec_type              html_spec_type;
47   int                    width;
48   int                    heigh;
49   /*--------------------------------------------------------------------------*/
50   /* Walll Paper Size                                                         */
51   /*--------------------------------------------------------------------------*/
52   int                    wp_width;
53   int                    wp_heigh;
54   /*--------------------------------------------------------------------------*/
55   /* Cache Size                                                               */
56   /*--------------------------------------------------------------------------*/
57   int                    cache;
58   /*--------------------------------------------------------------------------*/
59   /* Correspondence image format                                              */
60   /* 1: It is possible to display it.                                         */
61   /* 0: It is not possible to display it.                                     */
62   /*--------------------------------------------------------------------------*/
63   int                    available_gif;
64   int                    available_jpeg;
65   int                    available_png;
66   int available_bmp2;
67   int available_bmp4;
68   /*--------------------------------------------------------------------------*/
69   /* Resolution                                                               */
70   /*--------------------------------------------------------------------------*/
71   int dpi_width;
72   int dpi_heigh;
73   /*--------------------------------------------------------------------------*/
74   /* Color number type                                                        */
75   /* 2       : 2        Colors                                                */
76   /* 4       : 4        Colors                                                */
77   /* 256     : 256      Colors                                                */
78   /* 4096    : 4096     Colors                                                */
79   /* 65536   : 65536    Colors                                                */
80   /* 262144  : 262144   Colors                                                */
81   /* 15680000: 15680000 over colors                                           */
82   /*--------------------------------------------------------------------------*/
83   int color;
84   char* emoji_type;
85 };
86
87 typedef struct device_table_list_t  device_table_list;
88
89 struct device_table_list_t {
90   struct device_table_list_t* next;
91
92   char*         pattern;
93   ap_regex_t*   regexp;
94   device_table* table;
95   device_table* tail;
96 };
97
98 typedef struct converter_t converter_t;
99
100 struct converter_t {
101   /* convert routine */
102   char* (*converter)(request_rec*               r,
103                     struct _device_table_t*     spec,
104                     const char*                 src, 
105                     apr_size_t                  srclen, 
106                     apr_size_t*                 dstlen,
107                     struct _chxjconvrule_entry* entryp,
108                     cookie_t*                   cookie);
109
110   char* (*encoder)(request_rec* r,
111                    const char*  src,
112                    apr_size_t*  len);
113 };
114
115 extern converter_t convert_routine[];
116
117 device_table* chxj_specified_device(request_rec* r, const char* user_agent);
118
119 #endif