You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sems/core/plug-in/sipctrl/transport.h

81 lines
2.0 KiB

/*
* $Id$
*
* Copyright (C) 2007 Raphael Coeffic
*
* This file is part of sems, a free SIP media server.
*
* sems 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
*
* For a license to use the ser software under conditions
* other than those described here, or to purchase support for this
* software, please contact iptel.org by e-mail at the following addresses:
* info@iptel.org
*
* sems 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
*/
#ifndef _transport_h_
#define _transport_h_
#include "AmThread.h"
#include <string>
using std::string;
class trans_layer;
struct sockaddr_storage;
#define SAv4(addr) \
((struct sockaddr_in*)addr)
class transport: public AmThread
{
protected:
/**
* Transaction layer pointer.
* This is used for received messages.
*/
trans_layer* tl;
public:
transport(trans_layer* tl);
virtual ~transport();
/**
* Binds the transport server to an address
* @return -1 if error(s) occured.
*/
virtual int bind(const string& address, unsigned short port)=0;
/**
* Sends a message.
* @return -1 if error(s) occured.
*/
virtual int send(const sockaddr_storage* sa, const char* msg, const int msg_len)=0;
virtual const char* get_local_ip()=0;
virtual unsigned short get_local_port()=0;
virtual void copy_local_addr(sockaddr_storage* sa)=0;
};
#endif
/** EMACS **
* Local variables:
* mode: c++
* c-basic-offset: 4
* End:
*/