summaryrefslogtreecommitdiff
path: root/protocols/ace/HTBP/HTBP_Session.inl
blob: aee8cbf4dc30ed6bfc70a24bf1beb08815e3a9d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// -*- C++ -*-
//
// $Id$

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

ACE_INLINE
void
ACE::HTBP::Session::reconnect () const
{
  if (!this->closed_ && this->proxy_addr_)
    {
      if (inbound_ &&
          inbound_->ace_stream().get_handle() == ACE_INVALID_HANDLE)
        reconnect_i (inbound_);
      if (outbound_ &&
          outbound_->ace_stream().get_handle() == ACE_INVALID_HANDLE)
        reconnect_i (outbound_);
    }
}

ACE_INLINE
void
ACE::HTBP::Session::inbound (ACE::HTBP::Channel *s)
{
  this->inbound_ = s;
}


ACE_INLINE
void
ACE::HTBP::Session::outbound (ACE::HTBP::Channel *s)
{
  this->outbound_ = s;
}

ACE_INLINE
ACE::HTBP::Channel *
ACE::HTBP::Session::inbound (void) const
{
  return this->inbound_;
}

ACE_INLINE
const ACE::HTBP::Session_Id_t&
ACE::HTBP::Session::session_id(void) const
{
  return this->session_id_;
}

// I'm wondering if this should be coupled with a map update...?
ACE_INLINE
void
ACE::HTBP::Session::session_id (ACE_UINT32 id)
{
  this->session_id_.id_ = id;
}

ACE_INLINE
const ACE_INET_Addr *
ACE::HTBP::Session::proxy_addr (void) const
{
  return this->proxy_addr_;
}

ACE_INLINE
const ACE::HTBP::Addr &
ACE::HTBP::Session::peer_addr (void) const
{
  return this->session_id_.peer_;
}

ACE_INLINE
const ACE::HTBP::Addr &
ACE::HTBP::Session::local_addr (void) const
{
  return this->session_id_.local_;
}

ACE_INLINE
void
ACE::HTBP::Session::proxy_addr (ACE_INET_Addr *pa, int destroy)
{
  if (this->destroy_proxy_addr_)
    delete this->proxy_addr_;
  this->proxy_addr_ = pa;
  this->destroy_proxy_addr_ = destroy;
}

ACE_INLINE
int
ACE::HTBP::Session::sock_flags (void) const
{
  return this->sock_flags_;
}

//---------------------------------------------------------------------------
ACE_INLINE
u_long
ACE::HTBP::Session_Id_t::hash () const
{
  return id_; // + local.hash() + peer.hash();
}

ACE_INLINE
bool
ACE::HTBP::Session_Id_t::operator ==(const ACE::HTBP::Session_Id_t &other) const
{
  return ((this->id_ == other.id_) &&
          (this->local_ == other.local_) &&
          (this->peer_ == other.peer_));
}

ACE_END_VERSIONED_NAMESPACE_DECL