Module transactionlayer

Transactionlayer.

Introduced in: 05 Feb 2004 by Fredrik Thulin <ft@it.su.se>

Behaviours: gen_server.

Authors: Fredrik Thulin (ft@it.su.se).

Description

Transactionlayer

Data Types

state()

state() = #state{}

My State

thandler()

thandler() = #thandler{}

A container record to make it clear that all communication with the transaction processes should go through this module.

Function Index

adopt_server_transaction/1 Adopt a server transaction.
adopt_server_transaction_handler/1
adopt_st_and_get_branchbase/1 Adopt a server transaction, and get it's branch.
cancel_client_transaction/3 Store the to-tag we use when sending non-2xx responses in INVITE server transactions.
change_transaction_parent/3 Change parent of a client or server transaction.
debug_show_transactions/0 Make the transaction layer log info about all it's transactions to the debug log.
from_transportlayer/2 The transport layer passes us a request it has just received.
get_branch_from_handler/1 Get the branch from a server transaction.
get_branchbase_from_handler/1 Get the branch from a server transaction, and then remove the "-UAS" suffix to get the base of the branch.
get_handler_for_request/1 Return the server transaction handler using a request.
get_my_to_tag/1 Get to tag that will we used in server transaction response.
get_pid_from_handler/1 Sometimes it is actually necessary for something besides the transaction layer to know the pid handling a transaction.
is_good_transaction/1 Check if a given argument is a thandler record() that refers to a transaction handler that is still alive.
send_challenge/4 Generate a '407 Proxy-Authenticate' or '401 WWW-Authenticate' response and hand this to a server transaction handler.
send_challenge_request/4 Locate a server transaction handler using Request, then invoke send_challenge() with the rest of our parameters.
send_proxy_response_handler/2 Ask a server transaction handler to proxy a response.
send_response_handler/3 Send a response with an empty body and no extra headers.
send_response_handler/4 Send a response with an empty body.
send_response_handler/5 Ask a server transaction handler to send a response.
send_response_request/3 Sends a response with an empty body and no extra headers.
send_response_request/4 Sends a response with an empty body.
send_response_request/5 Locate the server transaction handler using a request, and then ask the server transaction handler to send a response.
set_result/2 Set the informational result parameter of a transaction.
start_client_transaction/5 Start a new client transaction.
start_client_transaction/6 OBSOLETE There is no need to pass in a socket anymore.
start_link/0 start the transactionlayer gen_server.
store_appdata/2 Store some arbitrary data associated with this transcation for an application.
store_to_tag/2 Store the to-tag we use when sending non-2xx responses in INVITE server transactions.
terminate/2 Shutdown the server.
transaction_terminating/1

Function Details

adopt_server_transaction/1

adopt_server_transaction(Request) -> THandler | {ignore, Reason} | {error, E}

Adopt a server transaction. Adoption means that the server transaction will inform whoever is adopting it if the server transaction gets cancelled, and when it terminates.

adopt_server_transaction_handler/1

adopt_server_transaction_handler() -> term()

adopt_st_and_get_branchbase/1

adopt_st_and_get_branchbase(Request::In) -> {ok, THandler, BranchBase} | error | ignore

Adopt a server transaction, and get it's branch. This is just a helper function for applications, since this is typically what they do anyways. If you want to know for example the real reason it returns 'ignore', use the more articulate adopt_server_transaction_handler/1.

cancel_client_transaction/3

cancel_client_transaction(Pid, Reason, ExtraHeaders) -> ok | {error, E}

Store the to-tag we use when sending non-2xx responses in INVITE server transactions. We need to do this to correctly match ACK to the server transaction.

change_transaction_parent/3

change_transaction_parent(TH::Entity, From, To) -> ok | {error, Reason}

Change parent of a client or server transaction. Entity should be a thandler record for a server transaction, and a pid for a client transaction. A 'To' of 'none' is only applicable to client transactions.

debug_show_transactions/0

debug_show_transactions() -> ok

Make the transaction layer log info about all it's transactions to the debug log.

from_transportlayer/2

from_transportlayer(Request, YxaCtx) -> {pass_to_core, AppModule, NewYxaCtx} | continue

The transport layer passes us a request it has just received.

get_branch_from_handler/1

get_branch_from_handler(Thandler::TH) -> Branch | error

