jabberd2  2.6.1
mod_validate.c
Go to the documentation of this file.
1 /*
2  * jabberd - Jabber Open Source Server
3  * Copyright (c) 2002 Jeremie Miller, Thomas Muldowney,
4  * Ryan Eatmon, Robert Norris
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
19  */
20 
21 #include "sm.h"
22 
31 {
32  /* only want message, presence and iq */
33  if(!(pkt->type & pkt_MESSAGE || pkt->type & pkt_PRESENCE || pkt->type & pkt_IQ || pkt->type & pkt_S10N)) {
34  log_debug(ZONE, "we only take message, presence and iq packets");
35  return -stanza_err_BAD_REQUEST;
36  }
37 
38  return mod_PASS;
39 }
40 
42 {
43  return _validate_in_sess(mi, NULL, pkt);
44 }
45 
46 DLLEXPORT int module_init(mod_instance_t mi, const char *arg) {
47  module_t mod = mi->mod;
48 
49  if(mod->init) return 0;
50 
53 
54  return 0;
55 }
pkt_type_t type
packet type
Definition: sm.h:138
data structures and prototypes for the session manager
subscribe request
Definition: sm.h:102
static mod_ret_t _validate_in_router(mod_instance_t mi, pkt_t pkt)
Definition: mod_validate.c:41
single instance of a module in a chain
Definition: sm.h:446
int init
number of times the module intialiser has been called
Definition: sm.h:416
mod_ret_t(* in_router)(mod_instance_t mi, pkt_t pkt)
in-router handler
Definition: sm.h:424
DLLEXPORT int module_init(mod_instance_t mi, const char *arg)
Definition: mod_validate.c:46
#define DLLEXPORT
Definition: c2s.h:47
mod_ret_t(* in_sess)(mod_instance_t mi, sess_t sess, pkt_t pkt)
in-sess handler
Definition: sm.h:423
module_t mod
module that this is an instance of
Definition: sm.h:449
packet summary data wrapper
Definition: sm.h:129
#define stanza_err_BAD_REQUEST
Definition: util.h:367
#define log_debug(...)
Definition: log.h:65
info/query (get)
Definition: sm.h:106
presence
Definition: sm.h:99
packet was unhandled, should be passed to the next module
Definition: sm.h:340
There is one instance of this struct per user who is logged in to this c2s instance.
Definition: c2s.h:74
message
Definition: sm.h:95
static mod_ret_t _validate_in_sess(mod_instance_t mi, sess_t sess, pkt_t pkt)
Definition: mod_validate.c:30
#define ZONE
Definition: mio_impl.h:76
data for a single module
Definition: sm.h:403
mod_ret_t
module return values
Definition: sm.h:338