Kannel: Open Source WAP and SMS gateway  $Revision: 5037 $
wap_push_ppg_pushuser.h
Go to the documentation of this file.
1 /* ====================================================================
2  * The Kannel Software License, Version 1.0
3  *
4  * Copyright (c) 2001-2016 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 /*
58  * wap_push_ppg_pushuser.h: Header of the push user module. This means
59  * currently authentication and smsc routing.
60  *
61  * Only WAP-165-PushArchOverview-19991108-a, an informal document, mentions
62  * pi authentication. (See chapter 13.) So this is definitely left for
63  * implementors.
64  * Basic authentication is defined in rfc 2617. Note that https connections
65  * are handled by our http module.
66  *
67  * By Aarno Syvšnen for Wiral Ltd and Global Networks Inc
68  */
69 
70 #ifndef WAP_PUSH_PPG_PUSHUSER_H
71 #define WAP_PUSH_PPG_PUSHUSER_H
72 
73 #include "gwlib/gwlib.h"
74 
75 /*
76  * This function initializes the module and push users data stucture, contain-
77  * ing user specific data for all push user accounts. This function MUST be
78  * called before any other functions of this module.
79  */
81  long number_of_users);
82 
83 /*
84  * This function does clean up for module shutdown. This module MUST be called
85  * when the caller of this module is shut down.
86  */
88 
89 /*
90  * This function does authentication possible before compiling the control
91  * document. This means:
92  * a) password authentication by url or by headers (it is, by basic
93  * authentication response, see rfc 2617, chapter 2)
94  * b) if this does not work, basic authentication by challenge -
95  * response
96  * c) enforcing various ip lists
97  *
98  * Check does ppg allows a connection from this at all, then try to find username
99  * and password from headers, then from url. If both fails, try basic authentica-
100  * tion. Then check does this user allow a push from this ip, then check the pass-
101  * word.
102  *
103  * For protection against brute force and partial protection for denial of serv-
104  * ice attacks, an exponential backup algorithm is used. Time when a specific ip
105  * is allowed to reconnect, is stored in Dict next_try. If an ip tries to recon-
106  * nect before this (three attemps are allowed, then exponential seconds are add-
107  * ed to the limit) we make a new challenge. We do the corresponding check before
108  * testing passwords; after all, it is an authorization failure that causes a new
109  * challenge.
110  *
111  * Rfc 2617, chapter 1 states that if we do not accept credentials of an user's,
112  * we must send a new challenge to the user.
113  *
114  * Output an authenticated username.
115  * This function should be called only when there are a push users list; the
116  * caller is responsible for this.
117  */
119  Octstr *ip, List *headers,
120  Octstr **username);
121 
122 /*
123  * This function checks phone number for allowed prefixes, black lists and
124  * white lists. Note that the phone number necessarily follows the interna-
125  * tional format (this is checked by our pap compiler).
126  */
128  Octstr *number);
129 
131  Octstr *needle, Octstr *gwlist_sep, Octstr *ip_sep);
132 
133 /*
134  * Returns smsc pushes by this user must use, or NULL when error.
135  */
137 
138 /*
139  * Returns default dlr url for this user, or NULL when error.
140  */
142 
143 /*
144  * Returns default dlr smsbox id for this user, or NULL when error.
145  */
147 #endif
int number
Definition: smsc_cimd2.c:213
static void client(int port)
Definition: test_udp.c:77
Octstr * wap_push_ppg_pushuser_smsbox_id_get(Octstr *username)
unsigned char * username
Definition: test_cimd2.c:99
static long number_of_users
Definition: wap_push_ppg.c:193
Octstr * wap_push_ppg_pushuser_dlr_url_get(Octstr *username)
int wap_push_ppg_pushuser_authenticate(HTTPClient *client, List *cgivars, Octstr *ip, List *headers, Octstr **username)
int wap_push_ppg_pushuser_search_ip_from_wildcarded_list(Octstr *haystack, Octstr *needle, Octstr *gwlist_sep, Octstr *ip_sep)
void wap_push_ppg_pushuser_list_destroy(void)
int wap_push_ppg_pushuser_client_phone_number_acceptable(Octstr *username, Octstr *number)
static long number_of_pushes
Definition: wap_push_ppg.c:191
Definition: octstr.c:118
Octstr * wap_push_ppg_pushuser_smsc_id_get(Octstr *username)
Definition: list.c:102
int wap_push_ppg_pushuser_list_add(List *l, long number_of_pushes, long number_of_users)
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.