Socket Class Reference

La classe Socket est une abstration d'une socket réseau, elle est implémentée en UDP par SocketUDP et en TCP par SocketTCP. More...

#include <Socket.h>

Inheritance diagram for Socket:

Inheritance graph
[legend]
Collaboration diagram for Socket:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Socket ()
 Constructeur vide.
 Socket (int socket)
 Constructeur par recopie.
 Socket (unsigned int port) throw (SocketException)
 Construit une socket écoutant toutes les adresses locales sur port (Virtuel) Typiquement utilisé par un serveur.
 Socket (string ad, unsigned int port) throw (SocketException)
 Construit une socket se "connectant" à l'adresse ad sur port (Virtuel) Typiquement utilisé par un client.
 Socket (Socket *s)
 Constructeur par recopie à partir d'un Socket*.
 Socket (const Socket &s)
 Constructeur par recopie.
void operator= (const Socket &s)
 Surcharge de = (Contructeur par recopie).
virtual ~Socket ()
 Destructeur (Virtuel).
virtual SocketAccept ()=0 throw (SocketException)
 Cette méthode attend une connexion (TCP UNIQUEMENT!) de la part d'un client et retourne un pointeur sur Socket (Virtuel).
virtual void Envoyer (string msg) const=0 throw (SocketException)
 Envoie le message msg à l'extrèmité de la socket (Virtuel).
virtual string Ecouter ()=0 throw (SocketException)
 Attend et renvoit le message reçu de l'extrémité de la socket (Virtuel).

Protected Member Functions

void SetCryptage ()
 Configure le pointeur sur la classe Cryptage [Design Pattern Stratégie] => Pour changer la politique de cryptage de la socket, simplement changer l'héritage.

Protected Attributes

int mSocket
 Descripteur de la socket.
CryptagemCryptage
 Pointeur sur la classe gérant le cryptage des communications.

Detailed Description

La classe Socket est une abstration d'une socket réseau, elle est implémentée en UDP par SocketUDP et en TCP par SocketTCP.

Definition at line 49 of file Socket.h.


Constructor & Destructor Documentation

Socket::Socket (  )  [inline]

Constructeur vide.

Returns:

Definition at line 55 of file Socket.h.

References SetCryptage().

00055 { SetCryptage(); }

Here is the call graph for this function:

Socket::Socket ( int  socket  )  [inline]

Constructeur par recopie.

(Virtuel)

Parameters:
socket Attention l'entier doit être une socket...
Returns:

Definition at line 62 of file Socket.h.

References SetCryptage().

00062 { SetCryptage(); } 

Here is the call graph for this function:

Socket::Socket ( unsigned int  port  )  throw (SocketException) [inline]

Construit une socket écoutant toutes les adresses locales sur port (Virtuel) Typiquement utilisé par un serveur.

..[Bind + Listen (en TCP seulement)]

Parameters:
port 
Returns:

Definition at line 70 of file Socket.h.

References SetCryptage().

00070 { SetCryptage(); }

Here is the call graph for this function:

Socket::Socket ( string  ad,
unsigned int  port 
) throw (SocketException) [inline]

Construit une socket se "connectant" à l'adresse ad sur port (Virtuel) Typiquement utilisé par un client.

..

Parameters:
ad 
port 
Returns:

Definition at line 79 of file Socket.h.

References SetCryptage().

00079 { SetCryptage(); }

Here is the call graph for this function:

Socket::Socket ( Socket s  )  [inline]

Constructeur par recopie à partir d'un Socket*.

Parameters:
s Pointeur sur la socket à partir de laquelle on veut créer l'objet
Returns:

Definition at line 86 of file Socket.h.

References mCryptage, and mSocket.

00086                          {
00087                 mSocket=s->mSocket;
00088                 mCryptage=s->mCryptage; 
00089         }

Socket::Socket ( const Socket s  )  [inline]

Constructeur par recopie.

Parameters:
s Socket de base
Returns:

Definition at line 97 of file Socket.h.

References mCryptage, and mSocket.

00097                                {
00098                 mSocket=s.mSocket;
00099                 mCryptage=s.mCryptage;  
00100         }

virtual Socket::~Socket (  )  [inline, virtual]

Destructeur (Virtuel).

Returns:

Definition at line 115 of file Socket.h.

References mCryptage.

00115                          {
00116                 delete mCryptage;
00117         }


Member Function Documentation

void Socket::operator= ( const Socket s  )  [inline]

Surcharge de = (Contructeur par recopie).

Parameters:
s 

Definition at line 106 of file Socket.h.

References mCryptage, and mSocket.

00106                                        {
00107                 mSocket=s.mSocket;
00108                 mCryptage=s.mCryptage;  
00109         }

virtual Socket* Socket::Accept (  )  throw (SocketException) [pure virtual]

Cette méthode attend une connexion (TCP UNIQUEMENT!) de la part d'un client et retourne un pointeur sur Socket (Virtuel).

Returns:
Socket*

Implemented in SocketTCP, and SocketUDP.

Referenced by ServeurPrincipal::AttendreClient(), ServeurJeu::AttendreClient(), and Test::ServeurTCP().

