Kannel: Open Source WAP and SMS gateway  svn-r5335
wtls_pdusupport.h
Go to the documentation of this file.
1 /* ====================================================================
2  * The Kannel Software License, Version 1.0
3  *
4  * Copyright (c) 2001-2008 Kannel Group
5  * Copyright (c) 1998-2001 WapIT Ltd.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Kannel Group (http://www.kannel.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "Kannel" and "Kannel Group" must not be used to
28  * endorse or promote products derived from this software without
29  * prior written permission. For written permission, please
30  * contact org@kannel.org.
31  *
32  * 5. Products derived from this software may not be called "Kannel",
33  * nor may "Kannel" appear in their name, without prior written
34  * permission of the Kannel Group.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE KANNEL GROUP OR ITS CONTRIBUTORS
40  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
41  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
42  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
43  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
44  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
45  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
46  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47  * ====================================================================
48  *
49  * This software consists of voluntary contributions made by many
50  * individuals on behalf of the Kannel Group. For more information on
51  * the Kannel Group, please see <http://www.kannel.org/>.
52  *
53  * Portions of this software are based upon software originally written at
54  * WapIT Ltd., Helsinki, Finland for the Kannel project.
55  *
56  * Nikos Balkanas, Inaccess Networks (2009)
57  */
58 
59 #ifndef PDUSUPPORT_H
60 #define PDUSUPPORT_H
61 
62 int pack_int16(Octstr *data, long charpos, int i);
63 int pack_int32(Octstr *data, long charpos, long i);
64 int pack_octstr(Octstr *data, long charpos, Octstr *opaque);
65 int pack_octstr16(Octstr *data, long charpos, Octstr *opaque);
66 int pack_octstr_fixed(Octstr *data, long charpos, Octstr *opaque);
67 int pack_random(Octstr *data, long charpos, Random *random);
68 int pack_dhparams(Octstr *data, long charpos, DHParameters *dhparams);
69 int pack_ecparams(Octstr *data, long charpos, ECParameters *ecparams);
70 int pack_param_spec(Octstr *data, long charpos, ParameterSpecifier *pspec);
71 int pack_public_key(Octstr *data, long charpos, PublicKey *key, PublicKeyType key_type);
72 int pack_rsa_pubkey(Octstr *data, long charpos, RSAPublicKey *key);
73 int pack_dh_pubkey(Octstr *data, long charpos, DHPublicKey *key);
74 int pack_ec_pubkey(Octstr *data, long charpos, ECPublicKey *key);
75 int pack_rsa_secret(Octstr *data, long charpos, RSASecret *secret);
76 int pack_rsa_encrypted_secret(Octstr *data, long charpos, RSAEncryptedSecret *secret);
77 int pack_key_exchange_id(Octstr *data, long charpos, KeyExchangeId *keyexid);
78 int pack_array(Octstr *data, long charpos, List *array);
79 int pack_key_list(Octstr *data, long charpos, List *key_list);
80 int pack_ciphersuite_list(Octstr *data, long charpos, List *ciphersuites);
81 int pack_compression_method_list(Octstr *data, long charpos, List *compmethod_list);
82 int pack_identifier(Octstr *data, long charpos, Identifier *ident);
83 int pack_signature(Octstr *data, long charpos, Signature *sig);
84 int pack_wtls_certificate(Octstr *data, long charpos, WTLSCertificate *cert);
85 
86 
87 int unpack_int16(Octstr *data, long *charpos);
88 long unpack_int32(Octstr *data, long *charpos);
89 Octstr * unpack_octstr(Octstr *data, long *charpos);
90 Octstr * unpack_octstr16(Octstr *data, long *charpos);
91 Octstr * unpack_octstr_fixed(Octstr *data, long *charpos, long length);
92 Random * unpack_random(Octstr *data, long *charpos);
93 DHParameters * unpack_dhparams(Octstr *data, long *charpos);
94 ECParameters * unpack_ecparams(Octstr *data, long *charpos);
95 ParameterSpecifier * unpack_param_spec(Octstr *data, long *charpos);
96 PublicKey * unpack_public_key(Octstr *data, long *charpos, PublicKeyType key_type);
97 RSAPublicKey * unpack_rsa_pubkey(Octstr *data, long *charpos);
98 DHPublicKey * unpack_dh_pubkey(Octstr *data, long *charpos);
99 ECPublicKey * unpack_ec_pubkey(Octstr *data, long *charpos);
100 RSASecret * unpack_rsa_secret(Octstr *data, long *charpos);
102 KeyExchangeId * unpack_key_exchange_id(Octstr *data, long *charpos);
103 List * unpack_array(Octstr *data, long *charpos);
104 List * unpack_ciphersuite_list(Octstr *data, long *charpos);
105 List * unpack_key_list(Octstr *data, long *charpos);
106 List * unpack_compression_method_list(Octstr *data, long *charpos);
107 Identifier * unpack_identifier(Octstr *data, long *charpos);
108 Signature * unpack_signature(Octstr *data, long *charpos);
109 WTLSCertificate * unpack_wtls_certificate(Octstr *data, long *charpos);
110 
111 void dump_int16(char *dbg, int level, int i);
112 void dump_int32(char *dbg, int level, long i);
113 void dump_octstr(char *dbg, int level, Octstr *opaque);
114 void dump_octstr16(char *dbg, int level, Octstr *opaque);
115 void dump_octstr_fixed(char *dbg, int level, Octstr *opaque);
116 void dump_random(char *dbg, int level, Random *random);
117 void dump_dhparams(char *dbg, int level, DHParameters *dhparams);
118 void dump_ecparams(char *dbg, int level, ECParameters *ecparams);
119 void dump_param_spec(char *dbg, int level, ParameterSpecifier *pspec);
120 void dump_public_key(char *dbg, int level, PublicKey *key, PublicKeyType key_type);
121 void dump_rsa_pubkey(char *dbg, int level, RSAPublicKey *key);
122 void dump_dh_pubkey(char *dbg, int level, DHPublicKey *key);
123 void dump_ec_pubkey(char *dbg, int level, ECPublicKey *key);
124 void dump_rsa_secret(char *dbg, int level, RSASecret *secret);
125 void dump_rsa_encrypted_secret(char *dbg, int level, RSAEncryptedSecret *secret);
126 void dump_key_exchange_id(char *dbg, int level, KeyExchangeId *keyexid);
127 void dump_array(char *dbg, int level, List *array);
128 void dump_key_list(char *dbg, int level, List *key_list);
129 void dump_ciphersuite_list(char *dbg, int level, List *ciphersuites);
130 void dump_compression_method_list(char *dbg, int level, List *compmethod_list);
131 void dump_identifier(char *dbg, int level, Identifier *ident);
132 void dump_signature(char *dbg, int level, Signature *sig);
133 void dump_wtls_certificate(char *dbg, int level, WTLSCertificate *cert);
134 
136 void destroy_array(List *array);
137 void destroy_identifier(Identifier *ident);
139 void destroy_key_list(List *key_list);
140 void destroy_ciphersuite_list(List *ciphersuites);
141 void destroy_compression_method_list(List *compmethod_list);
144 void destroy_dh_pubkey(DHPublicKey *key);
145 void destroy_ec_pubkey(ECPublicKey *key);
147 #endif /* PDUSUPPORT_H */
void destroy_compression_method_list(List *compmethod_list)
void dump_compression_method_list(char *dbg, int level, List *compmethod_list)
void dump_rsa_pubkey(char *dbg, int level, RSAPublicKey *key)
PublicKey * unpack_public_key(Octstr *data, long *charpos, PublicKeyType key_type)
int pack_dhparams(Octstr *data, long charpos, DHParameters *dhparams)
void dump_key_exchange_id(char *dbg, int level, KeyExchangeId *keyexid)
int pack_dh_pubkey(Octstr *data, long charpos, DHPublicKey *key)
ECPublicKey * unpack_ec_pubkey(Octstr *data, long *charpos)
WTLSCertificate * unpack_wtls_certificate(Octstr *data, long *charpos)
int pack_octstr16(Octstr *data, long charpos, Octstr *opaque)
void dump_int16(char *dbg, int level, int i)
int pack_key_list(Octstr *data, long charpos, List *key_list)
List * unpack_compression_method_list(Octstr *data, long *charpos)
int pack_ecparams(Octstr *data, long charpos, ECParameters *ecparams)
Octstr * unpack_octstr16(Octstr *data, long *charpos)
void destroy_ec_pubkey(ECPublicKey *key)
int pack_public_key(Octstr *data, long charpos, PublicKey *key, PublicKeyType key_type)
int pack_random(Octstr *data, long charpos, Random *random)
int pack_int16(Octstr *data, long charpos, int i)
void dump_ec_pubkey(char *dbg, int level, ECPublicKey *key)
int pack_rsa_pubkey(Octstr *data, long charpos, RSAPublicKey *key)
void dump_signature(char *dbg, int level, Signature *sig)
void dump_public_key(char *dbg, int level, PublicKey *key, PublicKeyType key_type)
void dump_octstr16(char *dbg, int level, Octstr *opaque)
int pack_wtls_certificate(Octstr *data, long charpos, WTLSCertificate *cert)
void dump_octstr_fixed(char *dbg, int level, Octstr *opaque)
Signature * unpack_signature(Octstr *data, long *charpos)
long unpack_int32(Octstr *data, long *charpos)
void destroy_rsa_encrypted_secret(RSAEncryptedSecret *secret)
void destroy_param_spec(ParameterSpecifier *pspec)
void dump_dhparams(char *dbg, int level, DHParameters *dhparams)
ParameterSpecifier * unpack_param_spec(Octstr *data, long *charpos)
int pack_array(Octstr *data, long charpos, List *array)
void dump_array(char *dbg, int level, List *array)
void dump_dh_pubkey(char *dbg, int level, DHPublicKey *key)
int pack_identifier(Octstr *data, long charpos, Identifier *ident)
void dump_random(char *dbg, int level, Random *random)
int pack_ciphersuite_list(Octstr *data, long charpos, List *ciphersuites)
void dump_wtls_certificate(char *dbg, int level, WTLSCertificate *cert)
void destroy_array(List *array)
int pack_rsa_secret(Octstr *data, long charpos, RSASecret *secret)
void dump_int32(char *dbg, int level, long i)
ECParameters * unpack_ecparams(Octstr *data, long *charpos)
int pack_signature(Octstr *data, long charpos, Signature *sig)
int unpack_int16(Octstr *data, long *charpos)
Random * unpack_random(Octstr *data, long *charpos)
DHParameters * unpack_dhparams(Octstr *data, long *charpos)
Octstr * unpack_octstr(Octstr *data, long *charpos)
void dump_key_list(char *dbg, int level, List *key_list)
void dump_param_spec(char *dbg, int level, ParameterSpecifier *pspec)
List * unpack_key_list(Octstr *data, long *charpos)
void dump_ecparams(char *dbg, int level, ECParameters *ecparams)
void destroy_identifier(Identifier *ident)
void destroy_dh_pubkey(DHPublicKey *key)
KeyExchangeId * unpack_key_exchange_id(Octstr *data, long *charpos)
RSAEncryptedSecret * unpack_rsa_encrypted_secret(Octstr *data, long *charpos)
int pack_rsa_encrypted_secret(Octstr *data, long charpos, RSAEncryptedSecret *secret)
void dump_octstr(char *dbg, int level, Octstr *opaque)
int pack_compression_method_list(Octstr *data, long charpos, List *compmethod_list)
Definition: octstr.c:118
void destroy_key_list(List *key_list)
DHPublicKey * unpack_dh_pubkey(Octstr *data, long *charpos)
int pack_octstr_fixed(Octstr *data, long charpos, Octstr *opaque)
void destroy_rsa_pubkey(RSAPublicKey *key)
void dump_identifier(char *dbg, int level, Identifier *ident)
void dump_rsa_encrypted_secret(char *dbg, int level, RSAEncryptedSecret *secret)
List * unpack_array(Octstr *data, long *charpos)
List * unpack_ciphersuite_list(Octstr *data, long *charpos)
void destroy_random(Random *random)
void destroy_wtls_certificate(WTLSCertificate *cert)
int pack_int32(Octstr *data, long charpos, long i)
int pack_octstr(Octstr *data, long charpos, Octstr *opaque)
Identifier * unpack_identifier(Octstr *data, long *charpos)
int pack_param_spec(Octstr *data, long charpos, ParameterSpecifier *pspec)
RSAPublicKey * unpack_rsa_pubkey(Octstr *data, long *charpos)
int pack_key_exchange_id(Octstr *data, long charpos, KeyExchangeId *keyexid)
Octstr * unpack_octstr_fixed(Octstr *data, long *charpos, long length)
void dump_rsa_secret(char *dbg, int level, RSASecret *secret)
Definition: list.c:102
int pack_ec_pubkey(Octstr *data, long charpos, ECPublicKey *key)
enum public_key_type PublicKeyType
void dump_ciphersuite_list(char *dbg, int level, List *ciphersuites)
RSASecret * unpack_rsa_secret(Octstr *data, long *charpos)
void destroy_ciphersuite_list(List *ciphersuites)
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.