Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

wap_addr.c File Reference

#include <stdlib.h>
#include <arpa/inet.h>
#include "gwlib/gwlib.h"
#include "wap_addr.h"

Include dependency graph for wap_addr.c:

Include dependency graph

Go to the source code of this file.

Functions

WAPAddrwap_addr_create (Octstr *address, long port)
void wap_addr_destroy (WAPAddr *addr)
int wap_addr_same (WAPAddr *a, WAPAddr *b)
WAPAddrTuplewap_addr_tuple_create (Octstr *rmt_addr, long rmt_port, Octstr *lcl_addr, long lcl_port)
void wap_addr_tuple_destroy (WAPAddrTuple *tuple)
int wap_addr_tuple_same (WAPAddrTuple *a, WAPAddrTuple *b)
WAPAddrTuplewap_addr_tuple_duplicate (WAPAddrTuple *tuple)
void wap_addr_tuple_dump (WAPAddrTuple *tuple)


Function Documentation

WAPAddr* wap_addr_create Octstr address,
long  port
 

Definition at line 68 of file wap_addr.c.

References WAPAddr::address, octstr_duplicate, and octstr_get_cstr.

Referenced by wap_addr_tuple_create().

00069 {
00070     WAPAddr *addr;
00071     
00072     addr = gw_malloc(sizeof(*addr));
00073     addr->address = octstr_duplicate(address);
00074     addr->iaddr = inet_addr(octstr_get_cstr(address));
00075     addr->port = port;
00076     return addr;
00077 }

void wap_addr_destroy WAPAddr addr  ) 
 

Definition at line 80 of file wap_addr.c.

References WAPAddr::address, and octstr_destroy().

Referenced by wap_addr_tuple_destroy().

00081 {
00082     if (addr != NULL) {
00083         octstr_destroy(addr->address);
00084         gw_free(addr);
00085     }
00086 }

Here is the call graph for this function:

int wap_addr_same WAPAddr a,
WAPAddr b
 

Definition at line 89 of file wap_addr.c.

References WAPAddr::iaddr, and WAPAddr::port.

Referenced by wap_addr_tuple_same().

00090 {
00091     /* XXX which ordering gives the best heuristical performance? */
00092     return a->port == b->port && a->iaddr == b->iaddr;
00093 }

WAPAddrTuple* wap_addr_tuple_create Octstr rmt_addr,
long  rmt_port,
Octstr lcl_addr,
long  lcl_port
 

Definition at line 96 of file wap_addr.c.

References WAPAddrTuple::remote, and wap_addr_create().

Referenced by addr_tuple_change_cliport(), main(), set_addr_tuple(), wap_addr_tuple_duplicate(), and wdp_msg2event().

00098 {
00099     WAPAddrTuple *tuple;
00100     
00101     tuple = gw_malloc(sizeof(*tuple));
00102     tuple->remote = wap_addr_create(rmt_addr, rmt_port);
00103     tuple->local = wap_addr_create(lcl_addr, lcl_port);
00104     return tuple;
00105 }

Here is the call graph for this function:

void wap_addr_tuple_destroy WAPAddrTuple tuple  ) 
 

Definition at line 108 of file wap_addr.c.

References WAPAddrTuple::local, WAPAddrTuple::remote, and wap_addr_destroy().

Referenced by cache_item_destroy(), find_session_machine(), and handle_push_message().

00109 {
00110     if (tuple != NULL) {
00111     wap_addr_destroy(tuple->remote);
00112     wap_addr_destroy(tuple->local);
00113     gw_free(tuple);
00114     }
00115 }

Here is the call graph for this function:

void wap_addr_tuple_dump WAPAddrTuple tuple  ) 
 

Definition at line 137 of file wap_addr.c.

References debug(), octstr_get_cstr, WAPAddr::port, and WAPAddrTuple::remote.

00138 {
00139     debug("wap", 0, "WAPAddrTuple %p = <%s:%ld> - <%s:%ld>", 
00140       (void *) tuple,
00141       octstr_get_cstr(tuple->remote->address),
00142       tuple->remote->port,
00143       octstr_get_cstr(tuple->local->address),
00144       tuple->local->port);
00145 }

Here is the call graph for this function:

WAPAddrTuple* wap_addr_tuple_duplicate WAPAddrTuple tuple  ) 
 

Definition at line 125 of file wap_addr.c.

References WAPAddr::address, WAPAddrTuple::local, WAPAddr::port, WAPAddrTuple::remote, and wap_addr_tuple_create().

Referenced by add_tid(), create_tr_abort_ind(), create_tr_invoke_cnf(), create_tr_invoke_ind(), create_tr_result_cnf(), find_session_machine(), indicate_push_connection(), indicate_push_resume(), indicate_resume(), init_machine_create(), make_session_request(), make_unit_push_request(), method_machine_create(), pack_error(), pack_into_push_datagram(), pack_into_result_datagram(), push_machine_create(), request_unit_push(), resp_machine_create(), return_unit_reply(), send_invoke(), session_machine_create(), unpack_abort(), unpack_ack(), unpack_datagram(), unpack_invoke(), unpack_negative_ack(), unpack_result(), unpack_segmented_invoke(), wtp_pack_abort(), wtp_pack_ack(), wtp_pack_invoke(), wtp_pack_result(), wtp_pack_sar_ack(), and wtp_pack_sar_result().

00126 {
00127     if (tuple == NULL)
00128     return NULL;
00129     
00130     return wap_addr_tuple_create(tuple->remote->address,
00131                                  tuple->remote->port,
00132                  tuple->local->address,
00133                  tuple->local->port);
00134 }

Here is the call graph for this function:

int wap_addr_tuple_same WAPAddrTuple a,
WAPAddrTuple b
 

Definition at line 118 of file wap_addr.c.

References WAPAddrTuple::local, WAPAddrTuple::remote, and wap_addr_same().

Referenced by is_wanted_init_machine(), is_wanted_resp_machine(), same_client(), tid_is_cached(), and transaction_belongs_to_session().

00119 {
00120     return wap_addr_same(a->remote, b->remote) &&
00121            wap_addr_same(a->local, b->local);
00122 }

Here is the call graph for this function:

See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.