/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <sip.h>
#include "sip_msg.h"
#include "sip_miscdefs.h"
#include "sip_xaction.h"
#include "sip_dialog.h"
/*
*/
/*
* Needed for measuring SIP traffic counters.
*/
/*
* Needed for dialog/transaction logging.
*/
/*
*/
void
{
#ifdef __solaris__
#endif
if (outbound)
else
if (is_request) {
if (outbound)
else
switch (method) {
case INVITE:
if (outbound)
else
break;
case ACK:
if (outbound)
else
break;
case OPTIONS:
if (outbound)
else
break;
case BYE:
if (outbound)
else
break;
case CANCEL:
if (outbound)
else
break;
case REGISTER:
if (outbound)
else
break;
case REFER:
if (outbound)
else
break;
case INFO:
if (outbound)
else
break;
case SUBSCRIBE:
if (outbound)
else
break;
case NOTIFY:
if (outbound)
else
break;
case PRACK:
if (outbound)
else
break;
default:
break;
}
} else {
if (outbound)
else
if (SIP_PROVISIONAL_RESP(resp_code)) {
if (outbound)
else
} else if (SIP_OK_RESP(resp_code)) {
if (outbound)
else
} else if (SIP_REDIRECT_RESP(resp_code)) {
if (outbound)
else
} else if (SIP_REQFAIL_RESP(resp_code)) {
if (outbound)
else
} else if (SIP_SRVFAIL_RESP(resp_code)) {
if (outbound)
else
} else if (SIP_GLOBFAIL_RESP(resp_code)) {
if (outbound)
else
}
}
}
/*
* Enables Transaction logging. The flags argument controls the detail
* of logging.
*/
int
{
return (EINVAL);
if (!trans_log.sip_logging_enabled) {
}
return (0);
}
/*
* Enables dialog logging. The flags argument controls the detail
* of logging.
*/
int
{
return (EINVAL);
if (!dialog_log.sip_logging_enabled) {
}
return (0);
}
void
{
}
void
{
}
static void
{
int cnt;
}
/*
* Logs all the messages exchanged within a transaction to the transaction
* log file. Logged messages are then freed.
*/
static void
{
int count;
" *************\n");
if (sip_log->sip_msgcnt == 0)
continue;
sip_msg);
--sip_log->sip_msgcnt;
}
(void) fprintf(sip_trans_logfile,
"-----------------------------\n");
}
"*************\n");
(void) fflush(sip_trans_logfile);
}
/*
* Logs all the messages exchanged within a dialog to the dialog
* log file. Logged messages are then freed.
*/
static void
{
int count;
"*************\n");
if (sip_log->sip_msgcnt == 0)
continue;
sip_msg);
--sip_log->sip_msgcnt;
}
(void) fprintf(sip_dialog_logfile,
"-----------------------------\n");
}
"*************\n");
(void) fflush(sip_dialog_logfile);
}
/*
* Calls the appropriate function to log transaction or dialog messages.
* If this function is called because of assertion failure, then the file and
* line where the assertion failed is logged to the log file.
*/
void
{
if (type & SIP_TRANSACTION_LOG) {
if (trans_log.sip_logging_enabled) {
if (type & SIP_ASSERT_ERROR) {
}
}
} else {
if (dialog_log.sip_logging_enabled) {
if (type & SIP_ASSERT_ERROR) {
}
}
}
}
/*
* This function records the messages that are exchanged within a dialog or
* transaction. If logging is enabled the recorded messages are then dumped
* to the log file just before deleting the transaction or dialog.
*/
void
{
char *msgstr;
/*
* No need to take any locks here. Caller of this function MUST
* have already taken the transaction or dialog lock.
*/
return;
}
return;
return;
}
if (sip_log->sip_msgcnt == 0) {
} else {
}
sip_log->sip_msgcnt++;
}
/*
* Given a counter group and counter name within the group, returns the value
* associated with the counter in 'cntval'.
*/
int
{
return (EINVAL);
return (EINVAL);
return (EINVAL);
}
switch (counter) {
case SIP_TOTAL_BYTES_RCVD:
break;
case SIP_TOTAL_BYTES_SENT:
break;
case SIP_TOTAL_REQ_RCVD:
break;
case SIP_TOTAL_REQ_SENT:
break;
case SIP_TOTAL_RESP_RCVD:
break;
case SIP_TOTAL_RESP_SENT:
break;
case SIP_ACK_REQ_RCVD:
break;
case SIP_ACK_REQ_SENT:
break;
case SIP_BYE_REQ_RCVD:
break;
case SIP_BYE_REQ_SENT:
break;
case SIP_CANCEL_REQ_RCVD:
break;
case SIP_CANCEL_REQ_SENT:
break;
case SIP_INFO_REQ_RCVD:
break;
case SIP_INFO_REQ_SENT:
break;
case SIP_INVITE_REQ_RCVD:
break;
case SIP_INVITE_REQ_SENT:
break;
case SIP_NOTIFY_REQ_RCVD:
break;
case SIP_NOTIFY_REQ_SENT:
break;
case SIP_OPTIONS_REQ_RCVD:
break;
case SIP_OPTIONS_REQ_SENT:
break;
case SIP_PRACK_REQ_RCVD:
break;
case SIP_PRACK_REQ_SENT:
break;
case SIP_REFER_REQ_RCVD:
break;
case SIP_REFER_REQ_SENT:
break;
case SIP_REGISTER_REQ_RCVD:
break;
case SIP_REGISTER_REQ_SENT:
break;
case SIP_SUBSCRIBE_REQ_RCVD:
break;
case SIP_SUBSCRIBE_REQ_SENT:
break;
case SIP_UPDATE_REQ_RCVD:
break;
case SIP_UPDATE_REQ_SENT:
break;
case SIP_1XX_RESP_RCVD:
break;
case SIP_1XX_RESP_SENT:
break;
case SIP_2XX_RESP_RCVD:
break;
case SIP_2XX_RESP_SENT:
break;
case SIP_3XX_RESP_RCVD:
break;
case SIP_3XX_RESP_SENT:
break;
case SIP_4XX_RESP_RCVD:
break;
case SIP_4XX_RESP_SENT:
break;
case SIP_5XX_RESP_RCVD:
break;
case SIP_5XX_RESP_SENT:
break;
case SIP_6XX_RESP_RCVD:
break;
case SIP_6xx_RESP_SENT:
break;
case SIP_COUNTER_START_TIME:
break;
case SIP_COUNTER_STOP_TIME:
break;
default:
(void) pthread_mutex_unlock(&sip_counters.
return (EINVAL);
}
return (0);
}
/*
* Enables the SIP performance/traffic counting. Also reset's the previous
* counter values and starts counting afresh.
*/
int
{
if (group != SIP_TRAFFIC_COUNTERS)
return (EINVAL);
/* If it's not enabled, enable it and capture the start time */
if (!sip_counters.enabled) {
/* zero all the counters except for the mutex at the end */
sizeof (pthread_mutex_t));
sip_counters.stoptime = 0;
}
return (0);
}
/*
* Disables the SIP performance/traffic counting. If already disabled it just
* exits without doing anyting. It records the stop time.
*/
int
{
if (group != SIP_TRAFFIC_COUNTERS)
return (EINVAL);
if (sip_counters.enabled) {
}
return (0);
}