Source: sctpconnectionlesssocket.h


Annotated List
Files
Globals
Hierarchy
Index
/*
 *  $Id: sctpconnectionlesssocket_h.html,v 1.2 2001/08/17 12:07:32 dreibh Exp $
 *
 * SCTP implementation according to RFC 2960.
 * Copyright (C) 1999-2001 by Thomas Dreibholz
 *
 * Realized in co-operation between Siemens AG
 * and University of Essen, Institute of Computer Networking Technology.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * There are two mailinglists available at www.sctp.de which should be used for
 * any discussion related to this implementation.
 *
 * Contact: discussion@sctp.de
 *          dreibh@exp-math.uni-essen.de
 *
 * Purpose: SCTP Connectionless Socket
 *
 */

#ifndef SCTPCONNECTIONLESSSOCKET_H
#define SCTPCONNECTIONLESSSOCKET_H


#include "tdsystem.h"
#include "sctpsocket.h"
#include "sctpassociation.h"


#include <sctp.h>
#include <multimap.h>


namespace Coral {


/**
  * This class manages a connectionless (UDP-style) SCTP socket. Internally,
  * this class automatically establishs or accepts new SCTP associations.
  *
  * @short   SCTP Connectionless Socket
  * @author  Thomas Dreibholz (dreibh@exp-math.uni-essen.de)
  * @version 1.0
  */
class SCTPConnectionlessSocket : public SCTPSocket
{
   // ====== Constructor/Destructor =========================================
   public:
   /**
     * Constructor.
     *
     * @param sctpWait true to wait for success of sctp_shutdown() (default); false otherwise.
     */
   SCTPConnectionlessSocket(const bool sctpWait = false);

   /**
     * Destructor.
     */
   ~SCTPConnectionlessSocket();


   // ====== SCTP Socket functions ==========================================
   /**
     * Receive data.
     *
     * @param dataBuffer Buffer to store data to.
     * @param dataBufferSize Size of data buffer; this will be overwritten with actual size of data content.
     * @param controlBuffer Buffer to store control data to.
     * @param controlBufferSize Size of control buffer; this will be overwritten with actual size of control content.
     * @param flags Flags; this will be overwritten with actual reception flags.
     * @param streamID Variable to store stream ID to.
     * @param protoID Variable to store protocol ID to.
     * @param addressArray Reference to store NULL-terminated array of peer addresses. The addresses are allocated automatically and have to be freed using deleteAddressList(). Set NULL to skip creation of the address array.
     * @param addressEntries Number of addressEntries; this will be overwritten by the sender's number of peer addresses.
     * @param status Variable to store AssocationStatus data to.
     * @return error code (0 for success).
     *
     * @see SocketAddress#deleteAddressList
     */
   int receiveFrom(char*              dataBuffer,
                   size_t&            dataBufferSize,
                   char*              controlBuffer,
                   size_t&            controlBufferSize,
                   int&               flags,
                   unsigned short&    streamID,
                   unsigned int&      protoID,
                   SocketAddress***   addressArray,
                   AssociationStatus& status);

   /**
     * Send data.
     *
     * @param buffer Data to be sent.
     * @param length Length of data to be sent.
     * @param flags Flags.
     * @param streamID Stream ID.
     * @param protoID Protocol ID.
     * @param destinationAddress Destination address.
     * @return error code (0 for success).
     */
   int sendTo(const char*          buffer,
              const size_t         length,
              const int            flags,
              const unsigned short streamID,
              const unsigned int   protoID,
              const SocketAddress& destinationAddress);


   // ====== Private data ===================================================
   private:
   multimap<unsigned int, SCTPAssociation*> OutgoingAssociationList;
};


}


#endif

Generated by: dreibh@kappes on Fri Aug 17 14:08:47 2001, using kdoc 2.0a53.