Data Structures | |
| struct | ldl_candidate |
| A structure to store a jingle candidate. More... | |
| struct | ldl_payload |
| A structure to store a jingle payload. More... | |
Defines | |
| #define | ldl_test_flag(obj, flag) ((obj)->flags & flag) |
| Test for the existance of a flag on an arbitary object. | |
| #define | ldl_set_flag(obj, flag) (obj)->flags |= (flag) |
| Set a flag on an arbitrary object. | |
| #define | ldl_clear_flag(obj, flag) (obj)->flags &= ~(flag) |
| Clear a flag on an arbitrary object. | |
| #define | ldl_set_flag_locked(obj, flag) |
| Set a flag on an arbitrary object while locked. | |
| #define | ldl_clear_flag_locked(obj, flag) apr_thread_mutex_lock(obj->flag_mutex); (obj)->flags &= ~(flag); apr_thread_mutex_unlock(obj->flag_mutex); |
| Clear a flag on an arbitrary object. | |
| #define | ldl_copy_flags(dest, src, flags) (dest)->flags &= ~(flags); (dest)->flags |= ((src)->flags & (flags)) |
| Copy flags from one arbitrary object to another. | |
| #define | ldl_strlen_zero(s) (s && *s != '\0') ? 0 : 1 |
| Test for NULL or zero length string. | |
Functions | |
| ldl_status | ldl_session_destroy (ldl_session_t **session_p) |
| Destroy a Jingle Session. | |
| char * | ldl_session_get_value (ldl_session_t *session, char *key) |
| Get a value from a session. | |
| void | ldl_session_set_value (ldl_session_t *session, char *key, char *val) |
| Set a value on a session. | |
| ldl_status | ldl_session_create (ldl_session_t **session_p, ldl_handle_t *handle, char *id, char *them, char *me) |
| Create a Jingle Session. | |
| char * | ldl_session_get_id (ldl_session_t *session) |
| get the id of a session | |
| char * | ldl_session_get_caller (ldl_session_t *session) |
| Get the caller name of a session. | |
| char * | ldl_session_get_callee (ldl_session_t *session) |
| Get the callee name of a session. | |
| void | ldl_session_set_ip (ldl_session_t *session, char *ip) |
| Set the ip of a session. | |
| char * | ldl_session_get_ip (ldl_session_t *session) |
| Get the ip of a session. | |
| void | ldl_session_set_private (ldl_session_t *session, void *private_data) |
| Set a private pointer to associate with the session. | |
| void * | ldl_session_get_private (ldl_session_t *session) |
| Get a private pointer from a session. | |
| void | ldl_session_accept_candidate (ldl_session_t *session, ldl_candidate_t *candidate) |
| Accept a candidate. | |
| void | ldl_global_set_logger (ldl_logger_t logger) |
| Set a custom logger. | |
| char * | ldl_handle_probe (ldl_handle_t *handle, char *id, char *from, char *buf, unsigned int len) |
| Perform a probe on a given id to resolve the proper Jingle Resource. | |
| char * | ldl_handle_disco (ldl_handle_t *handle, char *id, char *from, char *buf, unsigned int len) |
| Perform a discovery on a given id to resolve the proper Jingle Resource. | |
| unsigned int | ldl_session_terminate (ldl_session_t *session) |
| Signal a termination request on a given session. | |
| void * | ldl_handle_get_private (ldl_handle_t *handle) |
| Get the private data of a connection handle. | |
| void | ldl_session_send_msg (ldl_session_t *session, char *subject, char *body) |
| Send a message to a session. | |
| void | ldl_handle_send_presence (ldl_handle_t *handle, char *from, char *to, char *type, char *rpid, char *message) |
| Send a presence notification to a target. | |
| void | ldl_handle_send_vcard (ldl_handle_t *handle, char *from, char *to, char *id, char *vcard) |
| Send a vcard. | |
| void | ldl_handle_send_msg (ldl_handle_t *handle, char *from, char *to, char *subject, char *body) |
| Send a message. | |
| unsigned int | ldl_session_candidates (ldl_session_t *session, ldl_candidate_t *candidates, unsigned int clen) |
| Offer candidates to a potential session. | |
| unsigned int | ldl_session_describe (ldl_session_t *session, ldl_payload_t *payloads, unsigned int plen, ldl_description_t description) |
| Initiate or Accept a new session and provide transport options. | |
| ldl_state_t | ldl_session_get_state (ldl_session_t *session) |
| get a session's state | |
| ldl_status | ldl_session_get_candidates (ldl_session_t *session, ldl_candidate_t **candidates, unsigned int *len) |
| get the candidates | |
| ldl_status | ldl_session_get_payloads (ldl_session_t *session, ldl_payload_t **payloads, unsigned int *len) |
| get the payloads | |
| ldl_status | ldl_global_init (int debug) |
| Initilize libDingaLing. | |
| ldl_status | ldl_global_destroy (void) |
| Destroy libDingaLing. | |
| void | ldl_global_set_log_stream (FILE *log_stream) |
| Set the log stream. | |
| ldl_status | ldl_handle_init (ldl_handle_t **handle, char *login, char *password, char *server, ldl_user_flag_t flags, char *status_msg, ldl_loop_callback_t loop_callback, ldl_session_callback_t session_callback, ldl_response_callback_t response_callback, void *private_info) |
| Initilize a new libDingaLing handle. | |
| void | ldl_handle_run (ldl_handle_t *handle) |
| Run a libDingaLing handle. | |
| void | ldl_handle_stop (ldl_handle_t *handle) |
| Stop a libDingaLing handle. | |
| ldl_status | ldl_handle_destroy (ldl_handle_t **handle) |
| Destroy a libDingaLing handle. | |
| void | ldl_handle_set_log_stream (ldl_handle_t *handle, FILE *log_stream) |
| Set the log stream on a handle. | |
|
|
Clear a flag on an arbitrary object.
|
|
|
Clear a flag on an arbitrary object.
|
|
|
Copy flags from one arbitrary object to another.
|
|
|
Set a flag on an arbitrary object.
|
|
|
Value: assert(obj->flag_mutex != NULL);\ apr_thread_mutex_lock(obj->flag_mutex);\ (obj)->flags |= (flag);\ apr_thread_mutex_unlock(obj->flag_mutex);
|
|
|
Test for NULL or zero length string.
|
|
|
Test for the existance of a flag on an arbitary object.
|
|
|
Destroy libDingaLing.
01969 { 01970 if (ldl_test_flag(&globals, LDL_FLAG_INIT)) { 01971 return LDL_STATUS_FALSE; 01972 } 01973 01974 apr_pool_destroy(globals.memory_pool); 01975 ldl_clear_flag(&globals, LDL_FLAG_INIT); 01976 apr_terminate(); 01977 01978 return LDL_STATUS_SUCCESS; 01979 }
|
|
|
Initilize libDingaLing.
01941 { 01942 if (ldl_test_flag((&globals), LDL_FLAG_INIT)) { 01943 return LDL_STATUS_FALSE; 01944 } 01945 01946 if (apr_initialize() != LDL_STATUS_SUCCESS) { 01947 apr_terminate(); 01948 return LDL_STATUS_MEMERR; 01949 } 01950 01951 memset(&globals, 0, sizeof(globals)); 01952 01953 if (apr_pool_create(&globals.memory_pool, NULL) != LDL_STATUS_SUCCESS) { 01954 globals.logger(DL_LOG_DEBUG, "Could not allocate memory pool\n"); 01955 return LDL_STATUS_MEMERR; 01956 } 01957 01958 apr_thread_mutex_create(&globals.flag_mutex, APR_THREAD_MUTEX_NESTED, globals.memory_pool); 01959 globals.log_stream = stdout; 01960 globals.debug = debug; 01961 globals.id = 300; 01962 globals.logger = default_logger; 01963 ldl_set_flag_locked((&globals), LDL_FLAG_INIT); 01964 01965 return LDL_STATUS_SUCCESS; 01966 }
|
|
|
Set the log stream.
01982 { 01983 assert(ldl_test_flag(&globals, LDL_FLAG_INIT)); 01984 01985 globals.log_stream = log_stream; 01986 }
|
|
|
Set a custom logger.
|
|
|
||||||||||||||||||||||||
|
Perform a discovery on a given id to resolve the proper Jingle Resource.
01801 { 01802 iks *iq, *query, *msg; 01803 char *lid = NULL; 01804 struct ldl_buffer buffer; 01805 apr_time_t started; 01806 unsigned int elapsed; 01807 char *notice = "Call Me!"; 01808 int again = 0; 01809 unsigned int myid; 01810 char idbuf[80]; 01811 01812 myid = next_id(); 01813 snprintf(idbuf, sizeof(idbuf), "%u", myid); 01814 01815 buffer.buf = buf; 01816 buffer.len = len; 01817 buffer.hit = 0; 01818 01819 if ((iq = iks_new("iq"))) { 01820 if ((query = iks_insert(iq, "query"))) { 01821 iks_insert_attrib(iq, "type", "get"); 01822 iks_insert_attrib(iq, "to", id); 01823 iks_insert_attrib(iq,"from", from); 01824 iks_insert_attrib(iq, "id", idbuf); 01825 iks_insert_attrib(query, "xmlns", "http://jabber.org/protocol/disco#info"); 01826 } else { 01827 iks_delete(iq); 01828 globals.logger(DL_LOG_DEBUG, "Memory ERROR!\n"); 01829 return NULL; 01830 } 01831 } else { 01832 globals.logger(DL_LOG_DEBUG, "Memory ERROR!\n"); 01833 return NULL; 01834 } 01835 01836 apr_hash_set(handle->probe_hash, id, APR_HASH_KEY_STRING, &buffer); 01837 msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, id, notice); 01838 apr_queue_push(handle->queue, msg); 01839 msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, notice); 01840 apr_queue_push(handle->queue, msg); 01841 apr_queue_push(handle->queue, iq); 01842 01843 //schedule_packet(handle, next_id(), pres, LDL_RETRY); 01844 01845 started = apr_time_now(); 01846 for(;;) { 01847 elapsed = (unsigned int)((apr_time_now() - started) / 1000); 01848 if (elapsed > 5000 && ! again) { 01849 msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, id, notice); 01850 apr_queue_push(handle->queue, msg); 01851 again++; 01852 } 01853 if (elapsed > 10000) { 01854 break; 01855 } 01856 if (buffer.hit) { 01857 lid = buffer.buf; 01858 break; 01859 } 01860 ldl_yield(1000); 01861 } 01862 01863 apr_hash_set(handle->probe_hash, id, APR_HASH_KEY_STRING, NULL); 01864 return lid; 01865 }
|
|
|
Get the private data of a connection handle.
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
Initilize a new libDingaLing handle.
02003 { 02004 apr_pool_t *pool; 02005 assert(ldl_test_flag(&globals, LDL_FLAG_INIT)); 02006 *handle = NULL; 02007 02008 if ((apr_pool_create(&pool, globals.memory_pool)) != LDL_STATUS_SUCCESS) { 02009 return LDL_STATUS_MEMERR; 02010 } 02011 02012 if (!login) { 02013 globals.logger(DL_LOG_ERR, "No login supplied!\n"); 02014 return LDL_STATUS_FALSE; 02015 } 02016 02017 if (!password) { 02018 globals.logger(DL_LOG_ERR, "No password supplied!\n"); 02019 return LDL_STATUS_FALSE; 02020 } 02021 02022 02023 if ((*handle = apr_palloc(pool, sizeof(ldl_handle_t)))) { 02024 ldl_handle_t *new_handle = *handle; 02025 memset(new_handle, 0, sizeof(ldl_handle_t)); 02026 new_handle->log_stream = globals.log_stream; 02027 new_handle->login = apr_pstrdup(pool, login); 02028 new_handle->password = apr_pstrdup(pool, password); 02029 02030 if (server) { 02031 char *p; 02032 02033 new_handle->server = apr_pstrdup(pool, server); 02034 if ((p = strchr(new_handle->server, ':'))) { 02035 *p++ = '\0'; 02036 new_handle->port = (uint16_t)atoi(p); 02037 } 02038 } 02039 02040 if (status_msg) { 02041 new_handle->status_msg = apr_pstrdup(pool, status_msg); 02042 } 02043 02044 if (loop_callback) { 02045 new_handle->loop_callback = loop_callback; 02046 } 02047 02048 if (session_callback) { 02049 new_handle->session_callback = session_callback; 02050 } 02051 02052 if (response_callback) { 02053 new_handle->response_callback = response_callback; 02054 } 02055 02056 new_handle->private_info = private_info; 02057 new_handle->pool = pool; 02058 new_handle->flags |= flags; 02059 apr_queue_create(&new_handle->queue, LDL_HANDLE_QLEN, new_handle->pool); 02060 apr_queue_create(&new_handle->retry_queue, LDL_HANDLE_QLEN, new_handle->pool); 02061 new_handle->features |= IKS_STREAM_BIND|IKS_STREAM_SESSION; 02062 02063 if (new_handle->flags & LDL_FLAG_SASL_PLAIN) { 02064 new_handle->features |= IKS_STREAM_SASL_PLAIN; 02065 } else if (new_handle->flags & LDL_FLAG_SASL_MD5) { 02066 new_handle->features |= IKS_STREAM_SASL_MD5; 02067 } 02068 02069 new_handle->sessions = apr_hash_make(new_handle->pool); 02070 new_handle->retry_hash = apr_hash_make(new_handle->pool); 02071 new_handle->probe_hash = apr_hash_make(new_handle->pool); 02072 new_handle->sub_hash = apr_hash_make(new_handle->pool); 02073 apr_thread_mutex_create(&new_handle->lock, APR_THREAD_MUTEX_NESTED, new_handle->pool); 02074 apr_thread_mutex_create(&new_handle->flag_mutex, APR_THREAD_MUTEX_NESTED, new_handle->pool); 02075 02076 return LDL_STATUS_SUCCESS; 02077 } 02078 02079 return LDL_STATUS_FALSE; 02080 }
|
|
||||||||||||||||||||||||
|
Perform a probe on a given id to resolve the proper Jingle Resource.
01747 { 01748 iks *pres, *msg; 01749 char *lid = NULL; 01750 struct ldl_buffer buffer; 01751 apr_time_t started; 01752 unsigned int elapsed; 01753 char *notice = "Call Me!"; 01754 int again = 0; 01755 01756 buffer.buf = buf; 01757 buffer.len = len; 01758 buffer.hit = 0; 01759 01760 pres = iks_new("presence"); 01761 iks_insert_attrib(pres, "type", "probe"); 01762 iks_insert_attrib(pres, "from", from); 01763 iks_insert_attrib(pres, "to", id); 01764 01765 01766 apr_hash_set(handle->probe_hash, id, APR_HASH_KEY_STRING, &buffer); 01767 msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, id, notice); 01768 iks_insert_attrib(pres, "from", from); 01769 apr_queue_push(handle->queue, msg); 01770 msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, notice); 01771 apr_queue_push(handle->queue, msg); 01772 apr_queue_push(handle->queue, pres); 01773 01774 //schedule_packet(handle, next_id(), pres, LDL_RETRY); 01775 01776 started = apr_time_now(); 01777 for(;;) { 01778 elapsed = (unsigned int)((apr_time_now() - started) / 1000); 01779 if (elapsed > 5000 && ! again) { 01780 msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, id, notice); 01781 iks_insert_attrib(msg, "from", from); 01782 apr_queue_push(handle->queue, msg); 01783 again++; 01784 } 01785 if (elapsed > 10000) { 01786 break; 01787 } 01788 if (buffer.hit) { 01789 lid = buffer.buf; 01790 break; 01791 } 01792 ldl_yield(1000); 01793 } 01794 01795 apr_hash_set(handle->probe_hash, id, APR_HASH_KEY_STRING, NULL); 01796 return lid; 01797 }
|
|
|
Run a libDingaLing handle.
02083 { 02084 ldl_set_flag_locked(handle, LDL_FLAG_RUNNING); 02085 xmpp_connect(handle, handle->login, handle->password); 02086 ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING); 02087 }
|
|
||||||||||||||||||||||||
|
Send a message.
01618 { 01619 iks *msg; 01620 char *t, *e; 01621 char *bdup = NULL; 01622 int on = 0; 01623 int len = 0; 01624 assert(handle != NULL); 01625 assert(body != NULL); 01626 01627 if (strchr(body, '<')) { 01628 len = (int) strlen(body); 01629 if (!(bdup = malloc(len))) { 01630 return; 01631 } 01632 01633 memset(bdup, 0, len); 01634 01635 e = bdup; 01636 for(t = body; *t; t++) { 01637 if (*t == '<') { 01638 on = 1; 01639 } else if (*t == '>') { 01640 t++; 01641 on = 0; 01642 } 01643 01644 if (!on) { 01645 *e++ = *t; 01646 } 01647 } 01648 body = bdup; 01649 } 01650 01651 msg = iks_make_msg(IKS_TYPE_NONE, to, body); 01652 iks_insert_attrib(msg, "type", "chat"); 01653 01654 if (!from) { 01655 from = handle->login; 01656 } 01657 01658 iks_insert_attrib(msg, "from", from); 01659 01660 if (subject) { 01661 iks_insert_attrib(msg, "subject", subject); 01662 } 01663 01664 if (bdup) { 01665 free(bdup); 01666 } 01667 01668 apr_queue_push(handle->queue, msg); 01669 01670 }
|
|
||||||||||||||||||||||||||||
|
Send a presence notification to a target.
|
|
||||||||||||||||||||||||
|
Send a vcard.
01590 { 01591 iks *vxml, *iq; 01592 int e = 0; 01593 01594 if (!(vxml = iks_tree(vcard, 0, &e))) { 01595 globals.logger(DL_LOG_ERR, "Parse returned error [%d]\n", e); 01596 return; 01597 } 01598 01599 if (!(iq = iks_new("iq"))) { 01600 globals.logger(DL_LOG_ERR, "Memory Error\n"); 01601 return; 01602 } 01603 01604 iks_insert_attrib(iq, "to", to); 01605 iks_insert_attrib(iq, "xmlns", "jabber:client"); 01606 iks_insert_attrib(iq,"from", from); 01607 iks_insert_attrib(iq, "type", "result"); 01608 iks_insert_attrib(iq, "id", id); 01609 iks_insert_node(iq, vxml); 01610 01611 apr_queue_push(handle->queue, iq); 01612 01613 iks_free(vxml); 01614 01615 }
|
|
||||||||||||
|
Set the log stream on a handle.
02108 { 02109 assert(ldl_test_flag(&globals, LDL_FLAG_INIT)); 02110 02111 handle->log_stream = log_stream; 02112 }
|
|
|
Stop a libDingaLing handle.
02090 { 02091 ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING); 02092 }
|
|
||||||||||||
|
Accept a candidate.
01555 { 01556 iks *iq, *sess, *tp; 01557 unsigned int myid; 01558 char idbuf[80]; 01559 myid = next_id(); 01560 snprintf(idbuf, sizeof(idbuf), "%u", myid); 01561 01562 iq = iks_new("iq"); 01563 iks_insert_attrib(iq, "type", "set"); 01564 iks_insert_attrib(iq, "id", idbuf); 01565 iks_insert_attrib(iq, "from", session->login); 01566 iks_insert_attrib(iq, "to", session->them); 01567 sess = iks_insert (iq, "session"); 01568 iks_insert_attrib(sess, "xmlns", "http://www.google.com/session"); 01569 iks_insert_attrib(sess, "type", "transport-accept"); 01570 iks_insert_attrib(sess, "id", candidate->tid); 01571 iks_insert_attrib(sess, "xmlns", "http://www.google.com/session"); 01572 iks_insert_attrib(sess, "initiator", session->initiator ? session->initiator : session->them); 01573 tp = iks_insert (sess, "transport"); 01574 iks_insert_attrib(tp, "xmlns", "http://www.google.com/transport/p2p"); 01575 01576 apr_queue_push(session->handle->queue, iq); 01577 }
|
|
||||||||||||||||
|
Offer candidates to a potential session.
01694 { 01695 iks *iq, *sess, *tag; 01696 unsigned int x, id = 0; 01697 01698 01699 for (x = 0; x < clen; x++) { 01700 char buf[512]; 01701 iq = NULL; 01702 sess = NULL; 01703 id = 0; 01704 01705 new_session_iq(session, &iq, &sess, &id, "transport-info"); 01706 tag = iks_insert(sess, "transport"); 01707 iks_insert_attrib(tag, "xmlns", "http://www.google.com/transport/p2p"); 01708 tag = iks_insert(tag, "candidate"); 01709 01710 if (candidates[x].name) { 01711 iks_insert_attrib(tag, "name", candidates[x].name); 01712 } 01713 if (candidates[x].address) { 01714 iks_insert_attrib(tag, "address", candidates[x].address); 01715 } 01716 if (candidates[x].port) { 01717 snprintf(buf, sizeof(buf), "%u", candidates[x].port); 01718 iks_insert_attrib(tag, "port", buf); 01719 } 01720 if (candidates[x].username) { 01721 iks_insert_attrib(tag, "username", candidates[x].username); 01722 } 01723 if (candidates[x].password) { 01724 iks_insert_attrib(tag, "password", candidates[x].password); 01725 } 01726 if (candidates[x].pref) { 01727 snprintf(buf, sizeof(buf), "%0.1f", candidates[x].pref); 01728 iks_insert_attrib(tag, "preference", buf); 01729 } 01730 if (candidates[x].protocol) { 01731 iks_insert_attrib(tag, "protocol", candidates[x].protocol); 01732 } 01733 if (candidates[x].type) { 01734 iks_insert_attrib(tag, "type", candidates[x].type); 01735 } 01736 01737 iks_insert_attrib(tag, "network", "0"); 01738 iks_insert_attrib(tag, "generation", "0"); 01739 schedule_packet(session->handle, id, iq, LDL_RETRY); 01740 } 01741 01742 01743 return id; 01744 }
|
|
||||||||||||||||||||||||
|
Create a Jingle Session.
00243 { 00244 ldl_session_t *session = NULL; 00245 00246 if (!(session = apr_palloc(handle->pool, sizeof(ldl_session_t)))) { 00247 globals.logger(DL_LOG_DEBUG, "Memory ERROR!\n"); 00248 *session_p = NULL; 00249 return LDL_STATUS_MEMERR; 00250 } 00251 memset(session, 0, sizeof(ldl_session_t)); 00252 apr_pool_create(&session->pool, globals.memory_pool); 00253 session->id = apr_pstrdup(session->pool, id); 00254 session->them = apr_pstrdup(session->pool, them); 00255 00256 //if (me) { 00257 //session->initiator = apr_pstrdup(session->pool, them); 00258 //} 00259 00260 if (ldl_test_flag(handle, LDL_FLAG_COMPONENT)) { 00261 session->login = apr_pstrdup(session->pool, me); 00262 } else { 00263 session->login = apr_pstrdup(session->pool, handle->login); 00264 } 00265 00266 apr_hash_set(handle->sessions, session->id, APR_HASH_KEY_STRING, session); 00267 apr_hash_set(handle->sessions, session->them, APR_HASH_KEY_STRING, session); 00268 session->handle = handle; 00269 session->created = apr_time_now(); 00270 session->state = LDL_STATE_NEW; 00271 session->variables = apr_hash_make(session->pool); 00272 *session_p = session; 00273 00274 00275 if (globals.debug) { 00276 globals.logger(DL_LOG_DEBUG, "Created Session %s\n", id); 00277 } 00278 00279 return LDL_STATUS_SUCCESS; 00280 }
|
|
||||||||||||||||||||
|
Initiate or Accept a new session and provide transport options.
01872 { 01873 iks *iq, *sess, *tag, *payload, *tp; 01874 unsigned int x, id; 01875 01876 01877 new_session_iq(session, &iq, &sess, &id, description == LDL_DESCRIPTION_ACCEPT ? "accept" : "initiate"); 01878 tag = iks_insert(sess, "description"); 01879 iks_insert_attrib(tag, "xmlns", "http://www.google.com/session/phone"); 01880 iks_insert_attrib(tag, "xml:lang", "en"); 01881 for (x = 0; x < plen; x++) { 01882 char idbuf[80]; 01883 payload = iks_insert(tag, "payload-type"); 01884 iks_insert_attrib(payload, "xmlns", "http://www.google.com/session/phone"); 01885 01886 sprintf(idbuf, "%d", payloads[x].id); 01887 iks_insert_attrib(payload, "id", idbuf); 01888 iks_insert_attrib(payload, "name", payloads[x].name); 01889 if (payloads[x].rate) { 01890 sprintf(idbuf, "%d", payloads[x].rate); 01891 iks_insert_attrib(payload, "clockrate", idbuf); 01892 } 01893 if (payloads[x].bps) { 01894 sprintf(idbuf, "%d", payloads[x].bps); 01895 iks_insert_attrib(payload, "bitrate", idbuf); 01896 } 01897 } 01898 01899 if (description == LDL_DESCRIPTION_INITIATE) { 01900 tp = iks_insert (sess, "transport"); 01901 iks_insert_attrib(tp, "xmlns", "http://www.google.com/transport/p2p"); 01902 } 01903 01904 schedule_packet(session->handle, id, iq, LDL_RETRY); 01905 01906 return id; 01907 }
|
|
|
Destroy a Jingle Session.
00213 { 00214 ldl_session_t *session = *session_p; 00215 00216 if (session) { 00217 apr_pool_t *pool = session->pool; 00218 apr_hash_t *hash = session->handle->sessions; 00219 00220 if (globals.debug) { 00221 globals.logger(DL_LOG_DEBUG, "Destroyed Session %s\n", session->id); 00222 } 00223 00224 if (session->id) { 00225 apr_hash_set(hash, session->id, APR_HASH_KEY_STRING, NULL); 00226 } 00227 00228 if (session->them) { 00229 apr_hash_set(hash, session->them, APR_HASH_KEY_STRING, NULL); 00230 } 00231 00232 apr_pool_destroy(pool); 00233 pool = NULL; 00234 *session_p = NULL; 00235 return LDL_STATUS_SUCCESS; 00236 } 00237 00238 return LDL_STATUS_FALSE; 00239 }
|
|
|
Get the callee name of a session.
|
|
|
Get the caller name of a session.
|
|
||||||||||||||||
|
get the candidates
01915 { 01916 if (session->candidate_len) { 01917 *candidates = session->candidates; 01918 *len = session->candidate_len; 01919 return LDL_STATUS_SUCCESS; 01920 } else { 01921 *candidates = NULL; 01922 *len = 0; 01923 return LDL_STATUS_FALSE; 01924 } 01925 }
|
|
|
get the id of a session
|
|
|
Get the ip of a session.
|
|
||||||||||||||||
|
get the payloads
01928 { 01929 if (session->payload_len) { 01930 *payloads = session->payloads; 01931 *len = session->payload_len; 01932 return LDL_STATUS_SUCCESS; 01933 } else { 01934 *payloads = NULL; 01935 *len = 0; 01936 return LDL_STATUS_FALSE; 01937 } 01938 }
|
|
|
Get a private pointer from a session.
|
|
|
get a session's state
|
|
||||||||||||
|
Get a value from a session.
|
|
||||||||||||||||
|
Send a message to a session.
00208 { 00209 ldl_handle_send_msg(session->handle, session->login, session->them, subject, body); 00210 }
|
|
||||||||||||
|
Set the ip of a session.
|
|
||||||||||||
|
Set a private pointer to associate with the session.
|