OSDN Git Service

*Add new feature Additional device data from TSV file conf) ChxjAddDeviceDataTSV...
[modchxj/mod_chxj.git] / include / chxj_specified_device.h
1 /*
2  * Copyright (C) 2005-2009 Atsushi Konno All rights reserved.
3  * Copyright (C) 2005 QSDN,Inc. 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_Chtml_6_0, /* use XHTML */
28   CHXJ_SPEC_Chtml_7_0, /* use XHTML */
29   CHXJ_SPEC_XHtml_Mobile_1_0,
30   CHXJ_SPEC_Hdml,
31   CHXJ_SPEC_Jhtml,
32   CHXJ_SPEC_Jxhtml,    /* use XHTML */
33   CHXJ_SPEC_HTML,
34 } spec_type;
35
36 #define CHXJ_PIC_OK                (0x01)
37 #define CHXJ_PIC_NG                (0x00)
38
39 #include "mod_chxj.h"
40 #include "chxj_cookie.h"
41
42
43 typedef struct device_table_t device_table;
44
45 struct device_table_t {
46   struct device_table_t* next;
47   int                    provider;              /* DOCOMO|AU|SOFTBANK|UNKNOWN */
48   const char*            device_id;
49   const char*            device_name;
50   spec_type              html_spec_type;
51   int                    width;
52   int                    heigh;
53   /*--------------------------------------------------------------------------*/
54   /* Walll Paper Size                                                         */
55   /*--------------------------------------------------------------------------*/
56   int                    wp_width;
57   int                    wp_heigh;
58   /*--------------------------------------------------------------------------*/
59   /* Cache Size                                                               */
60   /*--------------------------------------------------------------------------*/
61   int                    cache;
62   /*--------------------------------------------------------------------------*/
63   /* Correspondence image format                                              */
64   /* 1: It is possible to display it.                                         */
65   /* 0: It is not possible to display it.                                     */
66   /*--------------------------------------------------------------------------*/
67   int                    available_gif;
68   int                    available_jpeg;
69   int                    available_png;
70   int                    available_bmp2;
71   int                    available_bmp4;
72   /*--------------------------------------------------------------------------*/
73   /* Resolution                                                               */
74   /*--------------------------------------------------------------------------*/
75   int                    dpi_width;
76   int                    dpi_heigh;
77   /*--------------------------------------------------------------------------*/
78   /* Color number type                                                        */
79   /* 2       : 2        Colors                                                */
80   /* 4       : 4        Colors                                                */
81   /* 256     : 256      Colors                                                */
82   /* 4096    : 4096     Colors                                                */
83   /* 65536   : 65536    Colors                                                */
84   /* 262144  : 262144   Colors                                                */
85   /* 15680000: 15680000 over colors                                           */
86   /*--------------------------------------------------------------------------*/
87   int                    color;
88   char*                  emoji_type;
89 };
90
91 typedef struct device_table_list_t  device_table_list;
92
93 struct device_table_list_t {
94   struct device_table_list_t  *next;
95
96   char                        *pattern;
97   ap_regex_t                  *regexp;
98   device_table                *table;
99   device_table                *tail;
100 };
101
102 typedef struct converter_t converter_t;
103
104 struct converter_t {
105   /* convert routine */
106   char *(*converter)(request_rec                 *r,
107                      struct device_table_t       *spec,
108                      const char                  *src, 
109                      apr_size_t                  srclen, 
110                      apr_size_t                  *dstlen,
111                      struct chxjconvrule_entry   *entryp,
112                      cookie_t                    *cookie);
113
114   char *(*encoder)(request_rec  *r,
115                    const char   *src,
116                    apr_size_t   *len);
117
118
119   char *(*emoji_only_converter)(
120                    request_rec           *r,
121                    struct device_table_t *spec,
122                    const char            *src,
123                    apr_size_t            len);
124 };
125
126 extern converter_t convert_routine[];
127
128 extern device_table* chxj_specified_device(
129   request_rec             *r, 
130   const char              *user_agent);
131
132 extern device_table* chxj_specified_device_from_xml(
133   request_rec             *r,
134   const char              *user_agent);
135
136 extern device_table* chxj_specified_device_from_tsv(
137     request_rec           *r,
138     device_table          *spec,
139     const char            *user_agent);
140
141 #endif