Get the branch from a server transaction. It is useful to get the branch from a server transaction for use in logging, and when generating branches for client transactions related to the server transaction.

get_branchbase_from_handler/1

get_branchbase_from_handler(TH) -> BranchBase | error

Get the branch from a server transaction, and then remove the "-UAS" suffix to get the base of the branch. The base can for example be used to generate unique branches that can be visually correlated to each other, by appending a sequence number.

get_handler_for_request/1

get_handler_for_request(Request) -> THandler | {error, E}

Return the server transaction handler using a request. This is the ordinary way for an application to locate the server transaction for a request it gets passed, in order to send a response or get it's branch or whatever.

get_my_to_tag/1

get_my_to_tag(TH) -> {ok, ToTag}

Get to tag that will we used in server transaction response

get_pid_from_handler/1

get_pid_from_handler(TH) -> Pid | none

Sometimes it is actually necessary for something besides the transaction layer to know the pid handling a transaction. In those cases, this function lets a caller extract the pid of a transaction handler. Note though that you should NEVER communicate with that pid directly.

is_good_transaction/1

is_good_transaction(TH) -> true | false

Check if a given argument is a thandler record() that refers to a transaction handler that is still alive.

send_challenge/4

send_challenge(TH, X2::Type, Stale, RetryAfter) -> ok

Generate a '407 Proxy-Authenticate' or '401 WWW-Authenticate' response and hand this to a server transaction handler. If given a request record() as In, first locate the real server transaction handler.

send_challenge_request/4

send_challenge_request(Request, Type, Stale, RetryAfter) -> ok | {error, E}

Locate a server transaction handler using Request, then invoke send_challenge() with the rest of our parameters.

send_proxy_response_handler/2

send_proxy_response_handler(TH, Response) -> ok | {error, E}

Ask a server transaction handler to proxy a response. When we proxy (as opposed to send) a response, we do some additional processing like removing the top Via header.

send_response_handler/3

send_response_handler(TH, Status, Reason) -> term()

Send a response with an empty body and no extra headers.

See also: send_response_handler/5.

send_response_handler/4

send_response_handler(TH, Status, Reason, ExtraHeaders) -> term()

Send a response with an empty body. @see send_response_handler/5.

send_response_handler/5

send_response_handler(TH, Status, Reason, ExtraHeaders, RBody) -> ok | {error, E}

Ask a server transaction handler to send a response.

send_response_request/3

send_response_request(Request, Status, Reason) -> term()

Sends a response with an empty body and no extra headers.

See also: send_response_request/5.

send_response_request/4

send_response_request(Request, Status, Reason, ExtraHeaders) -> term()

Sends a response with an empty body. @see send_response_request/5.

send_response_request/5

send_response_request(Request, Status, Reason, ExtraHeaders, RBody) -> none | ok | {error, E}

Locate the server transaction handler using a request, and then ask the server transaction handler to send a response. Note : If this function returns 'none' it did not find a server transasction. Should probably be changed to {error, "No server transaction found"} or similar.

set_result/2

set_result(Request, Value::ToTag) -> ok | {error, E}

Set the informational result parameter of a transaction. This 'result' value is only used for debugging/ informational purposes.

start_client_transaction/5

start_client_transaction(Request, Dst, Branch, Timeout, ReportTo) -> Pid | {error, E}

Start a new client transaction.

start_client_transaction/6

start_client_transaction(Request, SocketIn, Dst, Branch, Timeout, ReportTo) -> term()

OBSOLETE There is no need to pass in a socket anymore.

See also: start_client_transaction/5.

start_link/0

start_link() -> term()

start the transactionlayer gen_server. The transactionlayer is only registered localy (on the current node)

store_appdata/2

store_appdata(Request, Value::ToTag) -> ok | {error, E}

Store some arbitrary data associated with this transcation for an application. The YXA stack never uses this data - it is just provided as convenient storage for application writers.

store_to_tag/2

store_to_tag(Request, ToTag) -> ok | {error, E}

Store the to-tag we use when sending non-2xx responses in INVITE server transactions. We need to do this to correctly match ACK to the server transaction.

terminate/2

terminate(Reason, State) -> term()

returns: ignored by gen_server

Shutdown the server

transaction_terminating/1

transaction_terminating() -> term()


Generated by EDoc, Oct 17 2007, 16:48:19.