sip  1.12.11devel
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sip.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Sofia-SIP package
3  *
4  * Copyright (C) 2005 Nokia Corporation.
5  *
6  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24 
25 #ifndef SIP_H
26 
27 #define SIP_H
28 
38 #ifndef MSG_TYPES_H
39 #include <sofia-sip/msg_types.h>
40 #endif
41 #ifndef MSG_MIME_H
42 #include <sofia-sip/msg_mime.h>
43 #endif
44 
45 SOFIA_BEGIN_DECLS
46 
48 typedef enum {
65 } sip_method_t;
66 
67 #define SIP_METHOD(s) sip_method_unknown, #s
68 #define SIP_METHOD_ACK sip_method_ack, "ACK"
69 #define SIP_METHOD_CANCEL sip_method_cancel, "CANCEL"
70 #define SIP_METHOD_BYE sip_method_bye, "BYE"
71 #define SIP_METHOD_INVITE sip_method_invite, "INVITE"
72 #define SIP_METHOD_OPTIONS sip_method_options, "OPTIONS"
73 #define SIP_METHOD_REGISTER sip_method_register, "REGISTER"
74 #define SIP_METHOD_INFO sip_method_info, "INFO"
75 #define SIP_METHOD_PRACK sip_method_prack, "PRACK"
76 #define SIP_METHOD_UPDATE sip_method_update, "UPDATE"
77 #define SIP_METHOD_MESSAGE sip_method_message, "MESSAGE"
78 #define SIP_METHOD_SUBSCRIBE sip_method_subscribe, "SUBSCRIBE"
79 #define SIP_METHOD_NOTIFY sip_method_notify, "NOTIFY"
80 #define SIP_METHOD_REFER sip_method_refer, "REFER"
81 #define SIP_METHOD_PUBLISH sip_method_publish, "PUBLISH"
82 
84 #define SIP_NONE ((void const *)(intptr_t)-1)
85 
87 #define SIP_PROTOCOL_TAG ((void *)(uintptr_t)0x53495020) /* 'SIP ' */
88 
89 enum {
92 #define SIP_DEFAULT_PORT SIP_DEFAULT_PORT
93 
95 #define SIP_DEFAULT_SERV "5060"
96 
99 #define SIPS_DEFAULT_PORT SIPS_DEFAULT_PORT
100 
101 #define SIPS_DEFAULT_SERV "5061"
102 };
103 
106 
108 #define SIP_TIME_MAX ((sip_time_t)MSG_TIME_MAX)
109 
111 typedef struct sip_s sip_t;
112 
114 typedef union sip_header_u sip_header_t;
115 
118 #define g_value g_string
119 
122 
124 typedef msg_param_t sip_param_t;
125 
127 typedef struct sip_addr_s sip_addr_t;
128 
130 typedef msg_auth_t sip_auth_t;
131 
133 typedef struct sip_status_s sip_status_t;
138 
139 typedef struct sip_accept_s sip_accept_t;
140 typedef msg_accept_any_t sip_accept_encoding_t;
141 typedef msg_accept_any_t sip_accept_language_t;
142 typedef struct sip_allow_s sip_allow_t;
148 typedef struct sip_cseq_s sip_cseq_t;
149 typedef struct msg_generic_s sip_etag_t;
157 typedef struct sip_date_s sip_date_t;
160 typedef struct sip_addr_s sip_from_t;
164 typedef struct sip_min_se_s sip_min_se_t;
171 typedef struct sip_rack_s sip_rack_t;
172 typedef struct sip_reason_s sip_reason_t;
174 
178 
180 
184 
187 typedef struct sip_route_s sip_route_t;
188 typedef struct sip_rseq_s sip_rseq_t;
190 typedef struct sip_session_expires_s
197 typedef struct sip_addr_s sip_to_t;
200 typedef struct sip_via_s sip_via_t;
203 
204 typedef struct sip_event_s sip_event_t;
206 
207 /* RFC 3323 - @Privacy */
209 
210 /* RFC 3327 - @Path */
211 typedef struct sip_route_s sip_path_t;
212 
213 /* RFC 3329 - Security Mechanism Agreement */
217 
218 /* RFC 3608 - Service Route */
220 
221 
230 struct sip_s {
233  void *sip_user;
234  unsigned sip_size;
235  int sip_flags;
239  /* Pseudoheaders */
243  /* === Headers start here */
258  /* Caller Preferences */
288  /* RFC 3265 */
309  /* RFC 3515 */
314  /* draft-ietf-sip-session-timer */
333  /* Entity headers */
343  /* === Headers end here */
344 
350 };
351 
352 
357 {
361  char const *rq_method_name;
363  char const *rq_version;
364 };
365 
370 {
373  char const *st_version;
374  int st_status;
375  char const *st_phrase;
376 };
377 
382 {
384  sip_error_t *a_next;
385  char const *a_display;
387  msg_param_t const *a_params;
388  char const *a_comment;
390  char const *a_tag;
391 };
392 
393 #define a_user a_url->url_user
394 #define a_host a_url->url_host
395 
400 {
403  char const *ac_type;
404  char const *ac_subtype;
405  msg_param_t const *ac_params;
406  char const *ac_q;
407 };
408 
415 {
418  msg_param_t *k_items;
421 };
422 
429 {
432  msg_param_t const *ai_params;
433 };
434 
441  char const *i_id;
443 };
444 
449 {
453  msg_param_t const *ci_params;
454  char const *ci_purpose;
455 };
456 
461 {
466  char const *cs_method_name;
467 };
468 
473 {
476  char const *m_display;
478  msg_param_t const *m_params;
479  char const *m_comment;
481  char const *m_q;
482  char const *m_expires;
483 };
484 
489 {
493 };
494 
495 #if DOCUMENTATION_ONLY
496 
501 {
504  char const *c_type;
505  char const *c_subtype;
506  msg_param_t const *c_params;
507 };
508 #endif
509 
514 {
518 };
519 
524 {
528  msg_param_t const *ei_params;
529 };
530 
535 {
538  char const * o_type;
539  msg_param_t const *o_params;
540  char const *o_id;
541 };
542 
547 {
551 # define ex_time ex_date
553 };
554 
559 {
562  unsigned long mf_count;
563 };
564 
569 {
572  unsigned long me_delta;
573 };
574 
579 {
585  char const *ra_method_name;
586 };
587 
592 {
595  char const *r_display;
597  msg_param_t const *r_params;
598 };
599 
604 {
607  char const *b_display;
609  msg_param_t const *b_params;
610  char const *b_cid;
611 };
612 
613 
618 {
621  char const *rp_call_id;
622  msg_param_t const *rp_params;
623  char const *rp_to_tag;
624  char const *rp_from_tag;
625  unsigned rp_early_only;
626 };
627 
628 
636  char const *af_comment;
637  msg_param_t const *af_params;
638  char const *af_duration;
639 };
640 
645 {
648  msg_param_t *rd_items;
649 };
650 
655 {
658  msg_param_t const *cp_params;
659  char const *cp_q;
660  unsigned cp_require :1;
661  unsigned cp_explicit :1;
662 };
663 
668 {
671  char const *re_protocol;
672  msg_param_t const *re_params;
673  char const *re_cause;
674  char const *re_text;
675 };
676 
681 {
684  char const *r_display;
686  msg_param_t const *r_params;
687 };
688 
693 {
696  unsigned long rs_response;
697 };
698 
703 {
706  unsigned long x_delta;
707  msg_param_t const *x_params;
708  char const *x_refresher;
710 };
711 
716 {
719  unsigned long min_delta;
720  msg_param_t const *min_params;
721 };
722 
727 {
731  char const *ss_substate;
732  msg_param_t const *ss_params;
733  char const *ss_reason;
734  char const *ss_expires;
735  char const *ss_retry_after;
736 };
737 
742 {
745  char const *ts_stamp;
746  char const *ts_delay;
747 };
748 
752 struct sip_via_s
753 {
756  char const *v_protocol;
757  char const *v_host;
758  char const *v_port;
759  msg_param_t const *v_params;
760  char const *v_comment;
761  char const *v_ttl;
762  char const *v_maddr;
763  char const *v_received;
764  char const *v_branch;
765  char const *v_rport;
766  char const *v_comp;
767 };
768 
774 {
777  *sa_next;
778  char const *sa_mec;
779  msg_param_t const *sa_params;
780  char const *sa_q;
781  char const *sa_d_alg;
782  char const *sa_d_qop;
783  char const *sa_d_ver;
784 };
785 
790 {
793  msg_param_t const *priv_values;
794 };
795 
796 /* union representing any SIP header
797  * these are arrays of size 1 for easy casting
798  */
799 union sip_header_u
800 {
801  sip_common_t sh_common[1];
802  struct
803  {
804  sip_common_t shn_common;
805  sip_header_t *shn_next;
806  } sh_header_next[1];
807 #define sh_next sh_header_next->shn_next
808 #define sh_class sh_common->h_class
809 #define sh_succ sh_common->h_succ
810 #define sh_prev sh_common->h_prev
811 #define sh_data sh_common->h_data
812 #define sh_len sh_common->h_len
813 
814  sip_addr_t sh_addr[1];
815  sip_auth_t sh_auth[1];
816  sip_generic_t sh_generic[1];
817 
818  sip_request_t sh_request[1];
819  sip_status_t sh_status[1];
820 
821  sip_error_t sh_error[1];
822 
823  sip_via_t sh_via[1];
824  sip_route_t sh_route[1];
825  sip_record_route_t sh_record_route[1];
826  sip_max_forwards_t sh_max_forwards[1];
827 
828  sip_from_t sh_from[1];
829  sip_to_t sh_to[1];
830  sip_contact_t sh_contact[1];
831  sip_call_id_t sh_call_id[1];
832  sip_cseq_t sh_cseq[1];
833  sip_rseq_t sh_rseq[1];
834  sip_rack_t sh_rack[1];
835 
836  sip_subject_t sh_subject[1];
837  sip_priority_t sh_priority[1];
838 
839  sip_date_t sh_date[1];
840  sip_retry_after_t sh_retry_after[1];
841  sip_timestamp_t sh_timestamp[1];
842  sip_expires_t sh_expires[1];
843  sip_min_expires_t sh_min_expires[1];
844 
845  sip_call_info_t sh_call_info[1];
846  sip_organization_t sh_organization[1];
847  sip_server_t sh_server[1];
848  sip_user_agent_t sh_user_agent[1];
849  sip_in_reply_to_t sh_in_reply_to[1];
850 
851  sip_accept_t sh_accept[1];
852  sip_accept_encoding_t sh_accept_encoding[1];
853  sip_accept_language_t sh_accept_language[1];
854 
855  sip_allow_t sh_allow[1];
856  sip_require_t sh_require[1];
857  sip_proxy_require_t sh_proxy_require[1];
858  sip_supported_t sh_supported[1];
859  sip_unsupported_t sh_unsupported[1];
860 
861  sip_event_t sh_event[1];
862  sip_allow_events_t sh_allow_events[1];
863  sip_subscription_state_t sh_subscription_state[1];
864 
865  sip_proxy_authenticate_t sh_proxy_authenticate[1];
866  sip_proxy_authentication_info_t sh_proxy_authentication_info[1];
867  sip_proxy_authorization_t sh_proxy_authorization[1];
868 
869  sip_authorization_t sh_authorization[1];
870  sip_www_authenticate_t sh_www_authenticate[1];
871  sip_authentication_info_t sh_authentication_info[1];
872 
873  sip_error_info_t sh_error_info[1];
874  sip_warning_t sh_warning[1];
875 
876  sip_refer_to_t sh_refer_to[1];
877  sip_referred_by_t sh_referred_by[1];
878  sip_replaces_t sh_replaces[1];
879 
880  /* Caller-Preferences */
881  sip_caller_prefs_t sh_caller_prefs[1];
882  sip_request_disposition_t sh_request_disposition[1];
883  sip_accept_contact_t sh_accept_contact[1];
884  sip_reject_contact_t sh_reject_contact[1];
885 
886  sip_session_expires_t sh_session_expires[1];
887  sip_min_se_t sh_min_se[1];
888 
889  sip_path_t sh_path[1];
890  sip_service_route_t sh_service_route[1];
891 
892  sip_reason_t sh_reason[1];
893 
894  sip_security_client_t sh_security_client[1];
895  sip_security_server_t sh_security_server[1];
896  sip_security_verify_t sh_security_verify[1];
897 
898  sip_privacy_t sh_privacy[1];
899 
900  sip_etag_t sh_etag[1];
901  sip_if_match_t sh_if_match[1];
902 
903  /* Entity headers */
904  sip_mime_version_t sh_mime_version[1];
905  sip_content_type_t sh_content_type[1];
906  sip_content_encoding_t sh_content_encoding[1];
907  sip_content_language_t sh_content_language[1];
908  sip_content_length_t sh_content_length[1];
909  sip_content_disposition_t sh_content_disposition[1];
910 
911  sip_unknown_t sh_unknown[1];
912 
913  sip_separator_t sh_separator[1];
914  sip_payload_t sh_payload[1];
915 };
916 
917 SOFIA_END_DECLS
918 
919 #endif /* !defined(SIP_H) */

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.