|
|
@ -21,15 +21,55 @@
|
|
|
|
#ifndef __EJABBERDMSG_H__
|
|
|
|
#ifndef __EJABBERDMSG_H__
|
|
|
|
#define __EJABBERDMSG_H__
|
|
|
|
#define __EJABBERDMSG_H__
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* in order to avoid extensive strncmps
|
|
|
|
|
|
|
|
* that's a way faster to precalculate
|
|
|
|
|
|
|
|
* djb hash for each action.
|
|
|
|
|
|
|
|
* according to documentation there are the few ones:
|
|
|
|
|
|
|
|
* = auth:user:server:password (authentication itself)
|
|
|
|
|
|
|
|
* = isuser:user:server (check is user exist)
|
|
|
|
|
|
|
|
* = setpass:user:server:password (set new password)
|
|
|
|
|
|
|
|
* = tryregister:user:server:password (try to register a new account)
|
|
|
|
|
|
|
|
* = removeuser:user:server (remove user's account)
|
|
|
|
|
|
|
|
* = removeuser3:user:server:password (the same as above, but works with
|
|
|
|
|
|
|
|
* right password only)
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define AUTH_HASH 0x000000017C944157
|
|
|
|
|
|
|
|
#define ISUSER_HASH 0x00000653052FCFC0
|
|
|
|
|
|
|
|
#define SETPASS_HASH 0x0000D0B68C342068
|
|
|
|
|
|
|
|
#define TRYREGISTER_HASH 0xC0D7C0FAC0ED2809
|
|
|
|
|
|
|
|
#define REMOVEUSER_HASH 0x7272BF5C0AA994F2
|
|
|
|
|
|
|
|
#define REMOVEUSER3_HASH 0xC0CAAADD5FDC3365
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* type used for ejabberd action */
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
|
|
|
EJA_AUTH = 1,
|
|
|
|
|
|
|
|
EJA_ISUSER = 2,
|
|
|
|
|
|
|
|
EJA_SETPASS = 3,
|
|
|
|
|
|
|
|
EJA_TRYREGISTER = 4,
|
|
|
|
|
|
|
|
EJA_REMOVEUSER = 5,
|
|
|
|
|
|
|
|
EJA_REMOVEUSER3 = 6,
|
|
|
|
|
|
|
|
EJA_UNKNOWN = 7,
|
|
|
|
|
|
|
|
} ejabber_action_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* limits for allocation */
|
|
|
|
#define MAX_USER_LEN 256
|
|
|
|
#define MAX_USER_LEN 256
|
|
|
|
#define MAX_DOMAIN_LEN 128
|
|
|
|
#define MAX_DOMAIN_LEN 128
|
|
|
|
#define MAX_PASSWORD_LEN 128
|
|
|
|
#define MAX_PASSWORD_LEN 128
|
|
|
|
|
|
|
|
|
|
|
|
struct ejabber_msg {
|
|
|
|
struct ejabber_msg {
|
|
|
|
int action;
|
|
|
|
ejabber_action_t aev; /* message action */
|
|
|
|
char user[MAX_USER_LEN];
|
|
|
|
char *msg_data; /* all data from the message */
|
|
|
|
char domain[MAX_DOMAIN_LEN];
|
|
|
|
char *user; /* pointer to the user part */
|
|
|
|
char password[MAX_PASSWORD_LEN];
|
|
|
|
char *domain; /* pointer to the domain/server part of the message */
|
|
|
|
|
|
|
|
char *password; /* pointer to the password part of the message */
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* little helpers to avoid structure's names hunting */
|
|
|
|
|
|
|
|
#define ejabber_msg_event(c) (c)->aev
|
|
|
|
|
|
|
|
#define ejabber_msg_data(c) (c)->msg_data
|
|
|
|
|
|
|
|
#define ejabber_msg_user(c) (c)->user
|
|
|
|
|
|
|
|
#define ejabber_msg_domain(c) (c)->domain
|
|
|
|
|
|
|
|
#define ejabber_msg_password(c) (c)->password
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* __EJABBERDMSG_H__ */
|
|
|
|
#endif /* __EJABBERDMSG_H__ */
|
|
|
|