1 /* $Id$ */
2 /*
3  * Copyright (C) 2032 Teluu Inc. (http://www.teluu.com)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19 #ifndef __PJSUA2_SIPTYPES_HPP__
20 #define __PJSUA2_SIPTYPES_HPP__
21 
22 /**
23  * @file pjsua2/types.hpp
24  * @brief PJSUA2 Base Types
25  */
26 #include <pjsua2/types.hpp>
27 #include <pjsua2/persistent.hpp>
28 
29 #include <string>
30 #include <vector>
31 
32 /** PJSUA2 API is inside pj namespace */
33 namespace pj
34 {
35 
36 /**
37  * @defgroup PJSUA2_SIP_Types SIP Types
38  * @ingroup PJSUA2_DS
39  * @{
40  */
41 
42 /**
43  * Credential information. Credential contains information to authenticate
44  * against a service.
45  */
46 struct AuthCredInfo : public PersistentObject
47 {
48     /**
49      * The authentication scheme (e.g. "digest").
50      */
51     string	scheme;
52 
53     /**
54      * Realm on which this credential is to be used. Use "*" to make
55      * a credential that can be used to authenticate against any challenges.
56      */
57     string	realm;
58 
59     /**
60      * Authentication user name.
61      */
62     string	username;
63 
64     /**
65      * Type of data that is contained in the "data" field. Use 0 if the data
66      * contains plain text password.
67      */
68     int		dataType;
69 
70     /**
71      * The data, which can be a plain text password or a hashed digest.
72      */
73     string	data;
74 
75     /*
76      * Digest AKA credential information. Note that when AKA credential
77      * is being used, the \a data field of this pjsip_cred_info is
78      * not used, but it still must be initialized to an empty string.
79      * Please see PJSIP_AUTH_AKA_API for more information.
80      */
81 
82     /** Permanent subscriber key. */
83     string	akaK;
84 
85     /** Operator variant key. */
86     string	akaOp;
87 
88     /** Authentication Management Field	*/
89     string	akaAmf;
90 
91 public:
92     /** Default constructor */
93     AuthCredInfo();
94 
95     /** Construct a credential with the specified parameters */
96     AuthCredInfo(const string &scheme,
97                  const string &realm,
98                  const string &user_name,
99                  const int data_type,
100                  const string data);
101 
102     /**
103      * Read this object from a container node.
104      *
105      * @param node		Container to read values from.
106      */
107     virtual void readObject(const ContainerNode &node) PJSUA2_THROW(Error);
108 
109     /**
110      * Write this object to a container node.
111      *
112      * @param node		Container to write values to.
113      */
114     virtual void writeObject(ContainerNode &node) const PJSUA2_THROW(Error);
115 };
116 
117 
118 //////////////////////////////////////////////////////////////////////////////
119 
120 /**
121  * TLS transport settings, to be specified in TransportConfig.
122  */
123 struct TlsConfig : public PersistentObject
124 {
125     /**
126      * Certificate of Authority (CA) list file.
127      */
128     string		CaListFile;
129 
130     /**
131      * Public endpoint certificate file, which will be used as client-
132      * side  certificate for outgoing TLS connection, and server-side
133      * certificate for incoming TLS connection.
134      */
135     string		certFile;
136 
137     /**
138      * Optional private key of the endpoint certificate to be used.
139      */
140     string		privKeyFile;
141 
142     /**
143      * Password to open private key.
144      */
145     string		password;
146 
147     /**
148      * Certificate of Authority (CA) buffer. If CaListFile, certFile or
149      * privKeyFile are set, this setting will be ignored.
150      */
151     string		CaBuf;
152 
153     /**
154      * Public endpoint certificate buffer, which will be used as client-
155      * side  certificate for outgoing TLS connection, and server-side
156      * certificate for incoming TLS connection. If CaListFile, certFile or
157      * privKeyFile are set, this setting will be ignored.
158      */
159     string		certBuf;
160 
161     /**
162      * Optional private key buffer of the endpoint certificate to be used.
163      * If CaListFile, certFile or privKeyFile are set, this setting will
164      * be ignored.
165      */
166     string		privKeyBuf;
167 
168     /**
169      * TLS protocol method from #pjsip_ssl_method. In the future, this field
170      * might be deprecated in favor of <b>proto</b> field. For now, this field
171      * is only applicable only when <b>proto</b> field is set to zero.
172      *
173      * Default is PJSIP_SSL_UNSPECIFIED_METHOD (0), which in turn will
174      * use PJSIP_SSL_DEFAULT_METHOD, which default value is PJSIP_TLSV1_METHOD.
175      */
176     pjsip_ssl_method	method;
177 
178     /**
179      * TLS protocol type from #pj_ssl_sock_proto. Use this field to enable
180      * specific protocol type. Use bitwise OR operation to combine the protocol
181      * type.
182      *
183      * Default is PJSIP_SSL_DEFAULT_PROTO.
184      */
185     unsigned		proto;
186 
187     /**
188      * Ciphers and order preference. The Endpoint::utilSslGetAvailableCiphers()
189      * can be used to check the available ciphers supported by backend.
190      * If the array is empty, then default cipher list of the backend
191      * will be used.
192      */
193     IntVector		ciphers;
194 
195     /**
196      * Specifies TLS transport behavior on the server TLS certificate
197      * verification result:
198      * - If \a verifyServer is disabled, TLS transport will just notify
199      *   the application via pjsip_tp_state_callback with state
200      *   PJSIP_TP_STATE_CONNECTED regardless TLS verification result.
201      * - If \a verifyServer is enabled, TLS transport will be shutdown
202      *   and application will be notified with state
203      *   PJSIP_TP_STATE_DISCONNECTED whenever there is any TLS verification
204      *   error, otherwise PJSIP_TP_STATE_CONNECTED will be notified.
205      *
206      * In any cases, application can inspect pjsip_tls_state_info in the
207      * callback to see the verification detail.
208      *
209      * Default value is false.
210      */
211     bool		verifyServer;
212 
213     /**
214      * Specifies TLS transport behavior on the client TLS certificate
215      * verification result:
216      * - If \a verifyClient is disabled, TLS transport will just notify
217      *   the application via pjsip_tp_state_callback with state
218      *   PJSIP_TP_STATE_CONNECTED regardless TLS verification result.
219      * - If \a verifyClient is enabled, TLS transport will be shutdown
220      *   and application will be notified with state
221      *   PJSIP_TP_STATE_DISCONNECTED whenever there is any TLS verification
222      *   error, otherwise PJSIP_TP_STATE_CONNECTED will be notified.
223      *
224      * In any cases, application can inspect pjsip_tls_state_info in the
225      * callback to see the verification detail.
226      *
227      * Default value is PJ_FALSE.
228      */
229     bool		verifyClient;
230 
231     /**
232      * When acting as server (incoming TLS connections), reject incoming
233      * connection if client doesn't supply a TLS certificate.
234      *
235      * This setting corresponds to SSL_VERIFY_FAIL_IF_NO_PEER_CERT flag.
236      * Default value is PJ_FALSE.
237      */
238     bool		requireClientCert;
239 
240     /**
241      * TLS negotiation timeout to be applied for both outgoing and incoming
242      * connection, in milliseconds. If zero, the SSL negotiation doesn't
243      * have a timeout.
244      *
245      * Default: zero
246      */
247     unsigned		msecTimeout;
248 
249     /**
250      * QoS traffic type to be set on this transport. When application wants
251      * to apply QoS tagging to the transport, it's preferable to set this
252      * field rather than \a qosParam fields since this is more portable.
253      *
254      * Default value is PJ_QOS_TYPE_BEST_EFFORT.
255      */
256     pj_qos_type 	qosType;
257 
258     /**
259      * Set the low level QoS parameters to the transport. This is a lower
260      * level operation than setting the \a qosType field and may not be
261      * supported on all platforms.
262      *
263      * By default all settings in this structure are disabled.
264      */
265     pj_qos_params 	qosParams;
266 
267     /**
268      * Specify if the transport should ignore any errors when setting the QoS
269      * traffic type/parameters.
270      *
271      * Default: PJ_TRUE
272      */
273     bool		qosIgnoreError;
274 
275 public:
276     /** Default constructor initialises with default values */
277     TlsConfig();
278 
279     /** Convert to pjsip */
280     pjsip_tls_setting toPj() const;
281 
282     /** Convert from pjsip */
283     void fromPj(const pjsip_tls_setting &prm);
284 
285     /**
286      * Read this object from a container node.
287      *
288      * @param node		Container to read values from.
289      */
290     virtual void readObject(const ContainerNode &node) PJSUA2_THROW(Error);
291 
292     /**
293      * Write this object to a container node.
294      *
295      * @param node		Container to write values to.
296      */
297     virtual void writeObject(ContainerNode &node) const PJSUA2_THROW(Error);
298 };
299 
300 
301 /**
302  * Parameters to create a transport instance.
303  */
304 struct TransportConfig : public PersistentObject
305 {
306     /**
307      * UDP port number to bind locally. This setting MUST be specified
308      * even when default port is desired. If the value is zero, the
309      * transport will be bound to any available port, and application
310      * can query the port by querying the transport info.
311      */
312     unsigned		port;
313 
314     /**
315      * Specify the port range for socket binding, relative to the start
316      * port number specified in \a port. Note that this setting is only
317      * applicable when the start port number is non zero.
318      *
319      * Default value is zero.
320      */
321     unsigned		portRange;
322 
323     /**
324      * Optional address to advertise as the address of this transport.
325      * Application can specify any address or hostname for this field,
326      * for example it can point to one of the interface address in the
327      * system, or it can point to the public address of a NAT router
328      * where port mappings have been configured for the application.
329      *
330      * Note: this option can be used for both UDP and TCP as well!
331      */
332     string		publicAddress;
333 
334     /**
335      * Optional address where the socket should be bound to. This option
336      * SHOULD only be used to selectively bind the socket to particular
337      * interface (instead of 0.0.0.0), and SHOULD NOT be used to set the
338      * published address of a transport (the public_addr field should be
339      * used for that purpose).
340      *
341      * Note that unlike public_addr field, the address (or hostname) here
342      * MUST correspond to the actual interface address in the host, since
343      * this address will be specified as bind() argument.
344      */
345     string		boundAddress;
346 
347     /**
348      * This specifies TLS settings for TLS transport. It is only be used
349      * when this transport config is being used to create a SIP TLS
350      * transport.
351      */
352     TlsConfig		tlsConfig;
353 
354     /**
355      * QoS traffic type to be set on this transport. When application wants
356      * to apply QoS tagging to the transport, it's preferable to set this
357      * field rather than \a qosParam fields since this is more portable.
358      *
359      * Default is QoS not set.
360      */
361     pj_qos_type		qosType;
362 
363     /**
364      * Set the low level QoS parameters to the transport. This is a lower
365      * level operation than setting the \a qosType field and may not be
366      * supported on all platforms.
367      *
368      * Default is QoS not set.
369      */
370     pj_qos_params	qosParams;
371 
372 public:
373     /** Default constructor initialises with default values */
374     TransportConfig();
375 
376     /** Convert from pjsip */
377     void fromPj(const pjsua_transport_config &prm);
378 
379     /** Convert to pjsip */
380     pjsua_transport_config toPj() const;
381 
382     /**
383      * Read this object from a container node.
384      *
385      * @param node		Container to read values from.
386      */
387     virtual void readObject(const ContainerNode &node) PJSUA2_THROW(Error);
388 
389     /**
390      * Write this object to a container node.
391      *
392      * @param node		Container to write values to.
393      */
394     virtual void writeObject(ContainerNode &node) const PJSUA2_THROW(Error);
395 };
396 
397 /**
398  * This structure describes transport information returned by
399  * Endpoint::transportGetInfo() function.
400  */
401 struct TransportInfo
402 {
403     /** PJSUA transport identification. */
404     TransportId	    	    id;
405 
406     /** Transport type. */
407     pjsip_transport_type_e  type;
408 
409     /** Transport type name. */
410     string		    typeName;
411 
412     /** Transport string info/description. */
413     string		    info;
414 
415     /** Transport flags (see pjsip_transport_flags_e). */
416     unsigned		    flags;
417 
418     /** Local/bound address. */
419     SocketAddress	    localAddress;
420 
421     /** Published address (or transport address name). */
422     SocketAddress	    localName;
423 
424     /** Current number of objects currently referencing this transport. */
425     unsigned		    usageCount;
426 
427 public:
428     /**
429      * Default constructor.
430      */
431     TransportInfo();
432 
433     /** Construct from pjsua_transport_info */
434     void fromPj(const pjsua_transport_info &info);
435 };
436 
437 //////////////////////////////////////////////////////////////////////////////
438 
439 /**
440  * This structure describes an incoming SIP message. It corresponds to the
441  * pjsip_rx_data structure in PJSIP library.
442  */
443 struct SipRxData
444 {
445     /**
446      * A short info string describing the request, which normally contains
447      * the request method and its CSeq.
448      */
449     string		info;
450 
451     /**
452      * The whole message data as a string, containing both the header section
453      * and message body section.
454      */
455     string		wholeMsg;
456 
457     /**
458      * Source address of the message.
459      */
460     SocketAddress       srcAddress;
461 
462     /**
463      * Pointer to original pjsip_rx_data. Only valid when the struct
464      * is constructed from PJSIP's pjsip_rx_data.
465      */
466     void               *pjRxData;
467 
468 public:
469     /**
470      * Default constructor.
471      */
472     SipRxData();
473 
474     /**
475      * Construct from PJSIP's pjsip_rx_data
476      */
477     void fromPj(pjsip_rx_data &rdata);
478 };
479 
480 /**
481  * This structure describes an outgoing SIP message. It corresponds to the
482  * pjsip_tx_data structure in PJSIP library.
483  */
484 struct SipTxData
485 {
486     /**
487      * A short info string describing the request, which normally contains
488      * the request method and its CSeq.
489      */
490     string		info;
491 
492     /**
493      * The whole message data as a string, containing both the header section
494      * and message body section.
495      */
496     string		wholeMsg;
497 
498     /**
499      * Destination address of the message.
500      */
501     SocketAddress	dstAddress;
502 
503     /**
504      * Pointer to original pjsip_tx_data. Only valid when the struct
505      * is constructed from PJSIP's pjsip_tx_data.
506      */
507     void               *pjTxData;
508 
509 public:
510     /**
511      * Default constructor.
512      */
513     SipTxData();
514 
515     /**
516      * Construct from PJSIP's pjsip_tx_data
517      */
518     void fromPj(pjsip_tx_data &tdata);
519 };
520 
521 /**
522  * This structure describes SIP transaction object. It corresponds to the
523  * pjsip_transaction structure in PJSIP library.
524  */
525 struct SipTransaction
526 {
527     /* Transaction identification. */
528     pjsip_role_e        role;           /**< Role (UAS or UAC)      */
529     string              method;         /**< The method.            */
530 
531     /* State and status. */
532     int			statusCode;     /**< Last status code seen. */
533     string		statusText;     /**< Last reason phrase.    */
534     pjsip_tsx_state_e	state;          /**< State.                 */
535 
536     /* Messages and timer. */
537     SipTxData           lastTx;         /**< Msg kept for retrans.  */
538 
539     /* Original pjsip_transaction. */
540     void               *pjTransaction;  /**< pjsip_transaction.     */
541 
542 public:
543     /**
544      * Default constructor.
545      */
546     SipTransaction();
547 
548     /**
549      * Construct from PJSIP's pjsip_transaction
550      */
551     void fromPj(pjsip_transaction &tsx);
552 };
553 
554 /**
555  * This structure describes timer event.
556  */
557 struct TimerEvent
558 {
559     TimerEntry          entry;          /**< The timer entry.           */
560 };
561 
562 /**
563  * This structure describes transaction state event source.
564  */
565 struct TsxStateEventSrc
566 {
567     SipRxData       rdata;          /**< The incoming message.      */
568     SipTxData       tdata;          /**< The outgoing message.      */
569     TimerEntry      timer;          /**< The timer.                 */
570     pj_status_t     status;         /**< Transport error status.    */
571     GenericData     data;           /**< Generic data.              */
572 
TsxStateEventSrcpj::TsxStateEventSrc573     TsxStateEventSrc() : status() {}
574 };
575 
576 /**
577  * This structure describes transaction state changed event.
578  */
579 struct TsxStateEvent
580 {
581     TsxStateEventSrc    src;            /**< Event source.              */
582     SipTransaction      tsx;            /**< The transaction.           */
583     pjsip_tsx_state_e   prevState;      /**< Previous state.            */
584     pjsip_event_id_e    type;           /**< Type of event source:
585                                          *     - PJSIP_EVENT_TX_MSG
586                                          *     - PJSIP_EVENT_RX_MSG,
587                                          *     - PJSIP_EVENT_TRANSPORT_ERROR
588                                          *     - PJSIP_EVENT_TIMER
589                                          *     - PJSIP_EVENT_USER
590                                          */
591 
592     TsxStateEvent();
593 };
594 
595 /**
596  * This structure describes message transmission event.
597  */
598 struct TxMsgEvent
599 {
600     SipTxData           tdata;          /**< The transmit data buffer.  */
601 };
602 
603 /**
604  * This structure describes transmission error event.
605  */
606 struct TxErrorEvent
607 {
608     SipTxData           tdata;          /**< The transmit data.         */
609     SipTransaction      tsx;            /**< The transaction.           */
610 };
611 
612 /**
613  * This structure describes message arrival event.
614  */
615 struct RxMsgEvent
616 {
617     SipRxData           rdata;          /**< The receive data buffer.   */
618 };
619 
620 /**
621  * This structure describes user event.
622  */
623 struct UserEvent
624 {
625     GenericData         user1;          /**< User data 1.               */
626     GenericData         user2;          /**< User data 2.               */
627     GenericData         user3;          /**< User data 3.               */
628     GenericData         user4;          /**< User data 4.               */
629 };
630 
631 /**
632  * The event body.
633  */
634 struct SipEventBody
635 {
636     /**
637      * Timer event.
638      */
639     TimerEvent      timer;
640 
641     /**
642      * Transaction state has changed event.
643      */
644     TsxStateEvent   tsxState;
645 
646     /**
647      * Message transmission event.
648      */
649     TxMsgEvent      txMsg;
650 
651     /**
652      * Transmission error event.
653      */
654     TxErrorEvent    txError;
655 
656     /**
657      * Message arrival event.
658      */
659     RxMsgEvent      rxMsg;
660 
661     /**
662      * User event.
663      */
664     UserEvent       user;
665 
666 };
667 
668 /**
669  * This structure describe event descriptor to fully identify a SIP event. It
670  * corresponds to the pjsip_event structure in PJSIP library.
671  */
672 struct SipEvent
673 {
674     /**
675      * The event type, can be any value of \b pjsip_event_id_e.
676      */
677     pjsip_event_id_e    type;
678 
679     /**
680      * The event body, which fields depends on the event type.
681      */
682     SipEventBody        body;
683 
684     /**
685      * Pointer to its original pjsip_event. Only valid when the struct is
686      * constructed from PJSIP's pjsip_event.
687      */
688     void               *pjEvent;
689 
690 public:
691     /**
692      * Default constructor.
693      */
694     SipEvent();
695 
696     /**
697      * Construct from PJSIP's pjsip_event
698      */
699     void fromPj(const pjsip_event &ev);
700 };
701 
702 //////////////////////////////////////////////////////////////////////////////
703 
704 /**
705  * SIP media type containing type and subtype. For example, for
706  * "application/sdp", the type is "application" and the subtype is "sdp".
707  */
708 struct SipMediaType
709 {
710     /** Media type. */
711     string		type;
712 
713     /** Media subtype. */
714     string		subType;
715 
716 public:
717     /**
718      * Construct from PJSIP's pjsip_media_type
719      */
720     void fromPj(const pjsip_media_type &prm);
721 
722     /**
723      * Convert to PJSIP's pjsip_media_type.
724      */
725     pjsip_media_type toPj() const;
726 };
727 
728 /**
729  * Simple SIP header.
730  */
731 struct SipHeader
732 {
733     /**
734      * Header name.
735      */
736     string		hName;
737 
738     /**
739      * Header value.
740      */
741     string		hValue;
742 
743 public:
744     /**
745      * Initiaize from PJSIP header.
746      */
747     void fromPj(const pjsip_hdr *) PJSUA2_THROW(Error);
748 
749     /**
750      * Convert to PJSIP header.
751      */
752     pjsip_generic_string_hdr &toPj() const;
753 
754 private:
755     /** Interal buffer for conversion to PJSIP header */
756     mutable pjsip_generic_string_hdr	pjHdr;
757 };
758 
759 
760 /** Array of strings */
761 typedef std::vector<SipHeader> SipHeaderVector;
762 
763 /**
764  * This describes each multipart part.
765  */
766 struct SipMultipartPart
767 {
768     /**
769      * Optional headers to be put in this multipart part.
770      */
771     SipHeaderVector	headers;
772 
773     /**
774      * The MIME type of the body part of this multipart part.
775      */
776     SipMediaType	contentType;
777 
778     /**
779      * The body part of tthis multipart part.
780      */
781     string		body;
782 
783 public:
784     /**
785      * Initiaize from PJSIP's pjsip_multipart_part.
786      */
787     void fromPj(const pjsip_multipart_part &prm) PJSUA2_THROW(Error);
788 
789     /**
790      * Convert to PJSIP's pjsip_multipart_part.
791      */
792     pjsip_multipart_part& toPj() const;
793 
794 private:
795     /** Interal buffer for conversion to PJSIP pjsip_multipart_part */
796     mutable pjsip_multipart_part	pjMpp;
797     mutable pjsip_msg_body		pjMsgBody;
798 };
799 
800 /** Array of multipart parts */
801 typedef std::vector<SipMultipartPart> SipMultipartPartVector;
802 
803 /**
804  * Additional options when sending outgoing SIP message. This corresponds to
805  * pjsua_msg_data structure in PJSIP library.
806  */
807 struct SipTxOption
808 {
809     /**
810      * Optional remote target URI (i.e. Target header). If empty (""), the
811      * target will be set to the remote URI (To header). At the moment this
812      * field is only used when sending initial INVITE and MESSAGE requests.
813      */
814     string                  targetUri;
815 
816     /**
817      * Additional message headers to be included in the outgoing message.
818      */
819     SipHeaderVector         headers;
820 
821     /**
822      * MIME type of the message body, if application specifies the messageBody
823      * in this structure.
824      */
825     string                  contentType;
826 
827     /**
828      * Optional message body to be added to the message, only when the
829      * message doesn't have a body.
830      */
831     string                  msgBody;
832 
833     /**
834      * Content type of the multipart body. If application wants to send
835      * multipart message bodies, it puts the parts in multipartParts and set
836      * the content type in multipartContentType. If the message already
837      * contains a body, the body will be added to the multipart bodies.
838      */
839     SipMediaType            multipartContentType;
840 
841     /**
842      * Array of multipart parts. If application wants to send multipart
843      * message bodies, it puts the parts in \a parts and set the content
844      * type in \a multipart_ctype. If the message already contains a body,
845      * the body will be added to the multipart bodies.
846      */
847     SipMultipartPartVector  multipartParts;
848 
849 public:
850     /**
851      * Check if the options are empty. If the options are set with empty
852      * values, there will be no additional information sent with outgoing
853      * SIP message.
854      *
855      * @return              True if the options are empty.
856      */
857     bool isEmpty() const;
858 
859     /**
860      * Initiaize from PJSUA's pjsua_msg_data.
861      */
862     void fromPj(const pjsua_msg_data &prm) PJSUA2_THROW(Error);
863 
864     /**
865      * Convert to PJSUA's pjsua_msg_data.
866      */
867     void toPj(pjsua_msg_data &msg_data) const;
868 };
869 
870 //////////////////////////////////////////////////////////////////////////////
871 
872 /**
873  * This structure contains parameters for sending instance message methods,
874  * e.g: Buddy::sendInstantMessage(), Call:sendInstantMessage().
875  */
876 struct SendInstantMessageParam
877 {
878     /**
879      * MIME type. Default is "text/plain".
880      */
881     string      contentType;
882 
883     /**
884      * The message content.
885      */
886     string      content;
887 
888     /**
889      * List of headers etc to be included in outgoing request.
890      */
891     SipTxOption txOption;
892 
893     /**
894      * User data, which will be given back when the IM callback is called.
895      */
896     Token       userData;
897 
898 public:
899     /**
900      * Default constructor initializes with zero/empty values.
901      */
902     SendInstantMessageParam();
903 };
904 
905 
906 /**
907  * This structure contains parameters for sending typing indication methods,
908  * e.g: Buddy::sendTypingIndication(), Call:sendTypingIndication().
909  */
910 struct SendTypingIndicationParam
911 {
912     /**
913      * True to indicate to remote that local person is currently typing an IM.
914      */
915     bool         isTyping;
916 
917     /**
918      * List of headers etc to be included in outgoing request.
919      */
920     SipTxOption  txOption;
921 
922 public:
923     /**
924      * Default constructor initializes with zero/empty values.
925      */
926     SendTypingIndicationParam();
927 };
928 
929 
930 /* Utilities */
931 #ifndef SWIG
932 //! @cond Doxygen_Suppress
933 void readIntVector( ContainerNode &node,
934                     const string &array_name,
935                     IntVector &v) PJSUA2_THROW(Error);
936 void writeIntVector(ContainerNode &node,
937                     const string &array_name,
938                     const IntVector &v) PJSUA2_THROW(Error);
939 void readQosParams( ContainerNode &node,
940                     pj_qos_params &qos) PJSUA2_THROW(Error);
941 void writeQosParams( ContainerNode &node,
942                      const pj_qos_params &qos) PJSUA2_THROW(Error);
943 void readSipHeaders( const ContainerNode &node,
944                      const string &array_name,
945                      SipHeaderVector &headers) PJSUA2_THROW(Error);
946 void writeSipHeaders(ContainerNode &node,
947                      const string &array_name,
948                      const SipHeaderVector &headers) PJSUA2_THROW(Error);
949 //! @endcond
950 #endif // SWIG
951 
952 /**
953  * @}  PJSUA2
954  */
955 
956 } // namespace pj
957 
958 
959 
960 #endif	/* __PJSUA2_SIPTYPES_HPP__ */
961