2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. 2N/A * Response consists of SIP version, response code, response phrase and CRLF. 2N/A * Allocate a new sip msg struct. 2N/A * Free all resources. The lock is taken by SIP_MSG_REFCNT_DECR. The 2N/A * thread that decrements the last refcount should take care that 2N/A * the message is not accessible to other threads before doing so. 2N/A * Else, if the message is still accessible to others, it is 2N/A * possible that the other thread could be waiting to take the 2N/A * lock when we proceed to destroy it. 2N/A * Free a sip msg struct. 2N/A * Hold a sip msg struct. 2N/A * Since this is a new message, no threads should be referring 2N/A * to this, so it is not necessary to take the lock, however, 2N/A * since sip_msg_to_msgbuf() expects the lock to be held, we'll 2N/A * Return the SIP message as a string. Caller frees the string 2N/A * Given a message generate a string that includes all the headers and the 2N/A * Get the start line 2N/A * This is called just before sending the message to the transport. It 2N/A * creates the sip_msg_buf from the SIP headers. 2N/A * We could just be forwarding the message we 2N/A * We are sending a new message or a message that we received 2N/A * but have modified it. We keep the old 2N/A * msgbuf till the message is freed as some 2N/A * headers still point to it. 2N/A * We add the content-length header here, if it has not 2N/A * already been added. 2N/A * Mark the previous header as deleted. 2N/A * Once the message has been sent it can not be modified 2N/A * any furthur as we keep a pointer to it for retransmission 2N/A * Copy header values into ptr 2N/A * Add content (message body) to sip_msg 2N/A * Free the message content 2N/A * Add a response line to sip_response 2N/A * create a response based on the sip_request. 2N/A * Copies Call-ID, CSeq, From, To and Via headers from the request. 2N/A * Add response line. 2N/A * Copy To header. If To tag is present, copy it, if not then 2N/A * add one if the repsonse is not provisional. 2N/A * Copy Call-ID header. 2N/A * Copy RECORD-ROUTE header, if present. 2N/A * NON OK ACK : MUST contain values for the Call-ID, From, and Request-URI 2N/A * that are equal to the values of those header fields in the orig request 2N/A * passed to the transport. The To header field in the ACK MUST equal the To 2N/A * header field in the response being acknowledged. The ACK MUST contain the 2N/A * top Via header field of the original request. The CSeq header field in 2N/A * the ACK MUST contain the same value for the sequence number as was 2N/A * present in the original request, but the method parameter MUST be equal 2N/A * This is a 2XX ACK, for others ACK is constructed differently, 2N/A * esp. the branch id is retained. 2N/A * Get URI from the response, Contact field 2N/A * Copy Max-Forward if present 2N/A * Request-Line = Method SP Request-URI SP SIP-Version CRLF