Source code: com/k_int/codec/runtime/SerializationManager.java
1 /**
2 *
3 * SerializationManager
4 *
5 * @author Ian Ibbotson ( ibbo@k-int.com )
6 * @version $Id: SerializationManager.java,v 1.2 2000/12/23 10:44:33 ianibbo Exp $
7 *
8 * Copyright: Copyright (C) 2000, Knowledge Integration Ltd.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2.1 of
13 * the license, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite
23 * 330, Boston, MA 02111-1307, USA.
24 *
25 */
26
27 package com.k_int.codec.runtime;
28
29 import java.math.BigInteger;
30 import java.util.Vector;
31 import java.util.Stack;
32
33 public interface SerializationManager
34 {
35 public static final Integer TAGMODE_NONE = new Integer(-1);
36 public static final Integer IMPLICIT = new Integer(0);
37 public static final Integer EXPLICIT = new Integer(1);
38
39 public static final int UNIVERSAL = 0;
40
41 public static final int BOOLEAN = 1;
42 public static final int INTEGER = 2;
43 public static final int BITSTRING = 3;
44 public static final int OCTETSTRING = 4;
45 public static final int NULL = 5;
46 public static final int OID = 6;
47 public static final int OBJECT_DESCRIPTOR = 7;
48 public static final int EXTERNAL = 8;
49 public static final int REAL = 9;
50 public static final int ENUMERATED = 10;
51 public static final int SEQUENCEOF = 16;
52 public static final int SEQUENCE = 16;
53 public static final int SET = 17;
54 public static final int NUMERIC_STRING = 18;
55 public static final int PRINTABLE_STRING = 19;
56 public static final int GENERALIZED_TIME = 24;
57 public static final int GRAPHIC_STRING = 25;
58 public static final int VISIBLE_STRING = 26;
59 public static final int GENERAL_STRING = 27;
60
61
62 // Er, not sure what I'm doing here
63 public static final int ANY = 100;
64
65 public static final int DIRECTION_ENCODE = 0;
66 public static final int DIRECTION_DECODE = 1;
67 public static final int DIRECTION_PRINT = 2;
68
69 public int getDirection();
70
71 // Tag returns the length of the encoded contents
72 public int tag_codec(boolean is_constructed) throws java.io.IOException;
73 public String octetstring_codec(Object instance, boolean is_constructed) throws java.io.IOException;
74 public Boolean boolean_codec(Object instance, boolean is_constructed) throws java.io.IOException;
75 public BigInteger integer_codec(Object instance, boolean is_constructed) throws java.io.IOException;
76 public int[] oid_codec(Object instance, boolean is_constructed) throws java.io.IOException;
77 public byte[] any_codec(Object instance, boolean is_constructed) throws java.io.IOException;
78 public AsnBitString bitstring_codec(Object instance, boolean is_constructed) throws java.io.IOException;
79 public AsnNull null_codec(Object instance, boolean is_constructed) throws java.io.IOException;
80 public Object choice(Object current_instance, Object[][] choice_info, int which, String name) throws java.io.IOException;
81 public boolean sequenceBegin() throws java.io.IOException;
82 public boolean sequenceEnd() throws java.io.IOException;
83 public boolean constructedBegin(int tagclass, int tagnumber) throws java.io.IOException;
84 public boolean constructedEnd() throws java.io.IOException;
85
86 // The next tag to be encoded will be :
87 // public int tag_class = -1;
88 // public int tag_value = -1;
89 // public boolean is_constructed = false;
90
91 public Object implicit_tag(base_codec c, Object current_instance, int tag_class, int tag_number, boolean is_optional, String name) throws java.io.IOException;
92 public Object explicit_tag(base_codec c, Object current_instance, int tag_class, int tag_number, boolean is_optional, String name) throws java.io.IOException;
93 public boolean sequenceOf(Vector v, base_codec codec) throws java.io.IOException;
94 public void implicit_settag(int tagclass, int tagvalue);
95
96 public base_codec getHintCodec();
97 public void setHintCodec(base_codec c);
98 }