jabberd2  2.7.0
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 More...
 
#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. More...
 

Enumerations

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

Functions

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

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

◆ MAXLEN_JID_COMP

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

◆ MAXLEN_JID

#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

◆ jid_t

typedef struct jid_st * jid_t

◆ jid_static_buf

typedef char jid_static_buf[3 *1025]

JID static buffer.

Definition at line 77 of file jid.h.

Enumeration Type Documentation

◆ jid_part_t

enum jid_part_t
Enumerator
jid_NODE 
jid_DOMAIN 
jid_RESOURCE 

Definition at line 70 of file jid.h.

Function Documentation

◆ jid_new()

JABBERD2_API jid_t jid_new ( const char *  id,
int  len 
)

◆ jid_static()

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

◆ jid_reset()

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

clear and populate the jid with the given id.

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

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(), jid_new(), pres_deliver(), and pres_update().

◆ jid_reset_components()

JABBERD2_API jid_t jid_reset_components ( jid_t  jid,
const char *  node,
const char *  domain,
const char *  resource 
)

◆ jid_free()

JABBERD2_API void jid_free ( jid_t  jid)

◆ jid_prep()

JABBERD2_API int jid_prep ( jid_t  jid)

do string preparation on a jid

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

JABBERD2_API void jid_random_part ( jid_t  jid,
jid_part_t  part 
)

fill jid's resource with a random string

fill jid's resource with a random string

Definition at line 491 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().

◆ jid_expand()

JABBERD2_API void jid_expand ( jid_t  jid)

expands user and full if the dirty flag is set

expands user and full if the dirty flag is set

Definition at line 298 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().

◆ jid_user()

JABBERD2_API const 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

return the user or full jid.

Definition at line 338 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(), _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(), _verify_user_delete(), _verify_user_load(), aci_check(), aci_load(), check_code(), pres_in(), pres_probe(), pres_trust(), pres_update(), send_email(), sess_end(), sess_start(), sm_create(), sm_delete(), user_create(), user_delete(), user_free(), and user_load().

◆ jid_full()

JABBERD2_API const char* jid_full ( jid_t  jid)

expand and return the full

Definition at line 346 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(), _disco_items_result(), _disco_pkt_router(), _disco_pkt_sm(), _disco_pkt_sm_populate(), _disco_sessions_result(), _disco_unify_walker(), _disco_user_result(), _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(), _verify_in_sess(), 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().

◆ jid_compare_user()

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

compare two user or full jids.

Definition at line 354 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(), pres_deliver(), and pres_trust().

◆ jid_compare_full()

JABBERD2_API int jid_compare_full ( jid_t  a,
jid_t  b 
)

◆ jid_dup()

JABBERD2_API jid_t jid_dup ( jid_t  jid)

◆ jid_search()

JABBERD2_API int jid_search ( jid_t  list,
jid_t  jid 
)

list helpers

see if a jid is present in a list

list helpers

Definition at line 412 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_zap()

JABBERD2_API jid_t jid_zap ( jid_t  list,
jid_t  jid 
)

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

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

Definition at line 422 of file jid.c.

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

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

◆ jid_append()

JABBERD2_API jid_t jid_append ( jid_t  list,
jid_t  jid 
)

insert of a copy of jid into list, avoiding dups

insert of a copy of jid into list, avoiding dups

Definition at line 463 of file jid.c.

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

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