[5284] | 1 | /// ----------------------------------------*- mode: C++; -*--
|
---|
| 2 | /// @file assocdata.h
|
---|
| 3 | /// association data for signaling transport connnections
|
---|
| 4 | /// -- AssocData structure to store data of a signaling associaton
|
---|
| 5 | /// -- i.e., a socket-based signaling transport connection
|
---|
| 6 | /// ----------------------------------------------------------
|
---|
| 7 | /// $Id: assocdata.h 2872 2008-02-18 10:58:03Z bless $
|
---|
| 8 | /// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/assocdata.h $
|
---|
| 9 | // ===========================================================
|
---|
| 10 | //
|
---|
| 11 | // Copyright (C) 2005-2007, all rights reserved by
|
---|
| 12 | // - Institute of Telematics, Universitaet Karlsruhe (TH)
|
---|
| 13 | //
|
---|
| 14 | // More information and contact:
|
---|
| 15 | // https://projekte.tm.uka.de/trac/NSIS
|
---|
| 16 | //
|
---|
| 17 | // This program is free software; you can redistribute it and/or modify
|
---|
| 18 | // it under the terms of the GNU General Public License as published by
|
---|
| 19 | // the Free Software Foundation; version 2 of the License
|
---|
| 20 | //
|
---|
| 21 | // This program is distributed in the hope that it will be useful,
|
---|
| 22 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 23 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 24 | // GNU General Public License for more details.
|
---|
| 25 | //
|
---|
| 26 | // You should have received a copy of the GNU General Public License along
|
---|
| 27 | // with this program; if not, write to the Free Software Foundation, Inc.,
|
---|
| 28 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
---|
| 29 | //
|
---|
| 30 | // ===========================================================
|
---|
| 31 | #ifndef ASSOC_DATA_H
|
---|
| 32 | #define ASSOC_DATA_H
|
---|
| 33 |
|
---|
| 34 | #include "address.h"
|
---|
| 35 |
|
---|
| 36 | namespace protlib {
|
---|
| 37 |
|
---|
| 38 | /**
|
---|
| 39 | * @ingroup transport
|
---|
| 40 | * @{
|
---|
| 41 | */
|
---|
| 42 |
|
---|
| 43 | typedef int socketfd_t; ///< socket type interface
|
---|
| 44 | typedef unsigned int associd_t; /// SCTP lib interface
|
---|
| 45 |
|
---|
| 46 | /// association data, used to keep all necessary information
|
---|
| 47 | /// (socket, peer address, shutdown, touched) about a single connection
|
---|
| 48 | struct AssocData {
|
---|
| 49 | AssocData(socketfd_t socketfd,
|
---|
| 50 | const appladdress& peeraddress,
|
---|
| 51 | const appladdress& ownaddress):
|
---|
| 52 | socketfd(socketfd),
|
---|
| 53 | assoc(0),
|
---|
| 54 | peer(peeraddress),
|
---|
| 55 | ownaddr(ownaddress),
|
---|
| 56 | thread_ID(0),
|
---|
| 57 | num_of_out_streams(0),
|
---|
| 58 | shutdown(false),
|
---|
| 59 | touched(true)
|
---|
| 60 | {};
|
---|
| 61 |
|
---|
| 62 | AssocData(associd_t ass, const appladdress& ap, const appladdress& oa, uint32 streams)
|
---|
| 63 | : socketfd(0),
|
---|
| 64 | assoc(ass),
|
---|
| 65 | peer(ap),
|
---|
| 66 | ownaddr(oa),
|
---|
| 67 | thread_ID(0),
|
---|
| 68 | num_of_out_streams(streams),
|
---|
| 69 | shutdown(false),
|
---|
| 70 | touched(true)
|
---|
| 71 | {};
|
---|
| 72 |
|
---|
| 73 | AssocData(associd_t ass, const char* apstr, protocol_t proto, port_t port, uint32 streams, bool& res)
|
---|
| 74 | : socketfd(0),
|
---|
| 75 | assoc(ass),
|
---|
| 76 | peer(apstr,proto,port,&res),
|
---|
| 77 | thread_ID(0),
|
---|
| 78 | num_of_out_streams(streams),
|
---|
| 79 | shutdown(false),
|
---|
| 80 | touched(true)
|
---|
| 81 | {};
|
---|
| 82 |
|
---|
| 83 |
|
---|
| 84 | const socketfd_t socketfd; ///< socket of signaling transport connection
|
---|
| 85 | const associd_t assoc; ///< required for SCTP
|
---|
| 86 |
|
---|
| 87 | const appladdress peer; ///< address of the signaling peer
|
---|
| 88 | const appladdress ownaddr; ///< own endpoint address of the signaling connection
|
---|
| 89 |
|
---|
| 90 | pthread_t thread_ID; ///< related receiver thread
|
---|
| 91 |
|
---|
| 92 | const uint32 num_of_out_streams; ///< required for SCTP
|
---|
| 93 |
|
---|
| 94 | // shutdown: connection is being shutdown, shutdown
|
---|
| 95 | // is not complete yet
|
---|
| 96 | bool shutdown;
|
---|
| 97 | // this is required for a second changce algorithm when cleaning up unused connections
|
---|
| 98 | bool touched;
|
---|
| 99 | }; // end AssocData
|
---|
| 100 |
|
---|
| 101 | //@}
|
---|
| 102 |
|
---|
| 103 | } // end namespace protlib
|
---|
| 104 | #endif
|
---|