test_packet_resize.c revision 244e8c6f
1/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc.  See LICENSE. */
2/* Test packet resizing */
3
4#include <assert.h>
5#include <errno.h>
6#include <inttypes.h>
7#include <stddef.h>
8#include <stdlib.h>
9#include <string.h>
10#include <sys/queue.h>
11#ifndef WIN32
12#include <unistd.h>
13#else
14#include "getopt.h"
15#endif
16
17#define LSQUIC_TEST 1
18#include "lsquic.h"
19#include "lsquic_types.h"
20#include "lsquic_int_types.h"
21#include "lsquic_packet_common.h"
22#include "lsquic_packet_in.h"
23#include "lsquic_packet_out.h"
24#include "lsquic_packet_resize.h"
25#include "lsquic_parse.h"
26#include "lsquic_hash.h"
27#include "lsquic_conn.h"
28#include "lsquic_mm.h"
29#include "lsquic_enc_sess.h"
30#include "lsquic_sfcw.h"
31#include "lsquic_varint.h"
32#include "lsquic_hq.h"
33#include "lsquic_stream.h"
34#include "lsquic_engine_public.h"
35
36#include "lsquic_logger.h"
37
38#define N_STREAMS 4
39
40#define MIN(a, b) ((a) < (b) ? (a) : (b))
41
42static const char *s_data[N_STREAMS];
43static size_t      s_data_sz[N_STREAMS];
44
45
46struct test_spec
47{
48    int                     lineno;
49    int                     expect_error;
50    unsigned                versions;
51    const char             *desc;
52    const char             *prog;
53};
54
55/* Here we rely on the fact that QUIC_FRAME_STREAM is 1 and other valid frames
56 * are in a contiguous range.
57 */
58#define letter_2_frame_type(letter_) ((int) ((letter_) - 'a') + QUIC_FRAME_ACK)
59#define frame_type_2_letter(frame_type_) ('a' + ((frame_type_) - QUIC_FRAME_ACK))
60
61
62/* DSL specification:
63 *
64 * P\d+         Set maximum packet size
65 * N            Create new packet, append to input queue, and set as current
66 * S\d+-\d+f?   The first number is stream ID; these values must be in
67 *                range [0, 3].  The second number is the maximum number of
68 *                bytes to read from stream, potentially filling the current
69 *                packet.  If `f' is set, set FIN flag.
70 * C\d+-\d+     Like 'S' above, but CRYPTO frame.  Note that there is no 'f'
71 *                flag as CRYPTO frames have no FINs.
72 * c\d+-\d+     RST_STREAM frame.  It's different from frames [abd-z] in that
73 *                n_unacked is changed.
74 * V            Verify contents of packets, both STREAM and non-STREAM frames.
75 * R            Resize packets
76 * L\d          Label, valid values in range [0, 9]
77 * J\d[=<>]\d+  Jump to label if packet size is valid [1200, 65527]
78 * I\d+         Increase packet size
79 * D\d+         Decrease packet size
80 * [abd-z]\d+   Frame of type [a-z] of some bytes.  See letter_2_frame_type()
81 *                to see how the mapping works.
82 * F\d+         Standalone FIN frame.
83 */
84
85
86static struct test_spec test_specs[] =
87{
88    {
89        .lineno = __LINE__,
90        .desc = "split one packet with single STREAM frame into two",
91        .prog = "P2000;N;a7;S0-2000;V;P1500;R;V;",
92    },
93    {
94        .lineno = __LINE__,
95        .desc = "split one 6000-byte packet with single STREAM frame into many, looping",
96        .prog = "P6000;N;S0-6000;V;L0;D100;R;V;J0>1200;L1;I29;R;V;J1<7000;",
97    },
98    {
99        .lineno = __LINE__,
100        .desc = "split three 1500-byte packets with several STREAM frames from different streams",
101        .prog = "P1500;"
102                "N;p20;S0-200;S1-300;S2-200;h18;S3-20f;t2;S2-2000;"
103                "N;c0-30;j11;S2-2000;"
104                "N;S2-2000;"
105                "V;"
106                "L0;D1;R;V;J0>1200;"
107                ,
108    },
109    {
110        .lineno = __LINE__,
111        .desc = "one packet, STREAM frame and and empty STREAM FIN frame, split down by 1",
112        .prog = "P2000;N;S0-1900;F0;V;L0;D1;R;V;J0>1200;",
113    },
114    {
115        .lineno = __LINE__,
116        .desc = "one packet, STREAM frame and and empty STREAM FIN frame, split down by 31",
117        .prog = "P2000;N;S0-1900;F0;V;L0;D31;R;V;J0>1200;",
118    },
119    {
120        .lineno = __LINE__,
121        .desc = "one packet, STREAM frame with a FIN, split down by 1",
122        .prog = "P2000;N;S0-1900f;V;L0;D1;R;V;J0>1200;",
123    },
124    {
125        .lineno = __LINE__,
126        .desc = "one packet, STREAM frame with a FIN, split down by 31",
127        .prog = "P2000;N;S0-1900f;V;L0;D31;R;V;J0>1200;",
128    },
129    {
130        .lineno = __LINE__,
131        .desc = "one packet, frame too large",
132        .prog = "P2000;N;m1500;V;P1000;R;",
133        .expect_error = 1,
134    },
135    {
136        .lineno = __LINE__,
137        .desc = "split one packet with single CRYPTO frame into two",
138        .prog = "P1252;N;C0-2000;V;P1200;R;V;",
139        .versions = LSQUIC_IETF_VERSIONS,
140    },
141};
142
143
144struct stream_read_cursor
145{
146    const char         *data;       /* Points to data that is used as circular buffer */
147    unsigned            data_sz;    /* Size of data pointed to by data */
148    unsigned            off;        /* Current offset */
149    unsigned            nread;      /* Total number of bytes consumed from stream (packetized) */
150    int                 fin;        /* FIN is set, see fin_off */
151    unsigned            fin_off;    /* Value of final offset */
152};
153
154
155struct test_ctx
156{
157    TAILQ_HEAD(, lsquic_packet_out)     packets[2];     /* We move them from one queue to the other */
158    int                                 cur_input;      /* 0 or 1, indexes packets */
159    unsigned                            n_non_stream_frames;
160    struct stream_read_cursor           stream_cursors[N_STREAMS];
161    struct lsquic_stream                streams[N_STREAMS];
162    struct lsquic_engine_public         enpub;
163    struct lsquic_conn                  lconn;
164    struct network_path                 path;
165};
166
167
168static void
169init_test_ctx (struct test_ctx *ctx, const struct test_spec *spec,
170                                                enum lsquic_version version)
171{
172    unsigned i;
173
174    memset(ctx, 0, sizeof(*ctx));
175    TAILQ_INIT(&ctx->packets[0]);
176    TAILQ_INIT(&ctx->packets[1]);
177    for (i = 0; i < N_STREAMS; ++i)
178    {
179        ctx->stream_cursors[i].data = s_data[i];
180        ctx->stream_cursors[i].data_sz = s_data_sz[i];
181    }
182    lsquic_mm_init(&ctx->enpub.enp_mm);
183    ctx->lconn.cn_flags |= LSCONN_HANDSHAKE_DONE;   /* For short packet headers */
184    ctx->lconn.cn_pf = select_pf_by_ver(version);
185    ctx->lconn.cn_esf_c = select_esf_common_by_ver(version);
186    LSCONN_INITIALIZE(&ctx->lconn);
187    ctx->lconn.cn_cces_buf[0].cce_cid.len = sizeof(spec->lineno);
188    memcpy(ctx->lconn.cn_cces_buf[0].cce_cid.idbuf, &spec->lineno, sizeof(spec->lineno));
189}
190
191
192static void
193cleanup_test_ctx (struct test_ctx *ctx)
194{
195    struct lsquic_packet_out *packet_out;
196    unsigned i;
197
198    for (i = 0; i < 2; ++i)
199        while (packet_out = TAILQ_FIRST(&ctx->packets[i]), packet_out != NULL)
200        {
201            TAILQ_REMOVE(&ctx->packets[i], packet_out, po_next);
202            lsquic_packet_out_destroy(packet_out, &ctx->enpub, NULL);
203        }
204    lsquic_mm_cleanup(&ctx->enpub.enp_mm);
205}
206
207
208static struct lsquic_packet_out *
209new_packet (struct test_ctx *ctx)
210{
211    struct lsquic_packet_out *packet_out;
212    static lsquic_packno_t packno;  /* Each packet gets unique packet number
213                                     * to make them easier to track.
214                                     */
215
216    packet_out = lsquic_packet_out_new(&ctx->enpub.enp_mm, ctx->enpub.enp_mm.malo.packet_out, 1,
217                         &ctx->lconn, PACKNO_BITS_0, 0, NULL, &ctx->path);
218    if (packet_out)
219        packet_out->po_packno = packno++;
220
221    return packet_out;
222}
223
224
225static struct lsquic_packet_out *
226new_input_packet (struct test_ctx *ctx)
227{
228    struct lsquic_packet_out *packet_out;
229
230    packet_out = new_packet(ctx);
231    if (packet_out)
232        TAILQ_INSERT_TAIL(&ctx->packets[ctx->cur_input], packet_out, po_next);
233
234    return packet_out;
235}
236
237
238struct my_read_ctx {
239    struct stream_read_cursor *cursor;
240    /* XXX Turns out, gQUIC and IETF QUIC STREAM frame generators differ in
241     * what they pass to the read() function.  The former does not limit
242     * itself to pf_gen_stream_frame()'s `size'.  Rather than change and
243     * retest gQUIC code, put a limiter in this unit test file instead.
244     */
245    size_t                     max;
246    int                        fin;
247};
248
249
250static size_t
251my_gsf_read (void *stream, void *buf, size_t len, int *fin)
252{
253    struct my_read_ctx *const mctx = stream;
254    struct stream_read_cursor *const cursor = mctx->cursor;
255    unsigned char *p = buf, *end;
256    size_t n;
257
258    if (len > mctx->max)
259        len = mctx->max;
260
261    end = p + len;
262
263    while (p < end)
264    {
265        n = MIN(end - p, cursor->data_sz - cursor->off);
266        memcpy(p, cursor->data + cursor->off, n);
267        cursor->off += n;
268        if (cursor->off == cursor->data_sz)
269            cursor->off = 0;
270        cursor->nread += n;
271        p += n;
272    }
273
274    if (mctx->fin)
275    {
276        cursor->fin = 1;
277        cursor->fin_off = cursor->nread;
278        LSQ_DEBUG("set FIN at offset %u", cursor->fin_off);
279    }
280
281    *fin = mctx->fin;
282    return len;
283}
284
285
286static void
287make_stream_frame (struct test_ctx *ctx, struct lsquic_packet_out *packet_out,
288                enum quic_frame_type frame_type, lsquic_stream_id_t stream_id,
289                size_t nbytes, int fin)
290{
291    struct my_read_ctx mctx = { &ctx->stream_cursors[stream_id], nbytes, fin, };
292    int w;
293
294    assert(!ctx->stream_cursors[stream_id].fin);
295
296    if (nbytes == 0 && fin)
297    {
298        ctx->stream_cursors[stream_id].fin = 1;
299        ctx->stream_cursors[stream_id].fin_off
300                                        = ctx->stream_cursors[stream_id].nread;
301        LSQ_DEBUG("set FIN at offset %u", ctx->stream_cursors[stream_id].fin_off);
302    }
303
304    w = (&ctx->lconn.cn_pf->pf_gen_stream_frame)
305        [frame_type == QUIC_FRAME_CRYPTO](
306                    packet_out->po_data + packet_out->po_data_sz,
307                    lsquic_packet_out_avail(packet_out),
308                    stream_id, ctx->stream_cursors[stream_id].nread,
309                    nbytes == 0 && fin, nbytes, my_gsf_read, &mctx);
310    assert(w > 0);
311    LSQ_DEBUG("wrote %s frame of %d bytes", frame_type_2_str[frame_type], w);
312    lsquic_packet_out_add_stream(packet_out, &ctx->enpub.enp_mm,
313                &ctx->streams[stream_id], frame_type,
314                packet_out->po_data_sz, w);
315    packet_out->po_data_sz += w;
316    packet_out->po_frame_types |= 1 << frame_type;
317    if (0 == lsquic_packet_out_avail(packet_out))
318        packet_out->po_flags |= PO_STREAM_END;
319}
320
321
322static void
323make_non_stream_frame (struct test_ctx *ctx,
324        struct lsquic_packet_out *packet_out, enum quic_frame_type frame_type,
325        size_t nbytes)
326{
327    static unsigned char fill_byte;
328
329    /* We don't truncate non-STREAM frames because we don't chop them up */
330    assert(nbytes <= lsquic_packet_out_avail(packet_out));
331
332    memset(packet_out->po_data + packet_out->po_data_sz, fill_byte, nbytes);
333    lsquic_packet_out_add_frame(packet_out, &ctx->enpub.enp_mm,
334                fill_byte, frame_type, packet_out->po_data_sz, nbytes);
335    packet_out->po_data_sz += nbytes;
336    packet_out->po_frame_types |= 1 << frame_type;
337    if ((1 << frame_type) & GQUIC_FRAME_REGEN_MASK)
338        packet_out->po_regen_sz += nbytes;
339    LSQ_DEBUG("wrote %s frame of %zd bytes", frame_type_2_str[frame_type],
340                                                                    nbytes);
341    ++fill_byte;
342    ++ctx->n_non_stream_frames;
343}
344
345
346static void
347make_rst_stream_frame (struct test_ctx *ctx,
348        struct lsquic_packet_out *packet_out, lsquic_stream_id_t stream_id,
349        size_t nbytes)
350{
351    int s;
352
353    /* We don't truncate non-STREAM frames because we don't chop them up */
354    assert(nbytes <= lsquic_packet_out_avail(packet_out));
355
356    memset(packet_out->po_data + packet_out->po_data_sz, 'R', nbytes);
357    s = lsquic_packet_out_add_stream(packet_out, &ctx->enpub.enp_mm,
358                &ctx->streams[stream_id], QUIC_FRAME_RST_STREAM,
359                packet_out->po_data_sz, nbytes);
360    assert(s == 0);
361    packet_out->po_data_sz += nbytes;
362    packet_out->po_frame_types |= 1 << QUIC_FRAME_RST_STREAM;
363    LSQ_DEBUG("wrote %s frame of %zd bytes",
364                    frame_type_2_str[QUIC_FRAME_RST_STREAM], nbytes);
365    ++ctx->n_non_stream_frames;
366}
367
368
369/* STREAM frame ordering assumptions, with or without FINs, are specific to
370 * this unit test.  These assumptions do not have to hold in real code.
371 * The assumptions are made in order to verify the operation of the "packet
372 * resize" module.
373 */
374static void
375verify_stream_contents (struct test_ctx *ctx, lsquic_stream_id_t stream_id)
376{
377    char *data;
378    size_t len;
379    int dummy_fin = -1, parsed_len, seen_fin;
380    struct lsquic_packet_out *packet_out;
381    struct stream_read_cursor cursor;
382    struct my_read_ctx mctx;
383    struct stream_frame stream_frame;
384    struct packet_out_frec_iter pofi;
385    struct frame_rec *frec;
386    unsigned off, frec_count;
387
388    LSQ_DEBUG("verifying stream #%"PRIu64, stream_id);
389    data = malloc(ctx->stream_cursors[stream_id].nread);
390    assert(data);
391    /* Copy cursor to re-read from the beginning and not affect real cursor */
392    cursor = ctx->stream_cursors[stream_id];
393    cursor.off = 0;
394    mctx = (struct my_read_ctx) { &cursor, ctx->stream_cursors[stream_id].nread, 0, };
395    len = my_gsf_read(&mctx, data, ctx->stream_cursors[stream_id].nread, &dummy_fin);
396    assert(len == ctx->stream_cursors[stream_id].nread);
397    assert(dummy_fin == 0);   /* Self-check */
398
399    /* Go packet by packet, and within each packet, frame by frame, and
400     * compare STREAM frame contents.
401     */
402    off = 0;
403    seen_fin = 0;
404    frec_count = 0;
405    TAILQ_FOREACH(packet_out, &ctx->packets[ctx->cur_input], po_next)
406    {
407        LSQ_DEBUG("examining packet #%"PRIu64, packet_out->po_packno);
408        assert(packet_out->po_data_sz <= packet_out->po_n_alloc);
409        assert(packet_out->po_data_sz <= ctx->path.np_pack_size);
410        for (frec = lsquic_pofi_first(&pofi, packet_out); frec;
411                                            frec = lsquic_pofi_next(&pofi))
412        {
413            if (!(((1 << frec->fe_frame_type) & (QUIC_FTBIT_STREAM|QUIC_FTBIT_CRYPTO|QUIC_FTBIT_RST_STREAM))
414                    && frec->fe_stream == &ctx->streams[stream_id]))
415                continue;
416            assert(!seen_fin);
417            ++frec_count;
418            if (frec->fe_frame_type == QUIC_FRAME_RST_STREAM)
419                continue;
420            parsed_len = (&ctx->lconn.cn_pf->pf_parse_stream_frame)
421                [frec->fe_frame_type == QUIC_FRAME_CRYPTO]
422                (packet_out->po_data + frec->fe_off, frec->fe_len, &stream_frame);
423            assert(parsed_len > 0);
424            assert(parsed_len == frec->fe_len);
425            LSQ_DEBUG("verify stream %"PRIu64", contents %hu bytes",
426                stream_id, stream_frame.data_frame.df_size);
427            assert(stream_frame.data_frame.df_offset == off);
428            assert(stream_frame.data_frame.df_size <= len - off);
429            assert(0 == memcmp(stream_frame.data_frame.df_data, data + off,
430                                            stream_frame.data_frame.df_size));
431            off += stream_frame.data_frame.df_size;
432            if (stream_frame.data_frame.df_fin)
433            {
434                assert(ctx->stream_cursors[stream_id].fin);
435                assert(ctx->stream_cursors[stream_id].fin_off == off);
436                seen_fin = 1;
437            }
438            if (frec->fe_off + frec->fe_len == packet_out->po_n_alloc)
439                assert(packet_out->po_flags & PO_STREAM_END);
440            if (!(packet_out->po_flags & PO_STREAM_END))
441                assert(frec->fe_off + frec->fe_len < packet_out->po_n_alloc);
442        }
443    }
444
445    if (ctx->stream_cursors[stream_id].fin)
446        assert(seen_fin);
447    assert(frec_count == ctx->streams[stream_id].n_unacked);
448    free(data);
449}
450
451
452/* Verify that non-STREAM frames are in the same order, of the same size, and
453 * same contents.
454 */
455static void
456verify_non_stream_frames (struct test_ctx *ctx, const struct test_spec *spec)
457{
458    const char *pos;
459    int w;
460    unsigned count, regen_sz, off;
461    struct lsquic_packet_out *packet_out;
462    struct packet_out_frec_iter pofi;
463    struct frame_rec *frec;
464    unsigned char fill;
465    char frame_str[30];
466
467    LSQ_DEBUG("verifying non-STREAM frames");
468
469    /* Go packet by packet, and within each packet, frame by frame, and
470     * verify relative position of non-STREAM frames (must be in the same
471     * order as in the order they were inserted) and their contents.
472     */
473    count = 0;
474    pos = spec->prog;
475    TAILQ_FOREACH(packet_out, &ctx->packets[ctx->cur_input], po_next)
476    {
477        regen_sz = 0;
478        off = 0;
479        LSQ_DEBUG("examining packet #%"PRIu64, packet_out->po_packno);
480        assert(packet_out->po_data_sz <= packet_out->po_n_alloc);
481        assert(packet_out->po_data_sz <= ctx->path.np_pack_size);
482        for (frec = lsquic_pofi_first(&pofi, packet_out); frec;
483                                            frec = lsquic_pofi_next(&pofi))
484        {
485            if ((1 << frec->fe_frame_type) & GQUIC_FRAME_REGEN_MASK)
486            {
487                assert(regen_sz == 0 || regen_sz == off);
488                regen_sz += frec->fe_len;
489            }
490            off += frec->fe_len;
491            if ((1 << frec->fe_frame_type)
492                                    & (QUIC_FTBIT_STREAM|QUIC_FTBIT_CRYPTO))
493                continue;
494            ++count;
495            LSQ_DEBUG("checking %hu-byte %s", frec->fe_len,
496                                        frame_type_2_str[frec->fe_frame_type]);
497            if (frec->fe_frame_type == QUIC_FRAME_RST_STREAM)
498                w = snprintf(frame_str, sizeof(frame_str), "%c%u-%hu;",
499                    frame_type_2_letter(frec->fe_frame_type),
500                    (unsigned) (frec->fe_stream - ctx->streams), frec->fe_len);
501            else
502                w = snprintf(frame_str, sizeof(frame_str), "%c%hu;",
503                    frame_type_2_letter(frec->fe_frame_type), frec->fe_len);
504            pos = strstr(pos, frame_str);
505            assert(pos);
506            pos += w;
507            /* Now check contents */
508            fill = frec->fe_frame_type == QUIC_FRAME_RST_STREAM
509                 ? 'R' : (unsigned char) frec->fe_u.data;
510            for (w = 0; w < (int) frec->fe_len; ++w)
511                assert(packet_out->po_data[frec->fe_off + w] == fill);
512        }
513        assert(packet_out->po_regen_sz == regen_sz);
514        assert(packet_out->po_data_sz == off);
515    }
516
517    assert(count == ctx->n_non_stream_frames);
518}
519
520
521static void
522verify_packet_contents (struct test_ctx *ctx, const struct test_spec *spec)
523{
524    lsquic_stream_id_t stream_id;
525
526    for (stream_id = 0; stream_id < N_STREAMS; ++stream_id)
527        verify_stream_contents(ctx, stream_id);
528    verify_non_stream_frames(ctx, spec);
529}
530
531
532static struct lsquic_packet_out *
533my_pri_next_packet (void *ctxp)
534{
535    struct test_ctx *ctx = ctxp;
536    struct lsquic_packet_out *packet_out;
537
538    packet_out = TAILQ_FIRST(&ctx->packets[ctx->cur_input]);
539    if (packet_out)
540        LSQ_DEBUG("%s: return packet #%"PRIu64, __func__,
541                                                packet_out->po_packno);
542    else
543        LSQ_DEBUG("%s: out of packets", __func__);
544
545    return packet_out;
546}
547
548
549static void
550my_pri_discard_packet (void *ctxp, struct lsquic_packet_out *packet_out)
551{
552    struct test_ctx *ctx = ctxp;
553
554    LSQ_DEBUG("%s: discard packet #%"PRIu64, __func__, packet_out->po_packno);
555    TAILQ_REMOVE(&ctx->packets[ctx->cur_input], packet_out, po_next);
556    lsquic_packet_out_destroy(packet_out, &ctx->enpub, NULL);
557}
558
559
560static struct lsquic_packet_out *
561my_pri_new_packet (void *ctx)
562{
563    LSQ_DEBUG("%s: grab a new packet", __func__);
564    return new_packet(ctx);
565}
566
567
568static const struct packet_resize_if my_pr_if =
569{
570    .pri_next_packet    = my_pri_next_packet,
571    .pri_new_packet     = my_pri_new_packet,
572    .pri_discard_packet = my_pri_discard_packet,
573};
574
575
576static int
577resize_packets (struct test_ctx *ctx)
578{
579    struct packet_resize_ctx prctx;
580    struct lsquic_packet_out *new;
581
582    lsquic_packet_resize_init(&prctx, &ctx->enpub, &ctx->lconn, ctx, &my_pr_if);
583
584    while (new = lsquic_packet_resize_next(&prctx), new != NULL)
585    {
586        TAILQ_INSERT_TAIL(&ctx->packets[!ctx->cur_input], new, po_next);
587        LSQ_DEBUG("append new packet #%"PRIu64, new->po_packno);
588    }
589    ctx->cur_input = !ctx->cur_input;
590    LSQ_DEBUG("switch cur_input to %d", ctx->cur_input);
591    return lsquic_packet_resize_is_error(&prctx) ? -1 : 0;
592}
593
594
595static void
596run_test (const struct test_spec *spec, enum lsquic_version version)
597{
598    struct lsquic_packet_out *packet_out;
599    struct test_ctx ctx;
600    long stream_id, nbytes;
601    char L[4] = "L?;", op, cmd;
602    const char *pc, *addr;
603    int jump, s;
604    enum quic_frame_type frame_type;
605
606    LSQ_INFO("Running test on line %d: %s", spec->lineno, spec->desc);
607    if (spec->versions && !(spec->versions & (1 << version)))
608    {
609        LSQ_INFO("Not applicable to version %s, skip",
610                                                lsquic_ver2str[version]);
611        return;
612    }
613
614    init_test_ctx(&ctx, spec, version);
615
616    packet_out = NULL;
617    for (pc = spec->prog; *pc; ++pc)
618    {
619        cmd = *pc++;
620        switch (cmd)
621        {
622        case 'P':
623            ctx.path.np_pack_size = strtol(pc, (char **) &pc, 10);
624            LSQ_DEBUG("P: set packet size to %hu bytes", ctx.path.np_pack_size);
625            break;
626        case 'N':
627            packet_out = new_input_packet(&ctx);
628            LSQ_DEBUG("N: create new input packet");
629            break;
630        case 'S':
631        case 'C':
632            stream_id = strtol(pc, (char **) &pc, 10);
633            assert('-' == *pc);
634            assert(stream_id >= 0 && stream_id < N_STREAMS);
635            nbytes = strtol(pc + 1, (char **) &pc, 10);
636            assert(nbytes > 0);
637            LSQ_DEBUG("%c: create  frame for stream %ld of at most %ld bytes",
638                cmd, stream_id, nbytes);
639            if (cmd == 'S' && *pc == 'f')
640                ++pc;
641            make_stream_frame(&ctx, packet_out,
642                cmd == 'S' ? QUIC_FRAME_STREAM : QUIC_FRAME_CRYPTO,
643                stream_id, nbytes, pc[-1] == 'f');
644            break;
645        case 'F':
646            stream_id = strtol(pc, (char **) &pc, 10);
647            make_stream_frame(&ctx, packet_out, QUIC_FRAME_STREAM, stream_id,
648                                                                        0, 1);
649            break;
650        case 'V':
651            LSQ_DEBUG("V: verify packet contents");
652            verify_packet_contents(&ctx, spec);
653            break;
654        case 'R':
655            LSQ_DEBUG("R: resize packets");
656            s = resize_packets(&ctx);
657            if (0 != s)
658            {
659                LSQ_DEBUG("got error, expected: %d", spec->expect_error);
660                assert(spec->expect_error);
661                assert(pc[0] == ';');
662                assert(pc[1] == '\0');
663                goto end;
664            }
665            break;
666        case 'D':
667            nbytes = strtol(pc, (char **) &pc, 10);
668            ctx.path.np_pack_size -= nbytes;
669            LSQ_DEBUG("D: decrease packet size by %ld to %hu bytes",
670                                            nbytes, ctx.path.np_pack_size);
671            break;
672        case 'I':
673            nbytes = strtol(pc, (char **) &pc, 10);
674            ctx.path.np_pack_size += nbytes;
675            LSQ_DEBUG("I: increase packet size by %ld to %hu bytes",
676                                            nbytes, ctx.path.np_pack_size);
677            break;
678        case 'L':
679            assert(*pc >= '0' && *pc <= '9');
680            ++pc;
681            break;
682        case 'J':
683            assert(*pc >= '0' && *pc <= '9');
684            L[1] = *pc++;
685            addr = strstr(spec->prog, L);
686            assert(addr);
687            op = *pc++;
688            nbytes = strtol(pc, (char **) &pc, 10);
689            switch (op)
690            {
691                case '=':   jump = ctx.path.np_pack_size == nbytes; break;
692                case '<':   jump = ctx.path.np_pack_size <  nbytes; break;
693                case '>':   jump = ctx.path.np_pack_size >  nbytes; break;
694                default:    jump = 0; assert(0); break;
695            }
696            LSQ_DEBUG("J: jump if (%hu %c %ld) -> %sjumping",
697                    ctx.path.np_pack_size, op, nbytes, jump ? "" : "not ");
698            if (jump)
699                pc = addr + 2;
700            break;
701        case 'c':
702            stream_id = strtol(pc, (char **) &pc, 10);
703            assert('-' == *pc);
704            assert(stream_id >= 0 && stream_id < N_STREAMS);
705            nbytes = strtol(pc + 1, (char **) &pc, 10);
706            assert(nbytes > 0);
707            make_rst_stream_frame(&ctx, packet_out, stream_id, nbytes);
708            break;
709        case 'a': case 'b':           case 'd': case 'e': case 'f': case 'g':
710        case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
711        case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u':
712        case 'v': case 'w': case 'x': case 'y': case 'z':
713            frame_type = letter_2_frame_type(cmd);
714            nbytes = strtol(pc, (char **) &pc, 10);
715            make_non_stream_frame(&ctx, packet_out, frame_type, nbytes);
716            break;
717        default:
718            assert(0);
719            goto end;
720        }
721        assert(*pc == ';');
722    }
723
724  end:
725    cleanup_test_ctx(&ctx);
726}
727
728
729int
730main (int argc, char **argv)
731{
732    const struct test_spec *spec;
733    enum lsquic_version version;
734    int opt;
735
736    lsquic_log_to_fstream(stderr, LLTS_HHMMSSMS);
737    (void) lsquic_set_log_level("info");
738    while (opt = getopt(argc, argv, "l:L:h"), opt != -1)
739    {
740        switch (opt)
741        {
742        case 'L':
743            if (0 != lsquic_set_log_level(optarg))
744            {
745                perror("lsquic_set_log_level");
746                return 1;
747            }
748            break;
749        case 'l':
750            if (0 != lsquic_logger_lopt(optarg))
751            {
752                perror("lsquic_logger_lopt");
753                return 1;
754            }
755            break;
756        case 'h':
757            printf("usage: %s [options]\n", argv[0]);
758            return 0;
759        default:
760            return 1;
761        }
762    }
763
764    for (version = 0; version < N_LSQVER; ++version)
765    {
766        if (!((1 << version) & LSQUIC_DF_VERSIONS))
767            continue;
768        LSQ_INFO("testing version %s", lsquic_ver2str[version]);
769        for (spec = test_specs; spec < test_specs + sizeof(test_specs) / sizeof(test_specs[0]); ++spec)
770            run_test(spec, version);
771    }
772
773    return 0;
774}
775
776
777#define DATA_0 \
778"ON BEING IDLE.\n" \
779"\n" \
780"Now, this is a subject on which I flatter myself I really am _au fait_.\n" \
781"The gentleman who, when I was young, bathed me at wisdom's font for nine\n" \
782"guineas a term--no extras--used to say he never knew a boy who could\n" \
783"do less work in more time; and I remember my poor grandmother once\n" \
784"incidentally observing, in the course of an instruction upon the use\n" \
785"of the Prayer-book, that it was highly improbable that I should ever do\n" \
786"much that I ought not to do, but that she felt convinced beyond a doubt\n" \
787"that I should leave undone pretty well everything that I ought to do.\n" \
788"\n" \
789"I am afraid I have somewhat belied half the dear old lady's prophecy.\n" \
790"Heaven help me! I have done a good many things that I ought not to have\n" \
791"done, in spite of my laziness. But I have fully confirmed the accuracy\n" \
792"of her judgment so far as neglecting much that I ought not to have\n" \
793"neglected is concerned. Idling always has been my strong point. I take\n" \
794"no credit to myself in the matter--it is a gift. Few possess it. There\n" \
795"are plenty of lazy people and plenty of slow-coaches, but a genuine\n" \
796"idler is a rarity. He is not a man who slouches about with his hands in\n" \
797"his pockets. On the contrary, his most startling characteristic is that\n" \
798"he is always intensely busy.\n" \
799"\n" \
800"It is impossible to enjoy idling thoroughly unless one has plenty of\n" \
801"work to do. There is no fun in doing nothing when you have nothing to\n" \
802"do. Wasting time is merely an occupation then, and a most exhausting\n" \
803"one. Idleness, like kisses, to be sweet must be stolen.\n" \
804"\n" \
805"Many years ago, when I was a young man, I was taken very ill--I never\n" \
806"could see myself that much was the matter with me, except that I had\n" \
807"a beastly cold. But I suppose it was something very serious, for the\n" \
808"doctor said that I ought to have come to him a month before, and that\n" \
809"if it (whatever it was) had gone on for another week he would not have\n" \
810"answered for the consequences. It is an extraordinary thing, but I\n" \
811"never knew a doctor called into any case yet but what it transpired\n" \
812"that another day's delay would have rendered cure hopeless. Our medical\n" \
813"guide, philosopher, and friend is like the hero in a melodrama--he\n" \
814"always comes upon the scene just, and only just, in the nick of time. It\n" \
815"is Providence, that is what it is.\n" \
816"\n" \
817"Well, as I was saying, I was very ill and was ordered to Buxton for a\n" \
818"month, with strict injunctions to do nothing whatever all the while\n" \
819"that I was there. \"Rest is what you require,\" said the doctor, \"perfect\n" \
820"rest.\"\n" \
821"\n" \
822"It seemed a delightful prospect. \"This man evidently understands my\n" \
823"complaint,\" said I, and I pictured to myself a glorious time--a four\n" \
824"weeks' _dolce far niente_ with a dash of illness in it. Not too much\n" \
825"illness, but just illness enough--just sufficient to give it the flavor\n" \
826"of suffering and make it poetical. I should get up late, sip chocolate,\n" \
827"and have my breakfast in slippers and a dressing-gown. I should lie out\n" \
828"in the garden in a hammock and read sentimental novels with a melancholy\n" \
829"ending, until the books should fall from my listless hand, and I should\n" \
830"recline there, dreamily gazing into the deep blue of the firmament,\n" \
831"watching the fleecy clouds floating like white-sailed ships across\n" \
832"its depths, and listening to the joyous song of the birds and the low\n" \
833"rustling of the trees. Or, on becoming too weak to go out of doors,\n" \
834"I should sit propped up with pillows at the open window of the\n" \
835"ground-floor front, and look wasted and interesting, so that all the\n" \
836"pretty girls would sigh as they passed by.\n" \
837"\n" \
838"And twice a day I should go down in a Bath chair to the Colonnade to\n" \
839"drink the waters. Oh, those waters! I knew nothing about them then,\n" \
840"and was rather taken with the idea. \"Drinking the waters\" sounded\n" \
841"fashionable and Queen Anne-fied, and I thought I should like them. But,\n" \
842"ugh! after the first three or four mornings! Sam Weller's description of\n" \
843"them as \"having a taste of warm flat-irons\" conveys only a faint idea of\n" \
844"their hideous nauseousness. If anything could make a sick man get well\n" \
845"quickly, it would be the knowledge that he must drink a glassful of them\n" \
846"every day until he was recovered. I drank them neat for six consecutive\n" \
847"days, and they nearly killed me; but after then I adopted the plan of\n" \
848"taking a stiff glass of brandy-and-water immediately on the top of them,\n" \
849"and found much relief thereby. I have been informed since, by various\n" \
850"eminent medical gentlemen, that the alcohol must have entirely\n" \
851"counteracted the effects of the chalybeate properties contained in the\n" \
852"water. I am glad I was lucky enough to hit upon the right thing.\n" \
853"\n" \
854"But \"drinking the waters\" was only a small portion of the torture I\n" \
855"experienced during that memorable month--a month which was, without\n" \
856"exception, the most miserable I have ever spent. During the best part of\n" \
857"it I religiously followed the doctor's mandate and did nothing whatever,\n" \
858"except moon about the house and garden and go out for two hours a day in\n" \
859"a Bath chair. That did break the monotony to a certain extent. There is\n" \
860"more excitement about Bath-chairing--especially if you are not used to\n" \
861"the exhilarating exercise--than might appear to the casual observer. A\n" \
862"sense of danger, such as a mere outsider might not understand, is ever\n" \
863"present to the mind of the occupant. He feels convinced every minute\n" \
864"that the whole concern is going over, a conviction which becomes\n" \
865"especially lively whenever a ditch or a stretch of newly macadamized\n" \
866"road comes in sight. Every vehicle that passes he expects is going to\n" \
867"run into him; and he never finds himself ascending or descending a\n" \
868"hill without immediately beginning to speculate upon his chances,\n" \
869"supposing--as seems extremely probable--that the weak-kneed controller\n" \
870"of his destiny should let go.\n" \
871"\n" \
872"But even this diversion failed to enliven after awhile, and the _ennui_\n" \
873"became perfectly unbearable. I felt my mind giving way under it. It is\n" \
874"not a strong mind, and I thought it would be unwise to tax it too far.\n" \
875"So somewhere about the twentieth morning I got up early, had a good\n" \
876"breakfast, and walked straight off to Hayfield, at the foot of the\n" \
877"Kinder Scout--a pleasant, busy little town, reached through a lovely\n" \
878"valley, and with two sweetly pretty women in it. At least they were\n" \
879"sweetly pretty then; one passed me on the bridge and, I think, smiled;\n" \
880"and the other was standing at an open door, making an unremunerative\n" \
881"investment of kisses upon a red-faced baby. But it is years ago, and I\n" \
882"dare say they have both grown stout and snappish since that time.\n" \
883"Coming back, I saw an old man breaking stones, and it roused such strong\n" \
884"longing in me to use my arms that I offered him a drink to let me take\n" \
885"his place. He was a kindly old man and he humored me. I went for those\n" \
886"stones with the accumulated energy of three weeks, and did more work in\n" \
887"half an hour than he had done all day. But it did not make him jealous.\n" \
888"\n" \
889"Having taken the plunge, I went further and further into dissipation,\n" \
890"going out for a long walk every morning and listening to the band in\n" \
891"the pavilion every evening. But the days still passed slowly\n" \
892"notwithstanding, and I was heartily glad when the last one came and I\n" \
893"was being whirled away from gouty, consumptive Buxton to London with its\n" \
894"stern work and life. I looked out of the carriage as we rushed through\n" \
895"Hendon in the evening. The lurid glare overhanging the mighty city\n" \
896"seemed to warm my heart, and when, later on, my cab rattled out of St.\n" \
897"Pancras' station, the old familiar roar that came swelling up around me\n" \
898"sounded the sweetest music I had heard for many a long day.\n" \
899"\n" \
900"I certainly did not enjoy that month's idling. I like idling when I\n" \
901"ought not to be idling; not when it is the only thing I have to do. That\n" \
902"is my pig-headed nature. The time when I like best to stand with my\n" \
903"back to the fire, calculating how much I owe, is when my desk is heaped\n" \
904"highest with letters that must be answered by the next post. When I like\n" \
905"to dawdle longest over my dinner is when I have a heavy evening's work\n" \
906"before me. And if, for some urgent reason, I ought to be up particularly\n" \
907"early in the morning, it is then, more than at any other time, that I\n" \
908"love to lie an extra half-hour in bed.\n" \
909"\n" \
910"Ah! how delicious it is to turn over and go to sleep again: \"just for\n" \
911"five minutes.\" Is there any human being, I wonder, besides the hero of\n" \
912"a Sunday-school \"tale for boys,\" who ever gets up willingly? There\n" \
913"are some men to whom getting up at the proper time is an utter\n" \
914"impossibility. If eight o'clock happens to be the time that they should\n" \
915"turn out, then they lie till half-past. If circumstances change and\n" \
916"half-past eight becomes early enough for them, then it is nine before\n" \
917"they can rise. They are like the statesman of whom it was said that he\n" \
918"was always punctually half an hour late. They try all manner of schemes.\n" \
919"They buy alarm-clocks (artful contrivances that go off at the wrong time\n" \
920"and alarm the wrong people). They tell Sarah Jane to knock at the door\n" \
921"and call them, and Sarah Jane does knock at the door and does call them,\n" \
922"and they grunt back \"awri\" and then go comfortably to sleep again. I\n" \
923"knew one man who would actually get out and have a cold bath; and even\n" \
924"that was of no use, for afterward he would jump into bed again to warm\n" \
925"himself.\n" \
926"\n" \
927"I think myself that I could keep out of bed all right if I once got\n" \
928"out. It is the wrenching away of the head from the pillow that I find so\n" \
929"hard, and no amount of over-night determination makes it easier. I say\n" \
930"to myself, after having wasted the whole evening, \"Well, I won't do\n" \
931"any more work to-night; I'll get up early to-morrow morning;\" and I am\n" \
932"thoroughly resolved to do so--then. In the morning, however, I feel less\n" \
933"enthusiastic about the idea, and reflect that it would have been much\n" \
934"better if I had stopped up last night. And then there is the trouble of\n" \
935"dressing, and the more one thinks about that the more one wants to put\n" \
936"it off.\n" \
937"\n" \
938"It is a strange thing this bed, this mimic grave, where we stretch our\n" \
939"tired limbs and sink away so quietly into the silence and rest. \"O bed,\n" \
940"O bed, delicious bed, that heaven on earth to the weary head,\" as sang\n" \
941"poor Hood, you are a kind old nurse to us fretful boys and girls. Clever\n" \
942"and foolish, naughty and good, you take us all in your motherly lap and\n" \
943"hush our wayward crying. The strong man full of care--the sick man\n" \
944"full of pain--the little maiden sobbing for her faithless lover--like\n" \
945"children we lay our aching heads on your white bosom, and you gently\n" \
946"soothe us off to by-by.\n" \
947"\n" \
948"Our trouble is sore indeed when you turn away and will not comfort us.\n" \
949"How long the dawn seems coming when we cannot sleep! Oh! those hideous\n" \
950"nights when we toss and turn in fever and pain, when we lie, like living\n" \
951"men among the dead, staring out into the dark hours that drift so slowly\n" \
952"between us and the light. And oh! those still more hideous nights when\n" \
953"we sit by another in pain, when the low fire startles us every now and\n" \
954"then with a falling cinder, and the tick of the clock seems a hammer\n" \
955"beating out the life that we are watching.\n" \
956"\n" \
957"But enough of beds and bedrooms. I have kept to them too long, even for\n" \
958"an idle fellow. Let us come out and have a smoke. That wastes time just\n" \
959"as well and does not look so bad. Tobacco has been a blessing to us\n" \
960"idlers. What the civil-service clerk before Sir Walter's time found\n" \
961"to occupy their minds with it is hard to imagine. I attribute the\n" \
962"quarrelsome nature of the Middle Ages young men entirely to the want of\n" \
963"the soothing weed. They had no work to do and could not smoke, and\n" \
964"the consequence was they were forever fighting and rowing. If, by any\n" \
965"extraordinary chance, there was no war going, then they got up a deadly\n" \
966"family feud with the next-door neighbor, and if, in spite of this, they\n" \
967"still had a few spare moments on their hands, they occupied them with\n" \
968"discussions as to whose sweetheart was the best looking, the arguments\n" \
969"employed on both sides being battle-axes, clubs, etc. Questions of taste\n" \
970"were soon decided in those days. When a twelfth-century youth fell in\n" \
971"love he did not take three paces backward, gaze into her eyes, and tell\n" \
972"her she was too beautiful to live. He said he would step outside and see\n" \
973"about it. And if, when he got out, he met a man and broke his head--the\n" \
974"other man's head, I mean--then that proved that his--the first\n" \
975"fellow's--girl was a pretty girl. But if the other fellow broke _his_\n" \
976"head--not his own, you know, but the other fellow's--the other fellow\n" \
977"to the second fellow, that is, because of course the other fellow would\n" \
978"only be the other fellow to him, not the first fellow who--well, if he\n" \
979"broke his head, then _his_ girl--not the other fellow's, but the fellow\n" \
980"who _was_ the--Look here, if A broke B's head, then A's girl was a\n" \
981"pretty girl; but if B broke A's head, then A's girl wasn't a pretty\n" \
982"girl, but B's girl was. That was their method of conducting art\n" \
983"criticism.\n" \
984"\n" \
985"Nowadays we light a pipe and let the girls fight it out among\n" \
986"themselves.\n" \
987"\n" \
988"They do it very well. They are getting to do all our work. They are\n" \
989"doctors, and barristers, and artists. They manage theaters, and promote\n" \
990"swindles, and edit newspapers. I am looking forward to the time when we\n" \
991"men shall have nothing to do but lie in bed till twelve, read two novels\n" \
992"a day, have nice little five-o'clock teas all to ourselves, and tax\n" \
993"our brains with nothing more trying than discussions upon the latest\n" \
994"patterns in trousers and arguments as to what Mr. Jones' coat was\n" \
995"made of and whether it fitted him. It is a glorious prospect--for idle\n" \
996"fellows.\n"
997
998#define DATA_1 \
999"ON BEING IN LOVE.\n" \
1000"\n" \
1001"You've been in love, of course! If not you've got it to come. Love is\n" \
1002"like the measles; we all have to go through it. Also like the measles,\n" \
1003"we take it only once. One never need be afraid of catching it a second\n" \
1004"time. The man who has had it can go into the most dangerous places and\n" \
1005"play the most foolhardy tricks with perfect safety. He can picnic in\n" \
1006"shady woods, ramble through leafy aisles, and linger on mossy seats to\n" \
1007"watch the sunset. He fears a quiet country-house no more than he would\n" \
1008"his own club. He can join a family party to go down the Rhine. He can,\n" \
1009"to see the last of a friend, venture into the very jaws of the marriage\n" \
1010"ceremony itself. He can keep his head through the whirl of a ravishing\n" \
1011"waltz, and rest afterward in a dark conservatory, catching nothing more\n" \
1012"lasting than a cold. He can brave a moonlight walk adown sweet-scented\n" \
1013"lanes or a twilight pull among the somber rushes. He can get over a\n" \
1014"stile without danger, scramble through a tangled hedge without being\n" \
1015"caught, come down a slippery path without falling. He can look into\n" \
1016"sunny eyes and not be dazzled. He listens to the siren voices, yet sails\n" \
1017"on with unveered helm. He clasps white hands in his, but no electric\n" \
1018"\"Lulu\"-like force holds him bound in their dainty pressure.\n" \
1019"\n" \
1020"No, we never sicken with love twice. Cupid spends no second arrow on\n" \
1021"the same heart. Love's handmaids are our life-long friends. Respect, and\n" \
1022"admiration, and affection, our doors may always be left open for, but\n" \
1023"their great celestial master, in his royal progress, pays but one visit\n" \
1024"and departs. We like, we cherish, we are very, very fond of--but we\n" \
1025"never love again. A man's heart is a firework that once in its time\n" \
1026"flashes heavenward. Meteor-like, it blazes for a moment and lights\n" \
1027"with its glory the whole world beneath. Then the night of our sordid\n" \
1028"commonplace life closes in around it, and the burned-out case, falling\n" \
1029"back to earth, lies useless and uncared for, slowly smoldering into\n" \
1030"ashes. Once, breaking loose from our prison bonds, we dare, as mighty\n" \
1031"old Prometheus dared, to scale the Olympian mount and snatch from\n" \
1032"Phoebus' chariot the fire of the gods. Happy those who, hastening down\n" \
1033"again ere it dies out, can kindle their earthly altars at its flame.\n" \
1034"Love is too pure a light to burn long among the noisome gases that we\n" \
1035"breathe, but before it is choked out we may use it as a torch to ignite\n" \
1036"the cozy fire of affection.\n" \
1037"\n" \
1038"And, after all, that warming glow is more suited to our cold little back\n" \
1039"parlor of a world than is the burning spirit love. Love should be the\n" \
1040"vestal fire of some mighty temple--some vast dim fane whose organ music\n" \
1041"is the rolling of the spheres. Affection will burn cheerily when the\n" \
1042"white flame of love is flickered out. Affection is a fire that can be\n" \
1043"fed from day to day and be piled up ever higher as the wintry years draw\n" \
1044"nigh. Old men and women can sit by it with their thin hands clasped, the\n" \
1045"little children can nestle down in front, the friend and neighbor has\n" \
1046"his welcome corner by its side, and even shaggy Fido and sleek Titty can\n" \
1047"toast their noses at the bars.\n" \
1048"\n" \
1049"Let us heap the coals of kindness upon that fire. Throw on your pleasant\n" \
1050"words, your gentle pressures of the hand, your thoughtful and unselfish\n" \
1051"deeds. Fan it with good-humor, patience, and forbearance. You can let\n" \
1052"the wind blow and the rain fall unheeded then, for your hearth will be\n" \
1053"warm and bright, and the faces round it will make sunshine in spite of\n" \
1054"the clouds without.\n" \
1055"\n" \
1056"I am afraid, dear Edwin and Angelina, you expect too much from love.\n" \
1057"You think there is enough of your little hearts to feed this fierce,\n" \
1058"devouring passion for all your long lives. Ah, young folk! don't rely\n" \
1059"too much upon that unsteady flicker. It will dwindle and dwindle as the\n" \
1060"months roll on, and there is no replenishing the fuel. You will watch it\n" \
1061"die out in anger and disappointment. To each it will seem that it is the\n" \
1062"other who is growing colder. Edwin sees with bitterness that Angelina no\n" \
1063"longer runs to the gate to meet him, all smiles and blushes; and when he\n" \
1064"has a cough now she doesn't begin to cry and, putting her arms round his\n" \
1065"neck, say that she cannot live without him. The most she will probably\n" \
1066"do is to suggest a lozenge, and even that in a tone implying that it is\n" \
1067"the noise more than anything else she is anxious to get rid of.\n" \
1068"\n" \
1069"Poor little Angelina, too, sheds silent tears, for Edwin has given up\n" \
1070"carrying her old handkerchief in the inside pocket of his waistcoat.\n" \
1071"\n" \
1072"Both are astonished at the falling off in the other one, but neither\n" \
1073"sees their own change. If they did they would not suffer as they do.\n" \
1074"They would look for the cause in the right quarter--in the littleness\n" \
1075"of poor human nature--join hands over their common failing, and start\n" \
1076"building their house anew on a more earthly and enduring foundation.\n" \
1077"But we are so blind to our own shortcomings, so wide awake to those\n" \
1078"of others. Everything that happens to us is always the other person's\n" \
1079"fault. Angelina would have gone on loving Edwin forever and ever and\n" \
1080"ever if only Edwin had not grown so strange and different. Edwin would\n" \
1081"have adored Angelina through eternity if Angelina had only remained the\n" \
1082"same as when he first adored her.\n" \
1083"\n" \
1084"It is a cheerless hour for you both when the lamp of love has gone out\n" \
1085"and the fire of affection is not yet lit, and you have to grope about\n" \
1086"in the cold, raw dawn of life to kindle it. God grant it catches light\n" \
1087"before the day is too far spent. Many sit shivering by the dead coals\n" \
1088"till night come.\n" \
1089"\n" \
1090"But, there, of what use is it to preach? Who that feels the rush of\n" \
1091"young love through his veins can think it will ever flow feeble and\n" \
1092"slow! To the boy of twenty it seems impossible that he will not love as\n" \
1093"wildly at sixty as he does then. He cannot call to mind any middle-aged\n" \
1094"or elderly gentleman of his acquaintance who is known to exhibit\n" \
1095"symptoms of frantic attachment, but that does not interfere in his\n" \
1096"belief in himself. His love will never fall, whoever else's may. Nobody\n" \
1097"ever loved as he loves, and so, of course, the rest of the world's\n" \
1098"experience can be no guide in his case. Alas! alas! ere thirty he has\n" \
1099"joined the ranks of the sneerers. It is not his fault. Our passions,\n" \
1100"both the good and bad, cease with our blushes. We do not hate, nor\n" \
1101"grieve, nor joy, nor despair in our thirties like we did in our teens.\n" \
1102"Disappointment does not suggest suicide, and we quaff success without\n" \
1103"intoxication.\n" \
1104"\n" \
1105"We take all things in a minor key as we grow older. There are few\n" \
1106"majestic passages in the later acts of life's opera. Ambition takes\n" \
1107"a less ambitious aim. Honor becomes more reasonable and conveniently\n" \
1108"adapts itself to circumstances. And love--love dies. \"Irreverence for\n" \
1109"the dreams of youth\" soon creeps like a killing frost upon our hearts.\n" \
1110"The tender shoots and the expanding flowers are nipped and withered, and\n" \
1111"of a vine that yearned to stretch its tendrils round the world there is\n" \
1112"left but a sapless stump.\n" \
1113"\n" \
1114"My fair friends will deem all this rank heresy, I know. So far from a\n" \
1115"man's not loving after he has passed boyhood, it is not till there is a\n" \
1116"good deal of gray in his hair that they think his protestations at all\n" \
1117"worthy of attention. Young ladies take their notions of our sex from the\n" \
1118"novels written by their own, and compared with the monstrosities\n" \
1119"that masquerade for men in the pages of that nightmare literature,\n" \
1120"Pythagoras' plucked bird and Frankenstein's demon were fair average\n" \
1121"specimens of humanity.\n" \
1122"\n" \
1123"In these so-called books, the chief lover, or Greek god, as he is\n" \
1124"admiringly referred to--by the way, they do not say which \"Greek god\"\n" \
1125"it is that the gentleman bears such a striking likeness to; it might be\n" \
1126"hump-backed Vulcan, or double-faced Janus, or even driveling Silenus,\n" \
1127"the god of abstruse mysteries. He resembles the whole family of them,\n" \
1128"however, in being a blackguard, and perhaps this is what is meant. To\n" \
1129"even the little manliness his classical prototypes possessed, though,\n" \
1130"he can lay no claim whatever, being a listless effeminate noodle, on\n" \
1131"the shady side of forty. But oh! the depth and strength of this elderly\n" \
1132"party's emotion for some bread-and-butter school-girl! Hide your heads,\n" \
1133"ye young Romeos and Leanders! this _blase_ old beau loves with an\n" \
1134"hysterical fervor that requires four adjectives to every noun to\n" \
1135"properly describe.\n" \
1136"\n" \
1137"It is well, dear ladies, for us old sinners that you study only books.\n" \
1138"Did you read mankind, you would know that the lad's shy stammering tells\n" \
1139"a truer tale than our bold eloquence. A boy's love comes from a full\n" \
1140"heart; a man's is more often the result of a full stomach. Indeed, a\n" \
1141"man's sluggish current may not be called love, compared with the rushing\n" \
1142"fountain that wells up when a boy's heart is struck with the heavenly\n" \
1143"rod. If you would taste love, drink of the pure stream that youth pours\n" \
1144"out at your feet. Do not wait till it has become a muddy river before\n" \
1145"you stoop to catch its waves.\n" \
1146"\n" \
1147"Or is it that you like its bitter flavor--that the clear, limpid water\n" \
1148"is insipid to your palate and that the pollution of its after-course\n" \
1149"gives it a relish to your lips? Must we believe those who tell us that a\n" \
1150"hand foul with the filth of a shameful life is the only one a young girl\n" \
1151"cares to be caressed by?\n" \
1152"\n" \
1153"That is the teaching that is bawled out day by day from between those\n" \
1154"yellow covers. Do they ever pause to think, I wonder, those devil's\n" \
1155"ladyhelps, what mischief they are doing crawling about God's garden, and\n" \
1156"telling childish Eves and silly Adams that sin is sweet and that decency\n" \
1157"is ridiculous and vulgar? How many an innocent girl do they not degrade\n" \
1158"into an evil-minded woman? To how many a weak lad do they not point out\n" \
1159"the dirty by-path as the shortest cut to a maiden's heart? It is not as\n" \
1160"if they wrote of life as it really is. Speak truth, and right will take\n" \
1161"care of itself. But their pictures are coarse daubs painted from the\n" \
1162"sickly fancies of their own diseased imagination.\n" \
1163"\n" \
1164"We want to think of women not--as their own sex would show them--as\n" \
1165"Lorleis luring us to destruction, but as good angels beckoning us\n" \
1166"upward. They have more power for good or evil than they dream of. It is\n" \
1167"just at the very age when a man's character is forming that he tumbles\n" \
1168"into love, and then the lass he loves has the making or marring of him.\n" \
1169"Unconsciously he molds himself to what she would have him, good or bad.\n" \
1170"I am sorry to have to be ungallant enough to say that I do not think\n" \
1171"they always use their influence for the best. Too often the female world\n" \
1172"is bounded hard and fast within the limits of the commonplace. Their\n" \
1173"ideal hero is a prince of littleness, and to become that many a powerful\n" \
1174"mind, enchanted by love, is \"lost to life and use and name and fame.\"\n" \
1175"\n" \
1176"And yet, women, you could make us so much better if you only would. It\n" \
1177"rests with you, more than with all the preachers, to roll this world a\n" \
1178"little nearer heaven. Chivalry is not dead: it only sleeps for want\n" \
1179"of work to do. It is you who must wake it to noble deeds. You must be\n" \
1180"worthy of knightly worship.\n" \
1181"\n" \
1182"You must be higher than ourselves. It was for Una that the Red Cross\n" \
1183"Knight did war. For no painted, mincing court dame could the dragon have\n" \
1184"been slain. Oh, ladies fair, be fair in mind and soul as well as face,\n" \
1185"so that brave knights may win glory in your service! Oh, woman, throw\n" \
1186"off your disguising cloaks of selfishness, effrontery, and affectation!\n" \
1187"Stand forth once more a queen in your royal robe of simple purity. A\n" \
1188"thousand swords, now rusting in ignoble sloth, shall leap from their\n" \
1189"scabbards to do battle for your honor against wrong. A thousand Sir\n" \
1190"Rolands shall lay lance in rest, and Fear, Avarice, Pleasure, and\n" \
1191"Ambition shall go down in the dust before your colors.\n" \
1192"\n" \
1193"What noble deeds were we not ripe for in the days when we loved?\n" \
1194"What noble lives could we not have lived for her sake? Our love was\n" \
1195"a religion we could have died for. It was no mere human creature like\n" \
1196"ourselves that we adored. It was a queen that we paid homage to, a\n" \
1197"goddess that we worshiped.\n" \
1198"\n" \
1199"And how madly we did worship! And how sweet it was to worship! Ah, lad,\n" \
1200"cherish love's young dream while it lasts! You will know too soon how\n" \
1201"truly little Tom Moore sang when he said that there was nothing half so\n" \
1202"sweet in life. Even when it brings misery it is a wild, romantic misery,\n" \
1203"all unlike the dull, worldly pain of after-sorrows. When you have lost\n" \
1204"her--when the light is gone out from your life and the world stretches\n" \
1205"before you a long, dark horror, even then a half-enchantment mingles\n" \
1206"with your despair.\n" \
1207"\n" \
1208"And who would not risk its terrors to gain its raptures? Ah, what\n" \
1209"raptures they were! The mere recollection thrills you. How delicious\n" \
1210"it was to tell her that you loved her, that you lived for her, that\n" \
1211"you would die for her! How you did rave, to be sure, what floods of\n" \
1212"extravagant nonsense you poured forth, and oh, how cruel it was of\n" \
1213"her to pretend not to believe you! In what awe you stood of her! How\n" \
1214"miserable you were when you had offended her! And yet, how pleasant to\n" \
1215"be bullied by her and to sue for pardon without having the slightest\n" \
1216"notion of what your fault was! How dark the world was when she snubbed\n" \
1217"you, as she often did, the little rogue, just to see you look wretched;\n" \
1218"how sunny when she smiled! How jealous you were of every one about\n" \
1219"her! How you hated every man she shook hands with, every woman she\n" \
1220"kissed--the maid that did her hair, the boy that cleaned her shoes, the\n" \
1221"dog she nursed--though you had to be respectful to the last-named! How\n" \
1222"you looked forward to seeing her, how stupid you were when you did see\n" \
1223"her, staring at her without saying a word! How impossible it was for\n" \
1224"you to go out at any time of the day or night without finding yourself\n" \
1225"eventually opposite her windows! You hadn't pluck enough to go in, but\n" \
1226"you hung about the corner and gazed at the outside. Oh, if the house had\n" \
1227"only caught fire--it was insured, so it wouldn't have mattered--and you\n" \
1228"could have rushed in and saved her at the risk of your life, and have\n" \
1229"been terribly burned and injured! Anything to serve her. Even in little\n" \
1230"things that was so sweet. How you would watch her, spaniel-like, to\n" \
1231"anticipate her slightest wish! How proud you were to do her bidding! How\n" \
1232"delightful it was to be ordered about by her! To devote your whole life\n" \
1233"to her and to never think of yourself seemed such a simple thing. You\n" \
1234"would go without a holiday to lay a humble offering at her shrine, and\n" \
1235"felt more than repaid if she only deigned to accept it. How precious to\n" \
1236"you was everything that she had hallowed by her touch--her little glove,\n" \
1237"the ribbon she had worn, the rose that had nestled in her hair and whose\n" \
1238"withered leaves still mark the poems you never care to look at now.\n" \
1239"\n" \
1240"And oh, how beautiful she was, how wondrous beautiful! It was as some\n" \
1241"angel entering the room, and all else became plain and earthly. She was\n" \
1242"too sacred to be touched. It seemed almost presumption to gaze at her.\n" \
1243"You would as soon have thought of kissing her as of singing comic songs\n" \
1244"in a cathedral. It was desecration enough to kneel and timidly raise the\n" \
1245"gracious little hand to your lips.\n" \
1246"\n" \
1247"Ah, those foolish days, those foolish days when we were unselfish and\n" \
1248"pure-minded; those foolish days when our simple hearts were full\n" \
1249"of truth, and faith, and reverence! Ah, those foolish days of noble\n" \
1250"longings and of noble strivings! And oh, these wise, clever days when we\n" \
1251"know that money is the only prize worth striving for, when we believe in\n" \
1252"nothing else but meanness and lies, when we care for no living creature\n" \
1253"but ourselves!\n"
1254
1255#define DATA_2 \
1256"ON BEING IN THE BLUES.\n" \
1257"\n" \
1258"I can enjoy feeling melancholy, and there is a good deal of satisfaction\n" \
1259"about being thoroughly miserable; but nobody likes a fit of the blues.\n" \
1260"Nevertheless, everybody has them; notwithstanding which, nobody can tell\n" \
1261"why. There is no accounting for them. You are just as likely to have one\n" \
1262"on the day after you have come into a large fortune as on the day after\n" \
1263"you have left your new silk umbrella in the train. Its effect upon you\n" \
1264"is somewhat similar to what would probably be produced by a combined\n" \
1265"attack of toothache, indigestion, and cold in the head. You become\n" \
1266"stupid, restless, and irritable; rude to strangers and dangerous toward\n" \
1267"your friends; clumsy, maudlin, and quarrelsome; a nuisance to yourself\n" \
1268"and everybody about you.\n" \
1269"\n" \
1270"While it is on you can do nothing and think of nothing, though feeling\n" \
1271"at the time bound to do something. You can't sit still so put on your\n" \
1272"hat and go for a walk; but before you get to the corner of the street\n" \
1273"you wish you hadn't come out and you turn back. You open a book and try\n" \
1274"to read, but you find Shakespeare trite and commonplace, Dickens is dull\n" \
1275"and prosy, Thackeray a bore, and Carlyle too sentimental. You throw the\n" \
1276"book aside and call the author names. Then you \"shoo\" the cat out of\n" \
1277"the room and kick the door to after her. You think you will write your\n" \
1278"letters, but after sticking at \"Dearest Auntie: I find I have five\n" \
1279"minutes to spare, and so hasten to write to you,\" for a quarter of an\n" \
1280"hour, without being able to think of another sentence, you tumble the\n" \
1281"paper into the desk, fling the wet pen down upon the table-cloth,\n" \
1282"and start up with the resolution of going to see the Thompsons. While\n" \
1283"pulling on your gloves, however, it occurs to you that the Thompsons are\n" \
1284"idiots; that they never have supper; and that you will be expected to\n" \
1285"jump the baby. You curse the Thompsons and decide not to go.\n" \
1286"\n" \
1287"By this time you feel completely crushed. You bury your face in your\n" \
1288"hands and think you would like to die and go to heaven. You picture to\n" \
1289"yourself your own sick-bed, with all your friends and relations standing\n" \
1290"round you weeping. You bless them all, especially the young and pretty\n" \
1291"ones. They will value you when you are gone, so you say to yourself,\n" \
1292"and learn too late what they have lost; and you bitterly contrast their\n" \
1293"presumed regard for you then with their decided want of veneration now.\n" \
1294"\n" \
1295"These reflections make you feel a little more cheerful, but only for a\n" \
1296"brief period; for the next moment you think what a fool you must be\n" \
1297"to imagine for an instant that anybody would be sorry at anything that\n" \
1298"might happen to you. Who would care two straws (whatever precise amount\n" \
1299"of care two straws may represent) whether you are blown up, or hung\n" \
1300"up, or married, or drowned? Nobody cares for you. You never have\n" \
1301"been properly appreciated, never met with your due deserts in any one\n" \
1302"particular. You review the whole of your past life, and it is painfully\n" \
1303"apparent that you have been ill-used from your cradle.\n" \
1304"\n" \
1305"Half an hour's indulgence in these considerations works you up into\n" \
1306"a state of savage fury against everybody and everything, especially\n" \
1307"yourself, whom anatomical reasons alone prevent your kicking. Bed-time\n" \
1308"at last comes, to save you from doing something rash, and you spring\n" \
1309"upstairs, throw off your clothes, leaving them strewn all over the room,\n" \
1310"blow out the candle, and jump into bed as if you had backed yourself\n" \
1311"for a heavy wager to do the whole thing against time. There you toss\n" \
1312"and tumble about for a couple of hours or so, varying the monotony by\n" \
1313"occasionally jerking the clothes off and getting out and putting them\n" \
1314"on again. At length you drop into an uneasy and fitful slumber, have bad\n" \
1315"dreams, and wake up late the next morning.\n" \
1316"\n" \
1317"At least, this is all we poor single men can do under the circumstances.\n" \
1318"Married men bully their wives, grumble at the dinner, and insist on the\n" \
1319"children's going to bed. All of which, creating, as it does, a good deal\n" \
1320"of disturbance in the house, must be a great relief to the feelings of a\n" \
1321"man in the blues, rows being the only form of amusement in which he can\n" \
1322"take any interest.\n" \
1323"\n" \
1324"The symptoms of the infirmity are much the same in every case, but the\n" \
1325"affliction itself is variously termed. The poet says that \"a feeling\n" \
1326"of sadness comes o'er him.\" 'Arry refers to the heavings of his wayward\n" \
1327"heart by confiding to Jimee that he has \"got the blooming hump.\" Your\n" \
1328"sister doesn't know what is the matter with her to-night. She feels out\n" \
1329"of sorts altogether and hopes nothing is going to happen. The every-day\n" \
1330"young man is \"so awful glad to meet you, old fellow,\" for he does \"feel\n" \
1331"so jolly miserable this evening.\" As for myself, I generally say that \"I\n" \
1332"have a strange, unsettled feeling to-night\" and \"think I'll go out.\"\n" \
1333"\n" \
1334"By the way, it never does come except in the evening. In the sun-time,\n" \
1335"when the world is bounding forward full of life, we cannot stay to sigh\n" \
1336"and sulk. The roar of the working day drowns the voices of the elfin\n" \
1337"sprites that are ever singing their low-toned _miserere_ in our ears.\n" \
1338"In the day we are angry, disappointed, or indignant, but never \"in the\n" \
1339"blues\" and never melancholy. When things go wrong at ten o'clock in the\n" \
1340"morning we--or rather you--swear and knock the furniture about; but if\n" \
1341"the misfortune comes at ten P.M., we read poetry or sit in the dark and\n" \
1342"think what a hollow world this is.\n" \
1343"\n" \
1344"But, as a rule, it is not trouble that makes us melancholy. The\n" \
1345"actuality is too stern a thing for sentiment. We linger to weep over\n" \
1346"a picture, but from the original we should quickly turn our eyes away.\n" \
1347"There is no pathos in real misery: no luxury in real grief. We do not\n" \
1348"toy with sharp swords nor hug a gnawing fox to our breast for choice.\n" \
1349"When a man or woman loves to brood over a sorrow and takes care to keep\n" \
1350"it green in their memory, you may be sure it is no longer a pain to\n" \
1351"them. However they may have suffered from it at first, the recollection\n" \
1352"has become by then a pleasure. Many dear old ladies who daily look at\n" \
1353"tiny shoes lying in lavender-scented drawers, and weep as they think of\n" \
1354"the tiny feet whose toddling march is done, and sweet-faced young ones\n" \
1355"who place each night beneath their pillow some lock that once curled on\n" \
1356"a boyish head that the salt waves have kissed to death, will call me\n" \
1357"a nasty cynical brute and say I'm talking nonsense; but I believe,\n" \
1358"nevertheless, that if they will ask themselves truthfully whether they\n" \
1359"find it unpleasant to dwell thus on their sorrow, they will be compelled\n" \
1360"to answer \"No.\" Tears are as sweet as laughter to some natures. The\n" \
1361"proverbial Englishman, we know from old chronicler Froissart, takes his\n" \
1362"pleasures sadly, and the Englishwoman goes a step further and takes her\n" \
1363"pleasures in sadness itself.\n" \
1364"\n" \
1365"I am not sneering. I would not for a moment sneer at anything that\n" \
1366"helps to keep hearts tender in this hard old world. We men are cold and\n" \
1367"common-sensed enough for all; we would not have women the same. No, no,\n" \
1368"ladies dear, be always sentimental and soft-hearted, as you are--be the\n" \
1369"soothing butter to our coarse dry bread. Besides, sentiment is to women\n" \
1370"what fun is to us. They do not care for our humor, surely it would be\n" \
1371"unfair to deny them their grief. And who shall say that their mode of\n" \
1372"enjoyment is not as sensible as ours? Why assume that a doubled-up\n" \
1373"body, a contorted, purple face, and a gaping mouth emitting a series\n" \
1374"of ear-splitting shrieks point to a state of more intelligent happiness\n" \
1375"than a pensive face reposing upon a little white hand, and a pair of\n" \
1376"gentle tear-dimmed eyes looking back through Time's dark avenue upon a\n" \
1377"fading past?\n" \
1378"\n" \
1379"I am glad when I see Regret walked with as a friend--glad because I know\n" \
1380"the saltness has been washed from out the tears, and that the sting must\n" \
1381"have been plucked from the beautiful face of Sorrow ere we dare press\n" \
1382"her pale lips to ours. Time has laid his healing hand upon the wound\n" \
1383"when we can look back upon the pain we once fainted under and no\n" \
1384"bitterness or despair rises in our hearts. The burden is no longer\n" \
1385"heavy when we have for our past troubles only the same sweet mingling of\n" \
1386"pleasure and pity that we feel when old knight-hearted Colonel Newcome\n" \
1387"answers \"_adsum_\" to the great roll-call, or when Tom and Maggie\n" \
1388"Tulliver, clasping hands through the mists that have divided them, go\n" \
1389"down, locked in each other's arms, beneath the swollen waters of the\n" \
1390"Floss.\n" \
1391"\n" \
1392"Talking of poor Tom and Maggie Tulliver brings to my mind a saying of\n" \
1393"George Eliot's in connection with this subject of melancholy. She\n" \
1394"speaks somewhere of the \"sadness of a summer's evening.\" How wonderfully\n" \
1395"true--like everything that came from that wonderful pen--the observation\n" \
1396"is! Who has not felt the sorrowful enchantment of those lingering\n" \
1397"sunsets? The world belongs to Melancholy then, a thoughtful deep-eyed\n" \
1398"maiden who loves not the glare of day. It is not till \"light thickens\n" \
1399"and the crow wings to the rocky wood\" that she steals forth from her\n" \
1400"groves. Her palace is in twilight land. It is there she meets us. At her\n" \
1401"shadowy gate she takes our hand in hers and walks beside us through\n" \
1402"her mystic realm. We see no form, but seem to hear the rustling of her\n" \
1403"wings.\n" \
1404"\n" \
1405"Even in the toiling hum-drum city her spirit comes to us. There is a\n" \
1406"somber presence in each long, dull street; and the dark river creeps\n" \
1407"ghostlike under the black arches, as if bearing some hidden secret\n" \
1408"beneath its muddy waves.\n" \
1409"\n" \
1410"In the silent country, when the trees and hedges loom dim and blurred\n" \
1411"against the rising night, and the bat's wing flutters in our face, and\n" \
1412"the land-rail's cry sounds drearily across the fields, the spell sinks\n" \
1413"deeper still into our hearts. We seem in that hour to be standing by\n" \
1414"some unseen death-bed, and in the swaying of the elms we hear the sigh\n" \
1415"of the dying day.\n" \
1416"\n" \
1417"A solemn sadness reigns. A great peace is around us. In its light\n" \
1418"our cares of the working day grow small and trivial, and bread and\n" \
1419"cheese--ay, and even kisses--do not seem the only things worth striving\n" \
1420"for. Thoughts we cannot speak but only listen to flood in upon us, and\n" \
1421"standing in the stillness under earth's darkening dome, we feel that we\n" \
1422"are greater than our petty lives. Hung round with those dusky curtains,\n" \
1423"the world is no longer a mere dingy workshop, but a stately temple\n" \
1424"wherein man may worship, and where at times in the dimness his groping\n" \
1425"hands touch God's.\n"
1426
1427#define DATA_3 \
1428"ON BEING HARD UP.\n" \
1429"\n" \
1430"It is a most remarkable thing. I sat down with the full intention of\n" \
1431"writing something clever and original; but for the life of me I can't\n" \
1432"think of anything clever and original--at least, not at this moment. The\n" \
1433"only thing I can think about now is being hard up. I suppose having my\n" \
1434"hands in my pockets has made me think about this. I always do sit with\n" \
1435"my hands in my pockets except when I am in the company of my sisters,\n" \
1436"my cousins, or my aunts; and they kick up such a shindy--I should say\n" \
1437"expostulate so eloquently upon the subject--that I have to give in and\n" \
1438"take them out--my hands I mean. The chorus to their objections is that\n" \
1439"it is not gentlemanly. I am hanged if I can see why. I could understand\n" \
1440"its not being considered gentlemanly to put your hands in other people's\n" \
1441"pockets (especially by the other people), but how, O ye sticklers for\n" \
1442"what looks this and what looks that, can putting his hands in his own\n" \
1443"pockets make a man less gentle? Perhaps you are right, though. Now I\n" \
1444"come to think of it, I have heard some people grumble most savagely when\n" \
1445"doing it. But they were mostly old gentlemen. We young fellows, as a\n" \
1446"rule, are never quite at ease unless we have our hands in our pockets.\n" \
1447"We are awkward and shifty. We are like what a music-hall Lion Comique\n" \
1448"would be without his opera-hat, if such a thing can be imagined. But let\n" \
1449"us put our hands in our trousers pockets, and let there be some small\n" \
1450"change in the right-hand one and a bunch of keys in the left, and we\n" \
1451"will face a female post-office clerk.\n" \
1452"\n" \
1453"It is a little difficult to know what to do with your hands, even in\n" \
1454"your pockets, when there is nothing else there. Years ago, when my whole\n" \
1455"capital would occasionally come down to \"what in town the people call\n" \
1456"a bob,\" I would recklessly spend a penny of it, merely for the sake of\n" \
1457"having the change, all in coppers, to jingle. You don't feel nearly so\n" \
1458"hard up with eleven pence in your pocket as you do with a shilling. Had\n" \
1459"I been \"La-di-da,\" that impecunious youth about whom we superior folk\n" \
1460"are so sarcastic, I would have changed my penny for two ha'pennies.\n" \
1461"\n" \
1462"I can speak with authority on the subject of being hard up. I have been\n" \
1463"a provincial actor. If further evidence be required, which I do not\n" \
1464"think likely, I can add that I have been a \"gentleman connected with the\n" \
1465"press.\" I have lived on 15 shilling a week. I have lived a week on 10,\n" \
1466"owing the other 5; and I have lived for a fortnight on a great-coat.\n" \
1467"\n" \
1468"It is wonderful what an insight into domestic economy being really hard\n" \
1469"up gives one. If you want to find out the value of money, live on\n" \
1470"15 shillings a week and see how much you can put by for clothes and\n" \
1471"recreation. You will find out that it is worth while to wait for the\n" \
1472"farthing change, that it is worth while to walk a mile to save a\n" \
1473"penny, that a glass of beer is a luxury to be indulged in only at rare\n" \
1474"intervals, and that a collar can be worn for four days.\n" \
1475"\n" \
1476"Try it just before you get married. It will be excellent practice. Let\n" \
1477"your son and heir try it before sending him to college. He won't grumble\n" \
1478"at a hundred a year pocket-money then. There are some people to whom it\n" \
1479"would do a world of good. There is that delicate blossom who can't drink\n" \
1480"any claret under ninety-four, and who would as soon think of dining\n" \
1481"off cat's meat as off plain roast mutton. You do come across these\n" \
1482"poor wretches now and then, though, to the credit of humanity, they are\n" \
1483"principally confined to that fearful and wonderful society known only\n" \
1484"to lady novelists. I never hear of one of these creatures discussing a\n" \
1485"_menu_ card but I feel a mad desire to drag him off to the bar of\n" \
1486"some common east-end public-house and cram a sixpenny dinner down his\n" \
1487"throat--beefsteak pudding, fourpence; potatoes, a penny; half a pint of\n" \
1488"porter, a penny. The recollection of it (and the mingled fragrance of\n" \
1489"beer, tobacco, and roast pork generally leaves a vivid impression) might\n" \
1490"induce him to turn up his nose a little less frequently in the future\n" \
1491"at everything that is put before him. Then there is that generous party,\n" \
1492"the cadger's delight, who is so free with his small change, but who\n" \
1493"never thinks of paying his debts. It might teach even him a little\n" \
1494"common sense. \"I always give the waiter a shilling. One can't give the\n" \
1495"fellow less, you know,\" explained a young government clerk with whom I\n" \
1496"was lunching the other day in Regent Street. I agreed with him as to the\n" \
1497"utter impossibility of making it elevenpence ha'penny; but at the same\n" \
1498"time I resolved to one day decoy him to an eating-house I remembered\n" \
1499"near Covent Garden, where the waiter, for the better discharge of his\n" \
1500"duties, goes about in his shirt-sleeves--and very dirty sleeves they\n" \
1501"are, too, when it gets near the end of the month. I know that waiter.\n" \
1502"If my friend gives him anything beyond a penny, the man will insist on\n" \
1503"shaking hands with him then and there as a mark of his esteem; of that I\n" \
1504"feel sure.\n" \
1505"\n" \
1506"There have been a good many funny things said and written about\n" \
1507"hardupishness, but the reality is not funny, for all that. It is not\n" \
1508"funny to have to haggle over pennies. It isn't funny to be thought\n" \
1509"mean and stingy. It isn't funny to be shabby and to be ashamed of your\n" \
1510"address. No, there is nothing at all funny in poverty--to the poor. It\n" \
1511"is hell upon earth to a sensitive man; and many a brave gentleman who\n" \
1512"would have faced the labors of Hercules has had his heart broken by its\n" \
1513"petty miseries.\n" \
1514"\n" \
1515"It is not the actual discomforts themselves that are hard to bear.\n" \
1516"Who would mind roughing it a bit if that were all it meant? What cared\n" \
1517"Robinson Crusoe for a patch on his trousers? Did he wear trousers? I\n" \
1518"forget; or did he go about as he does in the pantomimes? What did it\n" \
1519"matter to him if his toes did stick out of his boots? and what if\n" \
1520"his umbrella was a cotton one, so long as it kept the rain off? His\n" \
1521"shabbiness did not trouble him; there was none of his friends round\n" \
1522"about to sneer him.\n" \
1523"\n" \
1524"Being poor is a mere trifle. It is being known to be poor that is the\n" \
1525"sting. It is not cold that makes a man without a great-coat hurry along\n" \
1526"so quickly. It is not all shame at telling lies--which he knows will\n" \
1527"not be believed--that makes him turn so red when he informs you that\n" \
1528"he considers great-coats unhealthy and never carries an umbrella on\n" \
1529"principle. It is easy enough to say that poverty is no crime. No; if\n" \
1530"it were men wouldn't be ashamed of it. It's a blunder, though, and is\n" \
1531"punished as such. A poor man is despised the whole world over; despised\n" \
1532"as much by a Christian as by a lord, as much by a demagogue as by a\n" \
1533"footman, and not all the copy-book maxims ever set for ink stained youth\n" \
1534"will make him respected. Appearances are everything, so far as human\n" \
1535"opinion goes, and the man who will walk down Piccadilly arm in arm with\n" \
1536"the most notorious scamp in London, provided he is a well-dressed one,\n" \
1537"will slink up a back street to say a couple of words to a seedy-looking\n" \
1538"gentleman. And the seedy-looking gentleman knows this--no one\n" \
1539"better--and will go a mile round to avoid meeting an acquaintance. Those\n" \
1540"that knew him in his prosperity need never trouble themselves to look\n" \
1541"the other way. He is a thousand times more anxious that they should not\n" \
1542"see him than they can be; and as to their assistance, there is nothing\n" \
1543"he dreads more than the offer of it. All he wants is to be forgotten;\n" \
1544"and in this respect he is generally fortunate enough to get what he\n" \
1545"wants.\n" \
1546"\n" \
1547"One becomes used to being hard up, as one becomes used to everything\n" \
1548"else, by the help of that wonderful old homeopathic doctor, Time. You\n" \
1549"can tell at a glance the difference between the old hand and the novice;\n" \
1550"between the case-hardened man who has been used to shift and struggle\n" \
1551"for years and the poor devil of a beginner striving to hide his misery,\n" \
1552"and in a constant agony of fear lest he should be found out. Nothing\n" \
1553"shows this difference more clearly than the way in which each will pawn\n" \
1554"his watch. As the poet says somewhere: \"True ease in pawning comes from\n" \
1555"art, not chance.\" The one goes into his \"uncle's\" with as much composure\n" \
1556"as he would into his tailor's--very likely with more. The assistant is\n" \
1557"even civil and attends to him at once, to the great indignation of the\n" \
1558"lady in the next box, who, however, sarcastically observes that she\n" \
1559"don't mind being kept waiting \"if it is a regular customer.\" Why, from\n" \
1560"the pleasant and businesslike manner in which the transaction is carried\n" \
1561"out, it might be a large purchase in the three per cents. Yet what a\n" \
1562"piece of work a man makes of his first \"pop.\" A boy popping his first\n" \
1563"question is confidence itself compared with him. He hangs about outside\n" \
1564"the shop until he has succeeded in attracting the attention of all the\n" \
1565"loafers in the neighborhood and has aroused strong suspicions in the\n" \
1566"mind of the policeman on the beat. At last, after a careful examination\n" \
1567"of the contents of the windows, made for the purpose of impressing the\n" \
1568"bystanders with the notion that he is going in to purchase a diamond\n" \
1569"bracelet or some such trifle, he enters, trying to do so with a careless\n" \
1570"swagger, and giving himself really the air of a member of the swell mob.\n" \
1571"When inside he speaks in so low a voice as to be perfectly inaudible,\n" \
1572"and has to say it all over again. When, in the course of his rambling\n" \
1573"conversation about a \"friend\" of his, the word \"lend\" is reached, he is\n" \
1574"promptly told to go up the court on the right and take the first door\n" \
1575"round the corner. He comes out of the shop with a face that you could\n" \
1576"easily light a cigarette at, and firmly under the impression that the\n" \
1577"whole population of the district is watching him. When he does get\n" \
1578"to the right place he has forgotten his name and address and is in a\n" \
1579"general condition of hopeless imbecility. Asked in a severe tone how he\n" \
1580"came by \"this,\" he stammers and contradicts himself, and it is only a\n" \
1581"miracle if he does not confess to having stolen it that very day. He is\n" \
1582"thereupon informed that they don't want anything to do with his sort,\n" \
1583"and that he had better get out of this as quickly as possible, which he\n" \
1584"does, recollecting nothing more until he finds himself three miles off,\n" \
1585"without the slightest knowledge how he got there.\n" \
1586"\n" \
1587"By the way, how awkward it is, though, having to depend on public-houses\n" \
1588"and churches for the time. The former are generally too fast and the\n" \
1589"latter too slow. Besides which, your efforts to get a glimpse of\n" \
1590"the public house clock from the outside are attended with great\n" \
1591"difficulties. If you gently push the swing-door ajar and peer in you\n" \
1592"draw upon yourself the contemptuous looks of the barmaid, who at once\n" \
1593"puts you down in the same category with area sneaks and cadgers. You\n" \
1594"also create a certain amount of agitation among the married portion of\n" \
1595"the customers. You don't see the clock because it is behind the door;\n" \
1596"and in trying to withdraw quietly you jam your head. The only other\n" \
1597"method is to jump up and down outside the window. After this latter\n" \
1598"proceeding, however, if you do not bring out a banjo and commence to\n" \
1599"sing, the youthful inhabitants of the neighborhood, who have gathered\n" \
1600"round in expectation, become disappointed.\n" \
1601"\n" \
1602"I should like to know, too, by what mysterious law of nature it is that\n" \
1603"before you have left your watch \"to be repaired\" half an hour, some one\n" \
1604"is sure to stop you in the street and conspicuously ask you the time.\n" \
1605"Nobody even feels the slightest curiosity on the subject when you've got\n" \
1606"it on.\n" \
1607"\n" \
1608"Dear old ladies and gentlemen who know nothing about being hard up--and\n" \
1609"may they never, bless their gray old heads--look upon the pawn-shop\n" \
1610"as the last stage of degradation; but those who know it better (and my\n" \
1611"readers have no doubt, noticed this themselves) are often surprised,\n" \
1612"like the little boy who dreamed he went to heaven, at meeting so many\n" \
1613"people there that they never expected to see. For my part, I think it a\n" \
1614"much more independent course than borrowing from friends, and I always\n" \
1615"try to impress this upon those of my acquaintance who incline toward\n" \
1616"\"wanting a couple of pounds till the day after to-morrow.\" But they\n" \
1617"won't all see it. One of them once remarked that he objected to the\n" \
1618"principle of the thing. I fancy if he had said it was the interest that\n" \
1619"he objected to he would have been nearer the truth: twenty-five per\n" \
1620"cent. certainly does come heavy.\n" \
1621"\n" \
1622"There are degrees in being hard up. We are all hard up, more or\n" \
1623"less--most of us more. Some are hard up for a thousand pounds; some for\n" \
1624"a shilling. Just at this moment I am hard up myself for a fiver. I only\n" \
1625"want it for a day or two. I should be certain of paying it back within a\n" \
1626"week at the outside, and if any lady or gentleman among my readers would\n" \
1627"kindly lend it me, I should be very much obliged indeed. They could send\n" \
1628"it to me under cover to Messrs. Field & Tuer, only, in such case, please\n" \
1629"let the envelope be carefully sealed. I would give you my I.O.U. as\n" \
1630"security.\n"
1631
1632static const char *s_data[N_STREAMS] = {
1633    DATA_0,
1634    DATA_1,
1635    DATA_2,
1636    DATA_3,
1637};
1638
1639static size_t s_data_sz[N_STREAMS] = {
1640    sizeof(DATA_0) - 1,
1641    sizeof(DATA_1) - 1,
1642    sizeof(DATA_2) - 1,
1643    sizeof(DATA_3) - 1,
1644};
1645