Added skeleton for query charset conversion. Bug #977.
[yaz-moved-to-github.git] / src / ber_null.c
1 /*
2  * Copyright (C) 1995-2007, Index Data ApS
3  * See the file LICENSE for details.
4  *
5  * $Id: ber_null.c,v 1.6 2007-01-03 08:42:15 adam Exp $
6  */
7
8 /** 
9  * \file ber_null.c
10  * \brief Implements ber_null
11  *
12  * This source file implements BER encoding and decoding of
13  * the NULL type.
14  */
15 #if HAVE_CONFIG_H
16 #include <config.h>
17 #endif
18
19 #include "odr-priv.h"
20
21 /** 
22  * ber_null: BER-en/decoder for NULL type.
23  */
24 int ber_null(ODR o)
25 {
26     switch (o->direction)
27     {
28     case ODR_ENCODE:
29         if (odr_putc(o, 0X00) < 0)
30             return 0;
31         return 1;
32     case ODR_DECODE:
33         if (odr_max(o) < 1)
34         {
35             odr_seterror(o, OPROTO, 39);
36             return 0;
37         }
38         if (*(o->bp++) != 0X00)
39         {
40             odr_seterror(o, OPROTO, 12);
41             return 0;
42         }
43         return 1;
44     case ODR_PRINT:
45         return 1;
46     default:
47         odr_seterror(o, OOTHER, 13);
48         return 0;
49     }
50 }
51 /*
52  * Local variables:
53  * c-basic-offset: 4
54  * indent-tabs-mode: nil
55  * End:
56  * vim: shiftwidth=4 tabstop=8 expandtab
57  */
58