virtual void Socket::Envoyer ( string  msg  )  const throw (SocketException) [pure virtual]

Envoie le message msg à l'extrèmité de la socket (Virtuel).

Parameters:
msg 

Implemented in SocketTCP, and SocketUDP.

Referenced by TraitementClient::Authentification(), ClientSP::ChoisirPartie(), Test::ClientTCP(), Test::ClientUDP(), ClientSP::CreationPartie(), TraitementClient::CreerOuRejoindrePartie(), TraitementClient::EnvoyerListePartie(), TraitementClient::EnvoyerListeScore(), TraitementComServeurPrincipal::HandShake(), TraitementComServeurPrincipal::IndiquerAttenteJoueurs(), TraitementComServeurPrincipal::IndiquerConnexions(), TraitementComServeurPrincipal::IndiquerDebutPartie(), TraitementComServeurPrincipal::IndiquerFinPartie(), TraitementComServeurPrincipal::IndiquerStatusPartie(), ClientSP::ListerPartie(), ClientSP::ListerScore(), ClientSP::RegLogin(), ClientSP::RejoindrePartie(), ClientSP::SendHello(), ClientSJ::SendHello(), ClientSP::SendLogin(), ClientSJ::SendLogin(), ClientSJ::SendRole(), Test::ServeurTCP(), Test::ServeurUDP(), TraitementComServeurJeu::Traitement(), TraitementClient::Traitement(), AffichageGrille::Traitement(), TraitementJoueur::TraitementDeplacement(), ClientSJ::TraitementDeplacement(), TraitementComServeurJeu::TraiterAttenteJoueur(), TraitementComServeurJeu::TraiterHello(), TraitementComServeurJeu::TraiterReceptionStatus(), TraitementComServeurJeu::TraiterServeurJeuPret(), TraitementJoueur::WaitForHello(), TraitementClient::WaitForHello(), TraitementJoueur::WaitForLogin(), TraitementJoueur::WaitForPlayers(), and TraitementJoueur::WaitForRole().

virtual string Socket::Ecouter (  )  throw (SocketException) [pure virtual]

Attend et renvoit le message reçu de l'extrémité de la socket (Virtuel).

Returns:
Le message reçu

Implemented in SocketTCP, and SocketUDP.

Referenced by TraitementClient::Authentification(), ClientSP::ChoisirPartie(), Test::ClientTCP(), Test::ClientUDP(), ClientSP::CreationPartie(), TraitementClient::CreerOuRejoindrePartie(), TraitementComServeurPrincipal::HandShake(), TraitementComServeurPrincipal::IndiquerAttenteJoueurs(), TraitementComServeurPrincipal::IndiquerDebutPartie(), ClientSP::ListerPartie(), ClientSP::ListerScore(), ClientSP::RegLogin(), ClientSP::RejoindrePartie(), ClientSP::SendHello(), ClientSJ::SendHello(), ClientSP::SendLogin(), ClientSJ::SendLogin(), ClientSJ::SendRole(), Test::ServeurTCP(), Test::ServeurUDP(), TraitementComServeurJeu::Traitement(), TraitementClient::Traitement(), AffichageGrille::Traitement(), TraitementJoueur::TraitementDeplacement(), ClientSJ::TraitementDeplacement(), TraitementJoueur::WaitForHello(), TraitementClient::WaitForHello(), TraitementJoueur::WaitForLogin(), and TraitementJoueur::WaitForRole().

void Socket::SetCryptage (  )  [inline, protected]

Configure le pointeur sur la classe Cryptage [Design Pattern Stratégie] => Pour changer la politique de cryptage de la socket, simplement changer l'héritage.

..

Definition at line 151 of file Socket.h.

References mCryptage, and Cryptage::SetCle().

Referenced by Socket().

00151                           {
00152                 //mCryptage=new EnClair();
00153                 mCryptage=new Vigenere();
00154                 mCryptage->SetCle("dbzUICSibsFCssqE349Dcs1P5zs491674c6z4c8zHVedz");
00155         }

Here is the call graph for this function:


Member Data Documentation

int Socket::mSocket [protected]

Descripteur de la socket.

Definition at line 141 of file Socket.h.

Referenced by SocketTCP::Accept(), SocketUDP::Ecouter(), SocketTCP::Ecouter(), SocketUDP::operator=(), SocketTCP::operator=(), operator=(), Socket(), SocketTCP::SocketTCP(), SocketUDP::SocketUDP(), SocketTCP::~SocketTCP(), and SocketUDP::~SocketUDP().

Cryptage* Socket::mCryptage [protected]

Pointeur sur la classe gérant le cryptage des communications.

Definition at line 146 of file Socket.h.

Referenced by SocketUDP::Ecouter(), SocketTCP::Ecouter(), SocketTCP::operator=(), operator=(), SetCryptage(), Socket(), SocketTCP::SocketTCP(), and ~Socket().


The documentation for this class was generated from the following file:
Generated on Wed Jan 2 14:02:12 2008 for Pacman by  doxygen 1.5.1