4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _SIP_XACTION_H
28 #define _SIP_XACTION_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
38 #include <sys/types.h>
41 #include "sip_miscdefs.h"
43 /* Various transaction timers */
44 typedef enum sip_timer_type_s
{
45 SIP_XACTION_TIMER_A
= 0,
55 } sip_xaction_timer_type_t
;
58 /* Increment transaction reference count */
59 #define SIP_XACTION_REFCNT_INCR(trans) \
60 (trans)->sip_xaction_ref_cnt++;
62 /* Decrement transaction reference count */
63 #define SIP_XACTION_REFCNT_DECR(trans) { \
64 (void) pthread_mutex_lock(&((trans)->sip_xaction_mutex)); \
65 assert((trans)->sip_xaction_ref_cnt > 0); \
66 (trans)->sip_xaction_ref_cnt--; \
67 if ((trans)->sip_xaction_ref_cnt == 0 && \
68 SIP_IS_XACTION_TERMINATED((trans)->sip_xaction_state)) { \
69 (void) pthread_mutex_unlock(&((trans)->sip_xaction_mutex));\
70 sip_xaction_delete(trans); \
72 (void) pthread_mutex_unlock(&((trans)->sip_xaction_mutex));\
76 /* True if transaction is in the terminated state */
77 #define SIP_IS_XACTION_TERMINATED(trans_state) \
78 ((trans_state) == SIP_CLNT_INV_TERMINATED || \
79 (trans_state) == SIP_CLNT_NONINV_TERMINATED || \
80 (trans_state) == SIP_SRV_INV_TERMINATED || \
81 (trans_state) == SIP_SRV_NONINV_TERMINATED)
83 /* Transaction structure */
84 typedef struct sip_xaction
{
85 char *sip_xaction_branch_id
; /* Transaction id */
86 uint16_t sip_xaction_hash_digest
[8];
87 _sip_msg_t
*sip_xaction_orig_msg
; /* orig request msg. */
88 _sip_msg_t
*sip_xaction_last_msg
; /* last msg sent */
89 sip_conn_object_t sip_xaction_conn_obj
;
90 int sip_xaction_state
; /* Transaction State */
91 sip_method_t sip_xaction_method
;
92 uint32_t sip_xaction_ref_cnt
;
93 pthread_mutex_t sip_xaction_mutex
;
94 sip_timer_t sip_xaction_TA
;
95 sip_timer_t sip_xaction_TB
;
96 sip_timer_t sip_xaction_TD
;
97 sip_timer_t sip_xaction_TE
;
98 sip_timer_t sip_xaction_TF
;
99 sip_timer_t sip_xaction_TG
;
100 sip_timer_t sip_xaction_TH
;
101 sip_timer_t sip_xaction_TI
;
102 sip_timer_t sip_xaction_TJ
;
103 sip_timer_t sip_xaction_TK
;
104 void *sip_xaction_ctxt
; /* currently unused */
105 int sip_xaction_msgcnt
;
106 sip_log_t sip_xaction_log
[SIP_SRV_NONINV_TERMINATED
+ 1];
109 extern void sip_xaction_init(int (*ulp_trans_err
)(sip_transaction_t
,
110 int, void *), void (*ulp_state_cb
)
111 (sip_transaction_t
, sip_msg_t
, int, int));
112 extern int sip_xaction_output(sip_conn_object_t
, sip_xaction_t
*,
114 extern int sip_xaction_input(sip_conn_object_t
, sip_xaction_t
*,
116 extern sip_xaction_t
*sip_xaction_get(sip_conn_object_t
, sip_msg_t
,
117 boolean_t
, int, int *);
118 extern void sip_xaction_delete(sip_xaction_t
*);
119 extern char *sip_get_xaction_state(int);
120 extern int (*sip_xaction_ulp_trans_err
)(sip_transaction_t
, int,
122 extern void (*sip_xaction_ulp_state_cb
)(sip_transaction_t
,
123 sip_msg_t
, int, int);
124 extern void sip_del_conn_obj_cache(sip_conn_object_t
, void *);
125 extern int sip_add_conn_obj_cache(sip_conn_object_t
, void *);
126 extern void sip_xaction_terminate(sip_xaction_t
*, _sip_msg_t
*,
132 #endif /* _SIP_XACTION_H */