jabberd2  2.2.17
Data Structures | Macros | Typedefs | Enumerations | Functions
jid.h File Reference

Jabber identifiers. More...

Go to the source code of this file.

Data Structures

struct  jid_st

Macros

#define MAXLEN_JID_COMP   1023 /* XMPP (RFC3920) 3.1 */
 these sizings come from xmpp-core
#define MAXLEN_JID   3071 /* nodename (1023) + '@' + domain (1023) + '/' + resource (1023) = 3071 */

Typedefs

typedef struct jid_stjid_t
typedef char jid_static_buf [3 *1025]
 JID static buffer.

Enumerations

enum  jid_part_t { jid_NODE = 1, jid_DOMAIN = 2, jid_RESOURCE = 3 }

Functions

JABBERD2_API jid_t jid_new (const unsigned char *id, int len)
 make a new jid, and call jid_reset() to populate it
JABBERD2_API 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.
JABBERD2_API jid_t jid_reset (jid_t jid, const unsigned char *id, int len)
 clear and populate the jid with the given id.
JABBERD2_API jid_t jid_reset_components (jid_t jid, const unsigned char *node, const unsigned char *domain, const unsigned char *resource)
 build a jid from components
JABBERD2_API void jid_free (jid_t jid)
 free the jid
JABBERD2_API int jid_prep (jid_t jid)
 do string preparation on a jid
JABBERD2_API void jid_random_part (jid_t jid, jid_part_t part)
 fill jid's resource with a random string
JABBERD2_API void jid_expand (jid_t jid)
 expands user and full if the dirty flag is set
JABBERD2_API const unsigned char * jid_user (jid_t jid)
 return the user or full jid.
JABBERD2_API const unsigned char * jid_full (jid_t jid)
 expand and return the full
JABBERD2_API int jid_compare_user (jid_t a, jid_t b)
 compare two user or full jids.
JABBERD2_API int jid_compare_full (jid_t a, jid_t b)
 compare two full jids
JABBERD2_API jid_t jid_dup (jid_t jid)
 duplicate a jid
JABBERD2_API int jid_search (jid_t list, jid_t jid)
 list helpers
JABBERD2_API jid_t jid_zap (jid_t list, jid_t jid)
 remove a jid from a list, and return the new list
JABBERD2_API jid_t jid_append (jid_t list, jid_t jid)
 insert of a copy of jid into list, avoiding dups

Detailed Description

Jabber identifiers.

Author:
Robert Norris
Date:
2004/05/01 00:51:10
Revision:
1.1

JID manipulation. Validity is checked via stringprep, using the "nodeprep", "nameprep" and "resourceprep" profiles (see xmpp-core section 3).

The application should fill out node, domain and resource directly, then call jid_expand(), or set the dirty flag.

Definition in file jid.h.


Macro Definition Documentation

#define MAXLEN_JID_COMP   1023 /* XMPP (RFC3920) 3.1 */

these sizings come from xmpp-core

Definition at line 39 of file jid.h.

Referenced by jid_prep(), and jid_reset_components_internal().

#define MAXLEN_JID   3071 /* nodename (1023) + '@' + domain (1023) + '/' + resource (1023) = 3071 */

Definition at line 40 of file jid.h.

Referenced by jid_reset().


Typedef Documentation

typedef struct jid_st * jid_t
typedef char jid_static_buf[3 *1025]

JID static buffer.

Definition at line 77 of file jid.h.


Enumeration Type Documentation

enum jid_part_t
Enumerator:
jid_NODE 
jid_DOMAIN 
jid_RESOURCE 

Definition at line 70 of file jid.h.


Function Documentation

JABBERD2_API jid_t jid_new ( const unsigned char *  id,
int  len 
)
JABBERD2_API 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().

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

clear and populate the jid with the given id.

if id == NULL, just clears the jid to 0

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().

JABBERD2_API jid_t jid_reset_components ( jid_t  jid,
const unsigned char *  node,
const unsigned char *  domain,
const unsigned char *  resource 
)
JABBERD2_API void jid_free ( jid_t  jid)
JABBERD2_API int jid_prep ( jid_t  jid)
JABBERD2_API void jid_random_part ( jid_t  jid,
jid_part_t  part 
)

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().

JABBERD2_API void jid_expand ( jid_t  jid)

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().

JABBERD2_API const unsigned char* jid_user ( jid_t  jid)

return the user or full jid.

these call jid_expand to make sure the user and full jid are up to date

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().

JABBERD2_API const unsigned 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().

JABBERD2_API int jid_compare_user ( jid_t  a,
jid_t  b 
)

compare two user or full jids.

these call jid_expand, then strcmp. returns 0 if they're the same, < 0 if a < b, > 0 if a > b

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().

JABBERD2_API 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().

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

list helpers

see if a jid is present in a list

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().

JABBERD2_API jid_t jid_zap ( jid_t  list,
jid_t  jid 
)

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().

JABBERD2_API jid_t jid_append ( jid_t  list,
jid_t  jid 
)

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().