Commit 76653f79 authored by Emmanuel Milou's avatar Emmanuel Milou

sflphone/src ready for doxygen

Comments every methods in every header
parent 27aa71bd
......@@ -86,7 +86,7 @@ incoming_message_cb (DBusGProxy *proxy,
const gchar* msg,
void * foo )
{
g_print ("Messge %s! \n",msg);
g_print ("Message %s! \n",msg);
}
......
......@@ -27,38 +27,56 @@
class VoIPLink;
/**
* @file account.h
* @brief Interface to protocol account (SIPAccount, IAXAccount)
* It can be enable on loading or activate after.
* It contains account, configuration, VoIP Link and Calls (inside the VoIPLink)
*/
typedef std::string AccountID;
#define AccountNULL ""
/** Account type: SIP / IAX2 are supported */
#define CONFIG_ACCOUNT_TYPE "Account.type"
/** Tells if account is enable or not */
#define CONFIG_ACCOUNT_ENABLE "Account.enable"
//#define CONFIG_ACCOUNT_AUTO_REGISTER "Account.autoregister"
/** Account alias */
#define CONFIG_ACCOUNT_ALIAS "Account.alias"
/** IAX paramater : full name */
#define IAX_FULL_NAME "IAX.fullName"
/** IAX paramater : host name */
#define IAX_HOST "IAX.host"
/** IAX paramater : user name */
#define IAX_USER "IAX.user"
/** IAX paramater : password */
#define IAX_PASS "IAX.pass"
/** SIP parameter : full name */
#define SIP_FULL_NAME "SIP.fullName"
/** SIP parameter : user name */
#define SIP_USER_PART "SIP.userPart"
/** SIP parameter : authorization name */
#define SIP_AUTH_NAME "SIP.username"
/** SIP parameter : password */
#define SIP_PASSWORD "SIP.password"
/** SIP parameter : host name */
#define SIP_HOST_PART "SIP.hostPart"
/** SIP parameter : proxy address */
#define SIP_PROXY "SIP.proxy"
/** SIP parameter : stun server address */
#define SIP_STUN_SERVER "STUN.server"
/** SIP parameter : tells if stun is used or not */
#define SIP_USE_STUN "STUN.enable"
/** SIP parameter : stun port */
#define SIP_STUN_PORT "STUN.port"
/**
* Class account is an interface to protocol account (SIPAccount, IAXAccount)
* It can be enable on loading or activate after.
* It contains account, configuration, VoIP Link and Calls (inside the VoIPLink)
* @author Yan Morin
*/
class Account{
public:
Account(const AccountID& accountID);
/**
* Virtual destructor
*/
virtual ~Account();
/**
......@@ -74,35 +92,32 @@ class Account{
/**
* Get the voiplink pointer
* @return the pointer or 0
* @return VoIPLink* the pointer or 0
*/
inline VoIPLink* getVoIPLink() { return _link; }
/**
* Register the underlying VoIPLink. Launch the event listener.
*
* This should update the getRegistrationState() return value.
*
* @return false is an error occurs
*/
virtual void registerVoIPLink() = 0;
/**
* Unregister the underlying VoIPLink. Stop the event listener.
*
* This should update the getRegistrationState() return value.
*
* @return false is an error occurs
*/
virtual void unregisterVoIPLink() = 0;
/**
* Tell if the account is enable or not. See doc for _enabled.
* Tell if the account is enable or not.
* @return true if enabled
* false otherwise
*/
bool isEnabled() { return _enabled; }
/**
* Return registration state of underlying VoIPLink
* Get the registration state of the specified link
* @return RegistrationState The registration state of underlying VoIPLink
*/
VoIPLink::RegistrationState getRegistrationState() { return _link->getRegistrationState(); }
......@@ -136,9 +151,7 @@ protected:
/**
* Tells if the link is enabled, active.
*
* This implies the link will be initialized on startup.
*
* Modified by the configuration (key: ENABLED)
*/
bool _enabled;
......
......@@ -25,8 +25,8 @@
class Account;
/**
* AccountCreator create Protocol-specific Account
* @author Yan Morin <yan.morin@gmail.com>
* @file accountcreator.h
* @brief Create protocol-specific account
*/
class AccountCreator{
public:
......
......@@ -26,7 +26,8 @@
#define AUDIODEVICERATE 8000
/**
* Container device for attribute storage
* @file audiodevice.c
* @brief Container device for attribute storage
* Have almost only get/set method
*/
class AudioDevice {
......
......@@ -20,37 +20,39 @@
#ifndef CALL_H
#define CALL_H
/* @file call.h
* @brief A call is the base class for protocol-based calls
*/
#include <string>
#include <cc++/thread.h> // for mutex
#include "audio/codecDescriptor.h"
/*
* @file call.h
* @brief A call is the base class for protocol-based calls
*/
typedef std::string CallID;
class Call{
public:
/**
* This determines if the call originated from the local user (Outgoing)
* or from some remote peer (Incoming).
*/
enum CallType {Incoming, Outgoing};
/**
* Tell where we're at with the call. The call gets Connected when we know
* from the other end what happened with out call. A call can be 'Connected'
* even if the call state is Busy, Refused, or Error.
*
* Audio should be transmitted when ConnectionState = Connected AND
* CallState = Active.
*/
enum ConnectionState {Disconnected, Trying, Progressing, Ringing, Connected};
/**
* The Call State.
*/
enum CallState {Inactive, Active, Hold, Busy, Refused, Error};
public:
/**
* This determines if the call originated from the local user (Outgoing)
* or from some remote peer (Incoming).
*/
enum CallType {Incoming, Outgoing};
/**
* Tell where we're at with the call. The call gets Connected when we know
* from the other end what happened with out call. A call can be 'Connected'
* even if the call state is Busy, Refused, or Error.
*
* Audio should be transmitted when ConnectionState = Connected AND
* CallState = Active.
*/
enum ConnectionState {Disconnected, Trying, Progressing, Ringing, Connected};
/**
* The Call State.
*/
enum CallState {Inactive, Active, Hold, Busy, Refused, Error};
/**
* Constructor of a call
......@@ -72,96 +74,160 @@ public:
* @param number peer number
*/
void setPeerNumber(const std::string& number) { _peerNumber = number; }
/**
* Get the peer number (destination on outgoing)
* not protected by mutex (when created)
* @return std::string The peer number
*/
const std::string& getPeerNumber() { return _peerNumber; }
/**
* Set the peer name (caller in ingoing)
* not protected by mutex (when created)
* @param number peer number
* @param name The peer name
*/
void setPeerName(const std::string& name) { _peerName = name; }
/**
* Get the peer name (caller in ingoing)
* not protected by mutex (when created)
* @return std::string The peer name
*/
const std::string& getPeerName() { return _peerName; }
/**
* Tell if the call is incoming
* @return true if yes
* false otherwise
*/
bool isIncoming() { return (_type == Incoming) ? true : false; }
/**
* Set the connection state of the call (protected by mutex)
* @param state The connection state
*/
void setConnectionState(ConnectionState state);
/**
* get the connection state of the call (protected by mutex)
* Get the connection state of the call (protected by mutex)
* @return ConnectionState The connection state
*/
ConnectionState getConnectionState();
/**
* Set the state of the call (protected by mutex)
* @param state The call state
*/
void setState(CallState state);
/**
* get the call state of the call (protected by mutex)
* Get the call state of the call (protected by mutex)
* @return CallState The call state
*/
CallState getState();
/**
* Set the audio start boolean (protected by mutex)
* @param start true if we start the audio
* false otherwise
*/
void setAudioStart(bool start);
/**
* Tell if the audio is started (protected by mutex)
* @return true if it's already started
* false otherwise
*/
bool isAudioStarted();
// AUDIO
/** Set internal codec Map: initialization only, not protected */
/**
* Set internal codec Map: initialization only, not protected
* @param map The codec map
*/
void setCodecMap(const CodecDescriptor& map) { _codecMap = map; }
/**
* Get internal codec Map: initialization only, not protected
* @return CodecDescriptor The codec map
*/
CodecDescriptor& getCodecMap();
/** Set my IP [not protected] */
/**
* Set my IP [not protected]
* @param ip The local IP address
*/
void setLocalIp(const std::string& ip) { _localIPAddress = ip; }
/** Set local audio port, as seen by me [not protected] */
/**
* Set local audio port, as seen by me [not protected]
* @param port The local audio port
*/
void setLocalAudioPort(unsigned int port) { _localAudioPort = port;}
/** Set the audio port that remote will see. */
/**
* Set the audio port that remote will see.
* @param port The external audio port
*/
void setLocalExternAudioPort(unsigned int port) { _localExternalAudioPort = port; }
/** Return the audio port seen by the remote side. */
/**
* Return the audio port seen by the remote side.
* @return unsigned int The external audio port
*/
unsigned int getLocalExternAudioPort() { return _localExternalAudioPort; }
/** Return my IP [mutex protected] */
/**
* Return my IP [mutex protected]
* @return std::string The local IP
*/
const std::string& getLocalIp();
/** Return port used locally (for my machine) [mutex protected] */
/**
* Return port used locally (for my machine) [mutex protected]
* @return unsigned int The local audio port
*/
unsigned int getLocalAudioPort();
/** Return audio port at destination [mutex protected] */
/**
* Return audio port at destination [mutex protected]
* @return unsigned int The remote audio port
*/
unsigned int getRemoteAudioPort();
/** Return IP of destination [mutex protected] */
/**
* Return IP of destination [mutex protected]
* @return const std:string The remote IP address
*/
const std::string& getRemoteIp();
/** Return audio codec [mutex protected] */
/**
* Return audio codec [mutex protected]
* @return AudioCodecType The payload of the codec
*/
AudioCodecType getAudioCodec();
protected:
protected:
/** Protect every attribute that can be changed by two threads */
ost::Mutex _callMutex;
/** Set remote's IP addr. [not protected] */
/**
* Set remote's IP addr. [not protected]
* @param ip The remote IP address
*/
void setRemoteIP(const std::string& ip) { _remoteIPAddress = ip; }
/** Set remote's audio port. [not protected] */
/**
* Set remote's audio port. [not protected]
* @param port The remote audio port
*/
void setRemoteAudioPort(unsigned int port) { _remoteAudioPort = port; }
/** Set the audio codec used. [not protected] */
/**
* Set the audio codec used. [not protected]
* @param audioCodec The payload of the codec
*/
void setAudioCodec(AudioCodecType audioCodec) { _audioCodec = audioCodec; }
/** Codec Map */
......@@ -190,7 +256,7 @@ protected:
unsigned int _remoteAudioPort;
private:
private:
/** Unique ID of the call */
CallID _id;
......
......@@ -25,8 +25,6 @@ public:
register_method(ConfigurationManager, addAccount, _addAccount_stub);
register_method(ConfigurationManager, removeAccount, _removeAccount_stub);
register_method(ConfigurationManager, getAccountList, _getAccountList_stub);
register_method(ConfigurationManager, getDefaultAccount, _getDefaultAccount_stub);
register_method(ConfigurationManager, setDefaultAccount, _setDefaultAccount_stub);
register_method(ConfigurationManager, sendRegister, _sendRegister_stub);
register_method(ConfigurationManager, getToneLocaleList, _getToneLocaleList_stub);
register_method(ConfigurationManager, getVersion, _getVersion_stub);
......@@ -90,16 +88,6 @@ public:
{ "list", "as", false },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument getDefaultAccount_args[] =
{
{ "accountID", "s", false },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument setDefaultAccount_args[] =
{
{ "accountID", "s", true },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument sendRegister_args[] =
{
{ "accountID", "s", true },
......@@ -280,8 +268,6 @@ public:
{ "addAccount", addAccount_args },
{ "removeAccount", removeAccount_args },
{ "getAccountList", getAccountList_args },
{ "getDefaultAccount", getDefaultAccount_args },
{ "setDefaultAccount", setDefaultAccount_args },
{ "sendRegister", sendRegister_args },
{ "getToneLocaleList", getToneLocaleList_args },
{ "getVersion", getVersion_args },
......@@ -353,8 +339,6 @@ public:
virtual void addAccount( const std::map< ::DBus::String, ::DBus::String >& details ) = 0;
virtual void removeAccount( const ::DBus::String& accoundID ) = 0;
virtual std::vector< ::DBus::String > getAccountList( ) = 0;
virtual ::DBus::String getDefaultAccount( ) = 0;
virtual void setDefaultAccount( const ::DBus::String& accountID ) = 0;
virtual void sendRegister( const ::DBus::String& accountID, const ::DBus::Int32& expire ) = 0;
virtual std::vector< ::DBus::String > getToneLocaleList( ) = 0;
virtual ::DBus::String getVersion( ) = 0;
......@@ -465,25 +449,6 @@ private:
wi << argout1;
return reply;
}
::DBus::Message _getDefaultAccount_stub( const ::DBus::CallMessage& call )
{
::DBus::MessageIter ri = call.reader();
::DBus::String argout1 = getDefaultAccount();
::DBus::ReturnMessage reply(call);
::DBus::MessageIter wi = reply.writer();
wi << argout1;
return reply;
}
::DBus::Message _setDefaultAccount_stub( const ::DBus::CallMessage& call )
{
::DBus::MessageIter ri = call.reader();
::DBus::String argin1; ri >> argin1;
setDefaultAccount(argin1);
::DBus::ReturnMessage reply(call);
return reply;
}
::DBus::Message _sendRegister_stub( const ::DBus::CallMessage& call )
{
::DBus::MessageIter ri = call.reader();
......
......@@ -25,14 +25,6 @@
<arg type="as" name="list" direction="out"/>
</method>
<method name="getDefaultAccount">
<arg type="s" name="accountID" direction="out"/>
</method>
<method name="setDefaultAccount">
<arg type="s" name="accountID" direction="in"/>
</method>
<method name="sendRegister">
<arg type="s" name="accountID" direction="in"/>
<arg type="i" name="expire" direction="in"/>
......
......@@ -217,24 +217,6 @@ ConfigurationManager::getRecordDeviceList( )
{
_debug("ConfigurationManager::getRecordDeviceList received\n");
}
::DBus::String
ConfigurationManager::getDefaultAccount( )
{
_debug("ConfigurationManager::getDefaultAccount received\n");
return Manager::instance().getDefaultAccount();
}
/*
* used to set a default account
*/
void
ConfigurationManager::setDefaultAccount( const ::DBus::String& accountID )
{
_debug("ConfigurationManager::setDefaultAccount received\n");
Manager::instance().setDefaultAccount(accountID);
}
::DBus::Int32
......
......@@ -44,8 +44,6 @@ public:
void addAccount( const std::map< ::DBus::String, ::DBus::String >& details );
void removeAccount( const ::DBus::String& accoundID );
std::vector< ::DBus::String > getAccountList( );
::DBus::String getDefaultAccount( );
void setDefaultAccount( const ::DBus::String& accountID );
void sendRegister( const ::DBus::String& accoundID , const ::DBus::Int32& expire );
std::vector< ::DBus::String > getCodecList( );
......
......@@ -24,9 +24,12 @@
#include <cc++/thread.h>
class VoIPLink;
/**
* General thread to listen events continuously
* @file eventthread.h
* @brief General thread to listen events continuously
*/
class EventThread : public ost::Thread {
public:
/**
......
......@@ -61,62 +61,61 @@ typedef short int16;
#define _debugAlsa(...)
#endif
#define SFLPHONED_VERSION "0.8.2"
#define SFLPHONED_VERSION "0.8.2" /** Version number */
#define SFLPHONED_VERSIONNUM 0x000802
#define PROGNAME "sflphoned"
#define PROGNAME_GLOBAL "sflphone"
#define PROGDIR "sflphone"
#define RINGDIR "ringtones"
#define CODECDIR "codecs"
#define PROGNAME "sflphoned" /** Binary name */
#define PROGNAME_GLOBAL "sflphone" /** Program name */
#define PROGDIR "sflphone" /** Program directory */
#define RINGDIR "ringtones" /** Ringtones directory */
#define CODECDIR "codecs" /** Codecs directory */
#define _(arg) arg
#define MONO 1
#define CHANNELS 2
#define SIZEBUF 1024*1024
#define ALSA_DFT_CARD_ID 0
#define PCM_HW "hw"
#define PCM_PLUGHW "plughw"
#define PCM_PULSE "pulse"
#define PCM_FRONT "plug:front"
#define PCM_DEFAULT "default"
#define PCM_DMIX "plug:dmix"
#define PCM_SURROUND40 "plug:surround40"
#define PCM_SURROUND41 "plug:surround41"
#define PCM_SURROUND50 "plug:surround50"
#define PCM_SURROUND51 "plug:surround51"
#define PCM_SURROUND71 "plug:surround71"
#define PCM_IEC958 "plug:iec958"
#define SFL_CODEC_VALID_PREFIX "libcodec_"
#define SFL_CODEC_VALID_EXTEN ".so"
#define CURRENT_DIR "."
#define PARENT_DIR ".."
#define SFL_PCM_BOTH 0x0021
#define SFL_PCM_PLAYBACK 0x0022
#define SFL_PCM_CAPTURE 0x0023
#define ALSA_DFT_CARD_ID 0 /** Index of the default soundcard */
#define PCM_HW "hw" /** Alsa plugin hardware */
#define PCM_PLUGHW "plughw" /** Alsa plugin */
#define PCM_PULSE "pulse" /** Alsa plugin for pulse audio */
#define PCM_FRONT "plug:front" /** Alsa plugin: front PCM */
#define PCM_DEFAULT "default" /** Default ALSA plugin */
#define PCM_DMIX "plug:dmix" /** Alsa plugin for software mixing */
#define PCM_SURROUND40 "plug:surround40" /** Alsa plugin: surround40 */
#define PCM_SURROUND41 "plug:surround41" /** Alsa plugin: surround41 */
#define PCM_SURROUND50 "plug:surround50" /** Alsa plugin: surround50 */
#define PCM_SURROUND51 "plug:surround51" /** Alsa plugin: surround51 */
#define PCM_SURROUND71 "plug:surround71" /** Alsa plugin: surround71 */
#define SFL_CODEC_VALID_PREFIX "libcodec_" /** Valid prefix for codecs shared library */
#define SFL_CODEC_VALID_EXTEN ".so" /** Valid extension for codecs shared library */
#define CURRENT_DIR "." /** Current directory */
#define PARENT_DIR ".." /** Parent directory */
#define SFL_PCM_BOTH 0x0021 /** To open both playback and capture devices */
#define SFL_PCM_PLAYBACK 0x0022 /** To open playback device only */
#define SFL_PCM_CAPTURE 0x0023 /** To open capture device only */
#ifdef USE_IAX
#define IAX2_ENABLED true
#define IAX2_ENABLED true /** IAX2 support */
#else
#define IAX2_ENABLED false
#define IAX2_ENABLED false /** IAX2 support */
#endif
#define GSM_STRING_DESCRIPTION "gsm"
#define SPEEX_STRING_DESCRIPTION "speex"
#define ILBC_STRING_DESCRIPTION "ilbc"
#define RINGTONE_ENABLED 1
#define DISPLAY_DIALPAD 1
#define START_HIDDEN 1
#define WINDOW_POPUP 1
#define GSM_STRING_DESCRIPTION "gsm" /** GSM codec string description */
#define SPEEX_STRING_DESCRIPTION "speex" /** SPEEX codec string description */
#define ILBC_STRING_DESCRIPTION "ilbc" /** Ilbc codec string description */
#define RINGTONE_ENABLED 1 /** Custom ringtone enable or not */
#define DISPLAY_DIALPAD 1 /** Display dialpad or not */
#define START_HIDDEN 1 /** SFlphone starts hidden at start-up or not */
#define WINDOW_POPUP 1 /** Popup mode */
// Error codes for error handling
#define NO_ERROR 0x0000
#define ALSA_CAPTURE_DEVICE 0x0001
#define ALSA_PLAYBACK_DEVICE 0x0010
#define NETWORK_UNREACHABLE 0x0011
#define NO_ERROR 0x0000 /** No error - Everything alright */
#define ALSA_CAPTURE_DEVICE 0x0001 /** Error while opening capture device */
#define ALSA_PLAYBACK_DEVICE 0x0010 /** Error while opening playback device */
#define NETWORK_UNREACHABLE 0x0011 /** Network unreachable */
#endif // __GLOBAL_H__
......@@ -24,8 +24,8 @@
/**
* An IAX Account specify IAX specific functions and objects (IAXCall/IAXVoIPLink)
* @author Yan Morin <yan.morin@gmail.com>
* @file: iaxaccount.h
* @brief: an IAX Account specify IAX specific functions and objects (IAXCall/IAXVoIPLink)
*/
class IAXAccount : public Account
{
......@@ -34,9 +34,19 @@ public:
~IAXAccount();
/** Actually unuseful, since config loading is done in init() */
/**
* Actually unuseful, since config loading is done in init()
*/
void loadConfig();
/**
* Register an account
*/
void registerVoIPLink();
/**
* Unregister an account
*/
void unregisterVoIPLink();
private:
......
......@@ -25,42 +25,53 @@
#include <iax/frame.h>
/**
* IAXCall are IAX implementation of a normal Call
* @author Yan Morin <yan.morin@gmail.com>
* @file: iaxcall.h
* @brief: IAXCall are IAX implementation of a normal Call
*/
class IAXCall : public Call
{
public:
/**
* Constructor
* @param id The unique ID of the call
* @param type The type of the call
*/
IAXCall(const CallID& id, Call::CallType type);
/**
* Destructor
*/
~IAXCall();
/** Get the session pointer or NULL */
/**
* @return iax_session* The session pointer or NULL
*/
struct iax_session* getSession() { return _session; }
/** Set the session pointer
/**
* Set the session pointer
* @param session the session pointer to assign
*/
void setSession(struct iax_session* session) { _session = session; }
/**
* Set format (one single bit
*
* Set format (one single bit)
* This function sets the _audioCodec variable with the correct
* codec.
* @param format The format representing the codec
*/
void setFormat(int format);
/**
* Get format for the voice codec used
*
* Bitmask for codecs defined in iax/frame.h
* @return int Bitmask for codecs defined in iax/frame.h
*/
int getFormat() { return _format; }
/**
* Get the bitwise list of supported formats
* @return int The bitwise list of supported formats
*/
int getSupportedFormat();
......@@ -75,7 +86,7 @@ public:
* in this call context.
*
* @param needles The format(s) (bitwise) you are looking for to match
* @return The matching format, thus 0 if none matches
* @return int The matching format, thus 0 if none matches
*/
int getFirstMatchingFormat(int needles);
......
......@@ -363,11 +363,9 @@ IAXVoIPLink::sendRegister()
bool result = false;
if (_host.empty()) {
Manager::instance().displayConfigError("Fill host field for IAX Account");
return false;
}
if (_user.empty()) {
Manager::instance().displayConfigError("Fill user field for IAX Account");
return false;
}
......@@ -656,7 +654,6 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
}
call->setConnectionState(Call::Connected);
call->setState(Call::Error);
Manager::instance().displayErrorText(id, "Failure");