Kannel: Open Source WAP and SMS gateway  svn-r5335
wsp_caps.h
Go to the documentation of this file.
1 /* ====================================================================
2  * The Kannel Software License, Version 1.0
3  *
4  * Copyright (c) 2001-2018 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 
57 /* wsp_caps.h - interface to WSP capability negotiation
58  *
59  * Richard Braakman
60  */
61 
62 #ifndef WSP_CAPS_H
63 #define WSP_CAPS_H
64 
65 #include "gwlib/gwlib.h"
66 
67 struct capability {
68  /* One or the other of these is set. id is only meaningful
69  * if name is NULL. (Unfortunately the WSP spec does not
70  * really assign names to the numeric ids, so we can't translate
71  * them all to text.) */
72  int id;
74 
75  /* Raw data for this capability. Can be NULL if there is none. */
77 
78  /* If data is NULL, this field determines if the request should
79  * be accepted or rejected. */
80  int accept;
81 };
82 
83 typedef struct capability Capability;
84 
85 /* See table 37 */
86 enum known_caps {
96 };
97 
98 /* Create a new Capability structure. For numbered capabilities (which
99  * is all of the known ones), use NULL for the name. The data may also
100  * be NULL. */
102 void wsp_cap_destroy(Capability *cap);
103 
104 void wsp_cap_dump(Capability *cap);
105 void wsp_cap_dump_list(List *caps_list);
106 
107 /* Destroy all Capabilities in a list, as well as the list itself. */
108 void wsp_cap_destroy_list(List *caps_list);
109 
110 /* Duplicate a list of Capabilities */
113 
114 /* Return a list of Capability structures */
116 
117 /* Encode a list of Capability structures according to the WSP spec */
118 Octstr *wsp_cap_pack_list(List *caps_list);
119 
120 /* Access functions. All of them return the number of requests that
121  * match the capability being searched for, and if they have an output
122  * parameter, they set it to the value of the first such request. */
123 int wsp_cap_count(List *caps_list, int id, Octstr *name);
124 int wsp_cap_get_client_sdu(List *caps_list, unsigned long *sdu);
125 int wsp_cap_get_server_sdu(List *caps_list, unsigned long *sdu);
126 int wsp_cap_get_method_mor(List *caps_list, unsigned long *mor);
127 int wsp_cap_get_push_mor(List *caps_list, unsigned long *mor);
128 
129 #endif
int id
Definition: wsp_caps.h:72
int wsp_cap_get_client_sdu(List *caps_list, unsigned long *sdu)
Definition: wsp_caps.c:288
known_caps
Definition: wsp_caps.h:86
void wsp_cap_dump_list(List *caps_list)
Definition: wsp_caps.c:106
List * wsp_cap_unpack_list(Octstr *caps)
Definition: wsp_caps.c:155
int wsp_cap_get_method_mor(List *caps_list, unsigned long *mor)
Definition: wsp_caps.c:312
Octstr * data
Definition: wsp_caps.h:76
void wsp_cap_dump(Capability *cap)
Definition: wsp_caps.c:92
void wsp_cap_destroy(Capability *cap)
Definition: wsp_caps.c:83
char * name
Definition: smsc_cimd2.c:212
int accept
Definition: wsp_caps.h:80
Octstr * wsp_cap_pack_list(List *caps_list)
Definition: wsp_caps.c:207
List * wsp_cap_duplicate_list(List *cap)
Definition: wsp_caps.c:125
Capability * wsp_cap_duplicate(Capability *cap)
Definition: wsp_caps.c:142
Definition: octstr.c:118
Capability * wsp_cap_create(int id, Octstr *name, Octstr *data)
Definition: wsp_caps.c:71
int wsp_cap_get_push_mor(List *caps_list, unsigned long *mor)
Definition: wsp_caps.c:328
Octstr * name
Definition: wsp_caps.h:73
void wsp_cap_destroy_list(List *caps_list)
Definition: wsp_caps.c:121
int wsp_cap_get_server_sdu(List *caps_list, unsigned long *sdu)
Definition: wsp_caps.c:300
Definition: list.c:102
int wsp_cap_count(List *caps_list, int id, Octstr *name)
Definition: wsp_caps.c:282
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.