blob: 5f7ac3dc6e2e56372540b5cf6626c8af0719c54e [file] [log] [blame]
Willy Tarreaucff64112008-11-03 06:26:53 +01001/*
2 * Functions managing stream_interface structures
3 *
Willy Tarreauf873d752012-05-11 17:47:17 +02004 * Copyright 2000-2012 Willy Tarreau <w@1wt.eu>
Willy Tarreaucff64112008-11-03 06:26:53 +01005 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 */
12
13#include <errno.h>
14#include <fcntl.h>
15#include <stdio.h>
16#include <stdlib.h>
17
18#include <sys/socket.h>
19#include <sys/stat.h>
20#include <sys/types.h>
21
22#include <common/compat.h>
23#include <common/config.h>
24#include <common/debug.h>
25#include <common/standard.h>
26#include <common/ticks.h>
27#include <common/time.h>
28
29#include <proto/buffers.h>
Willy Tarreaucff64112008-11-03 06:26:53 +010030#include <proto/fd.h>
Willy Tarreauc63190d2012-05-11 14:23:52 +020031#include <proto/sock_raw.h>
Willy Tarreau269358d2009-09-20 20:14:49 +020032#include <proto/stream_interface.h>
Willy Tarreaucff64112008-11-03 06:26:53 +010033#include <proto/task.h>
34
Willy Tarreauf873d752012-05-11 17:47:17 +020035/* socket functions used when running a stream interface as a task */
36static void stream_int_update(struct stream_interface *si);
37static void stream_int_update_embedded(struct stream_interface *si);
38static void stream_int_shutr(struct stream_interface *si);
39static void stream_int_shutw(struct stream_interface *si);
40static void stream_int_chk_rcv(struct stream_interface *si);
41static void stream_int_chk_snd(struct stream_interface *si);
42
Willy Tarreau5c979a92012-05-07 17:15:39 +020043/* socket operations for embedded tasks */
44struct sock_ops stream_int_embedded = {
45 .update = stream_int_update_embedded,
46 .shutr = stream_int_shutr,
47 .shutw = stream_int_shutw,
48 .chk_rcv = stream_int_chk_rcv,
49 .chk_snd = stream_int_chk_snd,
50 .read = NULL,
51 .write = NULL,
Willy Tarreau24208272012-05-21 17:28:50 +020052 .close = NULL,
Willy Tarreau5c979a92012-05-07 17:15:39 +020053};
54
55/* socket operations for external tasks */
56struct sock_ops stream_int_task = {
57 .update = stream_int_update,
58 .shutr = stream_int_shutr,
59 .shutw = stream_int_shutw,
60 .chk_rcv = stream_int_chk_rcv,
61 .chk_snd = stream_int_chk_snd,
62 .read = NULL,
63 .write = NULL,
Willy Tarreau24208272012-05-21 17:28:50 +020064 .close = NULL,
Willy Tarreau5c979a92012-05-07 17:15:39 +020065};
66
Willy Tarreaucff64112008-11-03 06:26:53 +010067/*
68 * This function only has to be called once after a wakeup event in case of
69 * suspected timeout. It controls the stream interface timeouts and sets
70 * si->flags accordingly. It does NOT close anything, as this timeout may
71 * be used for any purpose. It returns 1 if the timeout fired, otherwise
72 * zero.
73 */
74int stream_int_check_timeouts(struct stream_interface *si)
75{
76 if (tick_is_expired(si->exp, now_ms)) {
77 si->flags |= SI_FL_EXP;
78 return 1;
79 }
80 return 0;
81}
82
Willy Tarreaufe3718a2008-11-30 18:14:12 +010083/* to be called only when in SI_ST_DIS with SI_FL_ERR */
Willy Tarreaucff64112008-11-03 06:26:53 +010084void stream_int_report_error(struct stream_interface *si)
85{
86 if (!si->err_type)
87 si->err_type = SI_ET_DATA_ERR;
88
Willy Tarreaucff64112008-11-03 06:26:53 +010089 si->ob->flags |= BF_WRITE_ERROR;
Willy Tarreaucff64112008-11-03 06:26:53 +010090 si->ib->flags |= BF_READ_ERROR;
91}
92
93/*
Willy Tarreaudded32d2008-11-30 19:48:07 +010094 * Returns a message to the client ; the connection is shut down for read,
95 * and the request is cleared so that no server connection can be initiated.
96 * The buffer is marked for read shutdown on the other side to protect the
97 * message, and the buffer write is enabled. The message is contained in a
Willy Tarreau148d0992010-01-10 10:21:21 +010098 * "chunk". If it is null, then an empty message is used. The reply buffer does
99 * not need to be empty before this, and its contents will not be overwritten.
100 * The primary goal of this function is to return error messages to a client.
Willy Tarreaudded32d2008-11-30 19:48:07 +0100101 */
102void stream_int_retnclose(struct stream_interface *si, const struct chunk *msg)
103{
Willy Tarreau148d0992010-01-10 10:21:21 +0100104 buffer_auto_read(si->ib);
Willy Tarreaudded32d2008-11-30 19:48:07 +0100105 buffer_abort(si->ib);
Willy Tarreau148d0992010-01-10 10:21:21 +0100106 buffer_auto_close(si->ib);
107 buffer_erase(si->ib);
Willy Tarreau798e1282010-12-12 13:06:00 +0100108
Willy Tarreau9dab5fc2012-05-07 11:56:55 +0200109 bi_erase(si->ob);
Willy Tarreau148d0992010-01-10 10:21:21 +0100110 if (likely(msg && msg->len))
Willy Tarreau9dab5fc2012-05-07 11:56:55 +0200111 bo_inject(si->ob, msg->str, msg->len);
Willy Tarreaudded32d2008-11-30 19:48:07 +0100112
113 si->ob->wex = tick_add_ifset(now_ms, si->ob->wto);
Willy Tarreau148d0992010-01-10 10:21:21 +0100114 buffer_auto_read(si->ob);
Willy Tarreau520d95e2009-09-19 21:04:57 +0200115 buffer_auto_close(si->ob);
Willy Tarreau5d881d02009-12-27 22:51:06 +0100116 buffer_shutr_now(si->ob);
Willy Tarreau5d881d02009-12-27 22:51:06 +0100117}
118
Willy Tarreaufb90d942009-09-05 20:57:35 +0200119/* default update function for scheduled tasks, not used for embedded tasks */
Willy Tarreauf873d752012-05-11 17:47:17 +0200120static void stream_int_update(struct stream_interface *si)
Willy Tarreaufb90d942009-09-05 20:57:35 +0200121{
122 DPRINTF(stderr, "%s: si=%p, si->state=%d ib->flags=%08x ob->flags=%08x\n",
123 __FUNCTION__,
124 si, si->state, si->ib->flags, si->ob->flags);
125
126 if (!(si->flags & SI_FL_DONT_WAKE) && si->owner)
127 task_wakeup(si->owner, TASK_WOKEN_IO);
128}
129
130/* default update function for embedded tasks, to be used at the end of the i/o handler */
Willy Tarreauf873d752012-05-11 17:47:17 +0200131static void stream_int_update_embedded(struct stream_interface *si)
Willy Tarreaufb90d942009-09-05 20:57:35 +0200132{
Willy Tarreau3488e252010-08-09 16:24:56 +0200133 int old_flags = si->flags;
134
Willy Tarreaufb90d942009-09-05 20:57:35 +0200135 DPRINTF(stderr, "%s: si=%p, si->state=%d ib->flags=%08x ob->flags=%08x\n",
136 __FUNCTION__,
137 si, si->state, si->ib->flags, si->ob->flags);
138
139 if (si->state != SI_ST_EST)
140 return;
141
142 if ((si->ob->flags & (BF_OUT_EMPTY|BF_SHUTW|BF_HIJACK|BF_SHUTW_NOW)) == (BF_OUT_EMPTY|BF_SHUTW_NOW))
Willy Tarreau73b013b2012-05-21 16:31:45 +0200143 si_shutw(si);
Willy Tarreaufb90d942009-09-05 20:57:35 +0200144
145 if ((si->ob->flags & (BF_FULL|BF_SHUTW|BF_SHUTW_NOW|BF_HIJACK)) == 0)
146 si->flags |= SI_FL_WAIT_DATA;
147
Willy Tarreau96fd4b52009-10-04 17:18:35 +0200148 /* we're almost sure that we need some space if the buffer is not
149 * empty, even if it's not full, because the applets can't fill it.
150 */
Willy Tarreauf1ba4b32009-10-17 14:37:52 +0200151 if ((si->ib->flags & (BF_SHUTR|BF_OUT_EMPTY|BF_DONT_READ)) == 0)
Willy Tarreaufb90d942009-09-05 20:57:35 +0200152 si->flags |= SI_FL_WAIT_ROOM;
153
Willy Tarreauf27b5ea2009-10-03 22:01:18 +0200154 if (si->ob->flags & BF_WRITE_ACTIVITY) {
Willy Tarreaufb90d942009-09-05 20:57:35 +0200155 if (tick_isset(si->ob->wex))
156 si->ob->wex = tick_add_ifset(now_ms, si->ob->wto);
157 }
158
Willy Tarreauf27b5ea2009-10-03 22:01:18 +0200159 if (si->ib->flags & BF_READ_ACTIVITY ||
160 (si->ob->flags & BF_WRITE_ACTIVITY && !(si->flags & SI_FL_INDEP_STR))) {
161 if (tick_isset(si->ib->rex))
162 si->ib->rex = tick_add_ifset(now_ms, si->ib->rto);
163 }
164
Willy Tarreau3488e252010-08-09 16:24:56 +0200165 /* save flags to detect changes */
166 old_flags = si->flags;
Willy Tarreauf1ba4b32009-10-17 14:37:52 +0200167 if (likely((si->ob->flags & (BF_SHUTW|BF_WRITE_PARTIAL|BF_FULL|BF_DONT_READ)) == BF_WRITE_PARTIAL &&
Willy Tarreau96fd4b52009-10-04 17:18:35 +0200168 (si->ob->prod->flags & SI_FL_WAIT_ROOM)))
Willy Tarreau73b013b2012-05-21 16:31:45 +0200169 si_chk_rcv(si->ob->prod);
Willy Tarreaufb90d942009-09-05 20:57:35 +0200170
Willy Tarreau96fd4b52009-10-04 17:18:35 +0200171 if (((si->ib->flags & (BF_READ_PARTIAL|BF_OUT_EMPTY)) == BF_READ_PARTIAL) &&
Willy Tarreau3488e252010-08-09 16:24:56 +0200172 (si->ib->cons->flags & SI_FL_WAIT_DATA)) {
Willy Tarreau73b013b2012-05-21 16:31:45 +0200173 si_chk_snd(si->ib->cons);
Willy Tarreau3488e252010-08-09 16:24:56 +0200174 /* check if the consumer has freed some space */
175 if (!(si->ib->flags & BF_FULL))
176 si->flags &= ~SI_FL_WAIT_ROOM;
177 }
Willy Tarreaufb90d942009-09-05 20:57:35 +0200178
179 /* Note that we're trying to wake up in two conditions here :
180 * - special event, which needs the holder task attention
181 * - status indicating that the applet can go on working. This
182 * is rather hard because we might be blocking on output and
183 * don't want to wake up on input and vice-versa. The idea is
Willy Tarreau3488e252010-08-09 16:24:56 +0200184 * to only rely on the changes the chk_* might have performed.
Willy Tarreaufb90d942009-09-05 20:57:35 +0200185 */
186 if (/* check stream interface changes */
Willy Tarreau3488e252010-08-09 16:24:56 +0200187 ((old_flags & ~si->flags) & (SI_FL_WAIT_ROOM|SI_FL_WAIT_DATA)) ||
188
189 /* changes on the production side */
190 (si->ib->flags & (BF_READ_NULL|BF_READ_ERROR)) ||
191 si->state != SI_ST_EST ||
192 (si->flags & SI_FL_ERR) ||
193 ((si->ib->flags & BF_READ_PARTIAL) &&
194 (!si->ib->to_forward || si->ib->cons->state != SI_ST_EST)) ||
195
196 /* changes on the consumption side */
197 (si->ob->flags & (BF_WRITE_NULL|BF_WRITE_ERROR)) ||
198 ((si->ob->flags & BF_WRITE_ACTIVITY) &&
199 ((si->ob->flags & BF_SHUTW) ||
200 si->ob->prod->state != SI_ST_EST ||
201 ((si->ob->flags & BF_OUT_EMPTY) && !si->ob->to_forward)))) {
Willy Tarreaufb90d942009-09-05 20:57:35 +0200202 if (!(si->flags & SI_FL_DONT_WAKE) && si->owner)
203 task_wakeup(si->owner, TASK_WOKEN_IO);
204 }
Willy Tarreau3488e252010-08-09 16:24:56 +0200205 if (si->ib->flags & BF_READ_ACTIVITY)
206 si->ib->flags &= ~BF_READ_DONTWAIT;
Willy Tarreaufb90d942009-09-05 20:57:35 +0200207}
208
209/* default shutr function for scheduled tasks */
Willy Tarreauf873d752012-05-11 17:47:17 +0200210static void stream_int_shutr(struct stream_interface *si)
Willy Tarreaufb90d942009-09-05 20:57:35 +0200211{
212 DPRINTF(stderr, "%s: si=%p, si->state=%d ib->flags=%08x ob->flags=%08x\n",
213 __FUNCTION__,
214 si, si->state, si->ib->flags, si->ob->flags);
215
216 si->ib->flags &= ~BF_SHUTR_NOW;
217 if (si->ib->flags & BF_SHUTR)
218 return;
219 si->ib->flags |= BF_SHUTR;
220 si->ib->rex = TICK_ETERNITY;
221 si->flags &= ~SI_FL_WAIT_ROOM;
222
223 if (si->state != SI_ST_EST && si->state != SI_ST_CON)
224 return;
225
226 if (si->ob->flags & BF_SHUTW) {
227 si->state = SI_ST_DIS;
228 si->exp = TICK_ETERNITY;
Willy Tarreaufb90d942009-09-05 20:57:35 +0200229
Willy Tarreau4da69a92012-05-21 18:05:40 +0200230 si_data_close(si);
Willy Tarreaud8ccffe2010-09-07 16:16:50 +0200231 if (si->release)
232 si->release(si);
233 }
Willy Tarreau0bd05ea2010-07-02 11:18:03 +0200234
Willy Tarreaufb90d942009-09-05 20:57:35 +0200235 /* note that if the task exist, it must unregister itself once it runs */
236 if (!(si->flags & SI_FL_DONT_WAKE) && si->owner)
237 task_wakeup(si->owner, TASK_WOKEN_IO);
238}
239
240/* default shutw function for scheduled tasks */
Willy Tarreauf873d752012-05-11 17:47:17 +0200241static void stream_int_shutw(struct stream_interface *si)
Willy Tarreaufb90d942009-09-05 20:57:35 +0200242{
243 DPRINTF(stderr, "%s: si=%p, si->state=%d ib->flags=%08x ob->flags=%08x\n",
244 __FUNCTION__,
245 si, si->state, si->ib->flags, si->ob->flags);
246
247 si->ob->flags &= ~BF_SHUTW_NOW;
248 if (si->ob->flags & BF_SHUTW)
249 return;
250 si->ob->flags |= BF_SHUTW;
251 si->ob->wex = TICK_ETERNITY;
252 si->flags &= ~SI_FL_WAIT_DATA;
253
254 switch (si->state) {
255 case SI_ST_EST:
Willy Tarreauf1ba4b32009-10-17 14:37:52 +0200256 if (!(si->ib->flags & (BF_SHUTR|BF_DONT_READ)))
Willy Tarreaufb90d942009-09-05 20:57:35 +0200257 break;
258
259 /* fall through */
260 case SI_ST_CON:
261 case SI_ST_CER:
Willy Tarreau32d3ee92010-12-29 14:03:02 +0100262 case SI_ST_QUE:
263 case SI_ST_TAR:
Willy Tarreaufb90d942009-09-05 20:57:35 +0200264 si->state = SI_ST_DIS;
265 /* fall through */
Willy Tarreaud8ccffe2010-09-07 16:16:50 +0200266
Willy Tarreau4da69a92012-05-21 18:05:40 +0200267 si_data_close(si);
Willy Tarreaud8ccffe2010-09-07 16:16:50 +0200268 if (si->release)
269 si->release(si);
Willy Tarreaufb90d942009-09-05 20:57:35 +0200270 default:
271 si->flags &= ~SI_FL_WAIT_ROOM;
272 si->ib->flags |= BF_SHUTR;
273 si->ib->rex = TICK_ETERNITY;
274 si->exp = TICK_ETERNITY;
275 }
276
277 /* note that if the task exist, it must unregister itself once it runs */
278 if (!(si->flags & SI_FL_DONT_WAKE) && si->owner)
279 task_wakeup(si->owner, TASK_WOKEN_IO);
280}
281
282/* default chk_rcv function for scheduled tasks */
Willy Tarreauf873d752012-05-11 17:47:17 +0200283static void stream_int_chk_rcv(struct stream_interface *si)
Willy Tarreaufb90d942009-09-05 20:57:35 +0200284{
285 struct buffer *ib = si->ib;
286
287 DPRINTF(stderr, "%s: si=%p, si->state=%d ib->flags=%08x ob->flags=%08x\n",
288 __FUNCTION__,
289 si, si->state, si->ib->flags, si->ob->flags);
290
291 if (unlikely(si->state != SI_ST_EST || (ib->flags & BF_SHUTR)))
292 return;
293
Willy Tarreauf1ba4b32009-10-17 14:37:52 +0200294 if (ib->flags & (BF_FULL|BF_HIJACK|BF_DONT_READ)) {
Willy Tarreaufb90d942009-09-05 20:57:35 +0200295 /* stop reading */
Willy Tarreauf1ba4b32009-10-17 14:37:52 +0200296 if ((ib->flags & (BF_FULL|BF_HIJACK|BF_DONT_READ)) == BF_FULL)
Willy Tarreaufb90d942009-09-05 20:57:35 +0200297 si->flags |= SI_FL_WAIT_ROOM;
298 }
299 else {
300 /* (re)start reading */
301 si->flags &= ~SI_FL_WAIT_ROOM;
302 if (!(si->flags & SI_FL_DONT_WAKE) && si->owner)
303 task_wakeup(si->owner, TASK_WOKEN_IO);
304 }
305}
306
307/* default chk_snd function for scheduled tasks */
Willy Tarreauf873d752012-05-11 17:47:17 +0200308static void stream_int_chk_snd(struct stream_interface *si)
Willy Tarreaufb90d942009-09-05 20:57:35 +0200309{
310 struct buffer *ob = si->ob;
311
312 DPRINTF(stderr, "%s: si=%p, si->state=%d ib->flags=%08x ob->flags=%08x\n",
313 __FUNCTION__,
314 si, si->state, si->ib->flags, si->ob->flags);
315
316 if (unlikely(si->state != SI_ST_EST || (si->ob->flags & BF_SHUTW)))
317 return;
318
319 if (!(si->flags & SI_FL_WAIT_DATA) || /* not waiting for data */
320 (ob->flags & BF_OUT_EMPTY)) /* called with nothing to send ! */
321 return;
322
323 /* Otherwise there are remaining data to be sent in the buffer,
324 * so we tell the handler.
325 */
326 si->flags &= ~SI_FL_WAIT_DATA;
327 if (!tick_isset(ob->wex))
328 ob->wex = tick_add_ifset(now_ms, ob->wto);
329
330 if (!(si->flags & SI_FL_DONT_WAKE) && si->owner)
331 task_wakeup(si->owner, TASK_WOKEN_IO);
332}
333
Willy Tarreaub24281b2011-02-13 13:16:36 +0100334/* Register an applet to handle a stream_interface as part of the stream
Willy Tarreaufb90d942009-09-05 20:57:35 +0200335 * interface's owner task, which is returned. The SI will wake it up everytime
Willy Tarreaub24281b2011-02-13 13:16:36 +0100336 * it is solicited. The task's processing function must call the applet's
Willy Tarreaufb90d942009-09-05 20:57:35 +0200337 * function before returning. It must be deleted by the task handler using
Willy Tarreaub24281b2011-02-13 13:16:36 +0100338 * stream_int_unregister_handler(), possibly from within the function itself.
Willy Tarreaufa6bac62012-05-31 14:16:59 +0200339 * It also pre-initializes applet.state to zero and the connection context
340 * to NULL.
Willy Tarreaufb90d942009-09-05 20:57:35 +0200341 */
Willy Tarreaub24281b2011-02-13 13:16:36 +0100342struct task *stream_int_register_handler(struct stream_interface *si, struct si_applet *app)
Willy Tarreaufb90d942009-09-05 20:57:35 +0200343{
Simon Horman7abd00d2011-08-13 08:03:51 +0900344 DPRINTF(stderr, "registering handler %p for si %p (was %p)\n", app, si, si->owner);
Willy Tarreaufb90d942009-09-05 20:57:35 +0200345
Willy Tarreau5c979a92012-05-07 17:15:39 +0200346 stream_interface_prepare(si, &stream_int_embedded);
Willy Tarreau73b013b2012-05-21 16:31:45 +0200347 si->conn.ctrl = NULL;
Willy Tarreau9e000c62011-03-10 14:03:36 +0100348 set_target_applet(&si->target, app);
Aman Gupta9a13e842012-04-02 18:57:53 -0700349 si->release = app->release;
Willy Tarreaufb90d942009-09-05 20:57:35 +0200350 si->flags |= SI_FL_WAIT_DATA;
351 return si->owner;
352}
353
354/* Register a function to handle a stream_interface as a standalone task. The
355 * new task itself is returned and is assigned as si->owner. The stream_interface
356 * pointer will be pointed to by the task's context. The handler can be detached
357 * by using stream_int_unregister_handler().
Willy Tarreau7c0a1512011-03-10 11:17:02 +0100358 * FIXME: the code should be updated to ensure that we don't change si->owner
359 * anymore as this is not needed. However, process_session still relies on it.
Willy Tarreaufb90d942009-09-05 20:57:35 +0200360 */
361struct task *stream_int_register_handler_task(struct stream_interface *si,
362 struct task *(*fct)(struct task *))
363{
364 struct task *t;
365
366 DPRINTF(stderr, "registering handler %p for si %p (was %p)\n", fct, si, si->owner);
367
Willy Tarreau5c979a92012-05-07 17:15:39 +0200368 stream_interface_prepare(si, &stream_int_task);
Willy Tarreau73b013b2012-05-21 16:31:45 +0200369 si->conn.ctrl = NULL;
Willy Tarreau9e000c62011-03-10 14:03:36 +0100370 clear_target(&si->target);
Willy Tarreau0bd05ea2010-07-02 11:18:03 +0200371 si->release = NULL;
Willy Tarreaufb90d942009-09-05 20:57:35 +0200372 si->flags |= SI_FL_WAIT_DATA;
373
374 t = task_new();
375 si->owner = t;
376 if (!t)
377 return t;
Willy Tarreau7c0a1512011-03-10 11:17:02 +0100378
Willy Tarreau9e000c62011-03-10 14:03:36 +0100379 set_target_task(&si->target, t);
Willy Tarreau7c0a1512011-03-10 11:17:02 +0100380
Willy Tarreaufb90d942009-09-05 20:57:35 +0200381 t->process = fct;
382 t->context = si;
383 task_wakeup(si->owner, TASK_WOKEN_INIT);
384
385 return t;
386}
387
388/* Unregister a stream interface handler. This must be called by the handler task
389 * itself when it detects that it is in the SI_ST_DIS state. This function can
390 * both detach standalone handlers and embedded handlers.
391 */
392void stream_int_unregister_handler(struct stream_interface *si)
393{
Willy Tarreau7c0a1512011-03-10 11:17:02 +0100394 if (si->target.type == TARG_TYPE_TASK) {
Willy Tarreaufb90d942009-09-05 20:57:35 +0200395 /* external handler : kill the task */
Willy Tarreau7c0a1512011-03-10 11:17:02 +0100396 task_delete(si->target.ptr.t);
397 task_free(si->target.ptr.t);
Willy Tarreaufb90d942009-09-05 20:57:35 +0200398 }
Willy Tarreau0bd05ea2010-07-02 11:18:03 +0200399 si->release = NULL;
Willy Tarreaufb90d942009-09-05 20:57:35 +0200400 si->owner = NULL;
Willy Tarreau9e000c62011-03-10 14:03:36 +0100401 clear_target(&si->target);
Willy Tarreaufb90d942009-09-05 20:57:35 +0200402}
403
Willy Tarreaudded32d2008-11-30 19:48:07 +0100404/*
Willy Tarreaucff64112008-11-03 06:26:53 +0100405 * Local variables:
406 * c-indent-level: 8
407 * c-basic-offset: 8
408 * End:
409 */