jabberd2  2.3.3
Functions
jid.c File Reference
#include "util.h"
#include <stringprep.h>

Go to the source code of this file.

Functions

static jid_t jid_reset_components_internal (jid_t jid, const char *node, const char *domain, const char *resource, int prepare)
 Forward declaration. More...
 
static int jid_prep_pieces (char *node, char *domain, char *resource)
 do stringprep on the pieces More...
 
int jid_prep (jid_t jid)
 do stringprep on the piece More...
 
jid_t jid_new (const char *id, int len)
 make a new jid More...
 
void jid_static (jid_t jid, jid_static_buf *buf)
 Make jid to use static buffer (jid data won't be allocated dynamically, but given buffer will be always used. More...
 
jid_t jid_reset (jid_t jid, const char *id, int len)
 build a jid from an id More...
 
jid_t jid_reset_components (jid_t jid, const char *node, const char *domain, const char *resource)
 build a jid from components More...
 
void jid_free (jid_t jid)
 free a jid More...
 
void jid_expand (jid_t jid)
 build user and full if they're out of date More...
 
const char * jid_user (jid_t jid)
 expand and return the user More...
 
const char * jid_full (jid_t jid)
 expand and return the full More...
 
int jid_compare_user (jid_t a, jid_t b)
 compare the user portion of two jids More...
 
int jid_compare_full (jid_t a, jid_t b)
 compare two full jids More...
 
jid_t jid_dup (jid_t jid)
 duplicate a jid More...
 
int jid_search (jid_t list, jid_t jid)
 util to search through jids More...
 
jid_t jid_zap (jid_t list, jid_t jid)
 remove a jid_t from a list, returning the new list More...
 
jid_t jid_append (jid_t list, jid_t jid)
 make a copy of jid, link into list (avoiding dups) More...
 
void jid_random_part (jid_t jid, jid_part_t part)
 create random resource More...
 

Function Documentation

static jid_t jid_reset_components_internal ( jid_t  jid,
const char *  node,
const char *  domain,
const char *  resource,
int  prepare 
)
static

Forward declaration.

build a jid from components - internal version

Definition at line 199 of file jid.c.

References jid_st::_full, jid_st::_user, jid_st::dirty, jid_st::domain, jid_st::jid_data, jid_st::jid_data_len, jid_prep(), MAXLEN_JID_COMP, jid_st::node, and jid_st::resource.

Referenced by jid_prep(), and jid_reset_components().

static int jid_prep_pieces ( char *  node,
char *  domain,
char *  resource 
)
static

do stringprep on the pieces

Definition at line 28 of file jid.c.

Referenced by jid_prep().

int jid_prep ( jid_t  jid)

do stringprep on the piece

do string preparation on a jid

Definition at line 44 of file jid.c.

References jid_st::domain, jid_prep_pieces(), jid_reset_components_internal(), MAXLEN_JID_COMP, jid_st::node, and jid_st::resource.

Referenced by jid_random_part(), jid_reset(), and jid_reset_components_internal().

jid_t jid_new ( const char *  id,
int  len 
)
void jid_static ( jid_t  jid,
jid_static_buf buf 
)

Make jid to use static buffer (jid data won't be allocated dynamically, but given buffer will be always used.

JID may not be previously used!

Definition at line 102 of file jid.c.

References jid_st::jid_data.

Referenced by _c2s_sx_sasl_callback(), _router_process_route(), and _router_sx_callback().

jid_t jid_reset ( jid_t  jid,
const char *  id,
int  len 
)

build a jid from an id

clear and populate the jid with the given id.

Definition at line 113 of file jid.c.

References jid_st::dirty, jid_st::domain, jid_st::jid_data, jid_st::jid_data_len, jid_prep(), MAXLEN_JID, jid_st::node, and jid_st::resource.

Referenced by _c2s_sx_sasl_callback(), _router_process_route(), _router_sx_callback(), and jid_new().

jid_t jid_reset_components ( jid_t  jid,
const char *  node,
const char *  domain,
const char *  resource 
)
void jid_free ( jid_t  jid)
void jid_expand ( jid_t  jid)

build user and full if they're out of date

expands user and full if the dirty flag is set

Definition at line 299 of file jid.c.

References jid_st::_full, jid_st::_user, jid_st::dirty, jid_st::domain, jid_st::node, and jid_st::resource.

Referenced by _vacation_pkt_user(), jid_compare_full(), jid_compare_user(), jid_full(), and jid_user().

const char* jid_user ( jid_t  jid)

expand and return the user

return the user or full jid.

Definition at line 339 of file jid.c.

References jid_st::_user, and jid_expand().

Referenced by _active_user_create(), _active_user_delete(), _active_user_load(), _amp_in_sess(), _announce_broadcast_user(), _announce_in_sess(), _announce_pkt_sm(), _announce_user_delete(), _authreg_register_set(), _c2s_client_sx_callback(), _c2s_component_presence(), _disco_in_sess_result(), _echo_pkt_sm(), _help_pkt_sm(), _iq_last_pkt_user(), _iq_last_sess_end(), _iq_last_user_delete(), _iq_private_in_sess(), _iq_private_user_delete(), _iq_vcard_in_sess(), _iq_vcard_pkt_user(), _iq_vcard_user_delete(), _offline_in_sess(), _offline_pkt_user(), _offline_user_delete(), _pbx_process_command(), _pep_in_sess(), _pep_out_sess(), _pres_top(), _presence_in_router(), _presence_pkt_sm(), _privacy_action(), _privacy_in_router(), _privacy_in_sess(), _privacy_out_router(), _privacy_user_delete(), _privacy_user_load(), _roster_freeuser(), _roster_in_sess_s10n(), _roster_pkt_user(), _roster_publish_save_item(), _roster_publish_user_load(), _roster_save_item(), _roster_set_item(), _roster_user_delete(), _roster_user_load(), _router_process_route(), _status_in_sess(), _status_pkt_sm(), _status_sess_end(), _status_sess_start(), _status_user_delete(), _template_roster_save_item(), _unblock_jid(), _vacation_in_sess(), _vacation_user_delete(), _vacation_user_load(), aci_check(), aci_load(), pres_in(), pres_probe(), pres_trust(), pres_update(), sess_end(), sess_start(), sm_create(), sm_delete(), user_create(), user_delete(), user_free(), and user_load().

const char* jid_full ( jid_t  jid)

expand and return the full

Definition at line 347 of file jid.c.

References jid_st::_full, and jid_expand().

Referenced by _amp_pkt_sm(), _announce_broadcast_user(), _announce_in_sess(), _announce_pkt_sm(), _authreg_auth_set(), _authreg_register_set(), _c2s_client_mio_callback(), _c2s_client_sx_callback(), _deliver_in_sess(), _disco_agents_result(), _disco_in_sess_result(), _disco_items_result(), _disco_pkt_router(), _disco_pkt_sm(), _disco_pkt_sm_populate(), _disco_sessions_result(), _disco_unify_walker(), _echo_pkt_sm(), _help_pkt_sm(), _iq_private_in_sess(), _iq_vcard_pkt_sm(), _iq_vcard_pkt_user(), _offline_in_sess(), _offline_pkt_user(), _offline_user_delete(), _pbx_process_command(), _pep_out_sess(), _pres_top(), _presence_in_sess(), _presence_pkt_sm(), _privacy_action(), _privacy_in_sess(), _privacy_result_builder(), _privacy_user_load(), _roster_in_sess_s10n(), _roster_insert_item(), _roster_pkt_user(), _roster_publish_save_item(), _roster_publish_user_load(), _roster_push(), _roster_save_item(), _roster_set_item(), _roster_user_load(), _router_process_route(), _session_in_router(), _session_pkt_router(), _sm_build_route(), _sm_generate_id(), _status_pkt_sm(), _template_roster_reload(), _template_roster_save_item(), _unblock_jid(), _vacation_pkt_user(), aci_check(), amp_build_response_pkt(), c2s_router_sx_callback(), dispatch(), module_init(), pkt_dup(), pkt_sess(), pkt_tofrom(), pres_deliver(), pres_error(), pres_in(), pres_probe(), pres_roster(), pres_trust(), pres_update(), sess_end(), sess_route(), sess_start(), sm_start(), and sm_storage_rate_limit().

int jid_compare_user ( jid_t  a,
jid_t  b 
)

compare the user portion of two jids

compare two user or full jids.

Definition at line 355 of file jid.c.

References jid_st::_user, and jid_expand().

Referenced by _amp_in_sess(), _deliver_in_sess(), _iq_private_in_sess(), _pep_in_sess(), _presence_in_sess(), and pres_trust().

int jid_compare_full ( jid_t  a,
jid_t  b 
)

compare two full jids

Definition at line 364 of file jid.c.

References jid_st::_full, and jid_expand().

Referenced by _help_pkt_sm(), _privacy_action(), _privacy_in_sess(), _unblock_jid(), jid_append(), jid_search(), jid_zap(), pres_in(), and sess_start().

jid_t jid_dup ( jid_t  jid)
int jid_search ( jid_t  list,
jid_t  jid 
)

util to search through jids

list helpers

Definition at line 413 of file jid.c.

References jid_compare_full(), and jid_st::next.

Referenced by _help_pkt_sm(), _privacy_in_sess(), _unblock_jid(), aci_check(), pres_roster(), and pres_update().

jid_t jid_zap ( jid_t  list,
jid_t  jid 
)

remove a jid_t from a list, returning the new list

remove a jid from a list, and return the new list

Definition at line 423 of file jid.c.

References jid_compare_full(), jid_free(), and jid_st::next.

Referenced by pres_deliver(), pres_error(), and pres_in().

jid_t jid_append ( jid_t  list,
jid_t  jid 
)

make a copy of jid, link into list (avoiding dups)

insert of a copy of jid into list, avoiding dups

Definition at line 464 of file jid.c.

References jid_compare_full(), jid_dup(), and jid_st::next.

Referenced by aci_load(), pres_deliver(), and pres_error().

void jid_random_part ( jid_t  jid,
jid_part_t  part 
)

create random resource

fill jid's resource with a random string

Definition at line 492 of file jid.c.

References jid_st::domain, jid_DOMAIN, jid_NODE, jid_prep(), jid_reset_components(), jid_RESOURCE, jid_st::node, jid_st::resource, and shahash_r().

Referenced by _c2s_client_sx_callback(), and _c2s_sx_sasl_callback().