Peer.java

Go to the documentation of this file.
00001 /*
00002  * $Id: Peer.java 2 2006-11-14 22:37:20Z vingarzan $
00003  *
00004  * Copyright (C) 2004-2006 FhG Fokus
00005  *
00006  * This file is part of Open IMS Core - an open source IMS CSCFs & HSS
00007  * implementation
00008  *
00009  * Open IMS Core is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * For a license to use the Open IMS Core software under conditions
00015  * other than those described here, or to purchase support for this
00016  * software, please contact Fraunhofer FOKUS by e-mail at the following
00017  * addresses:
00018  *     info@open-ims.org
00019  *
00020  * Open IMS Core is distributed in the hope that it will be useful,
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  * GNU General Public License for more details.
00024  *
00025  * You should have received a copy of the GNU General Public License
00026  * along with this program; if not, write to the Free Software
00027  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028  *
00029  */
00030 
00031 package de.fhg.fokus.diameter.DiameterPeer.peer;
00032 
00033 import java.util.Vector;
00034 
00035 import org.apache.log4j.Logger;
00036 
00037 import de.fhg.fokus.diameter.DiameterPeer.DiameterPeer;
00038 import de.fhg.fokus.diameter.DiameterPeer.data.DiameterMessage;
00039 import de.fhg.fokus.diameter.DiameterPeer.transport.Communicator;
00051 public class Peer {
00052     
00054     private static final Logger LOGGER = Logger.getLogger(Peer.class);
00055     
00057     public DiameterPeer diameterPeer;
00058     
00060     public String FQDN;
00061     
00063     public int port;
00064 
00066     public String Realm;
00067     
00069     public int state=StateMachine.Closed;
00070         
00072     public Communicator I_comm;
00073         
00075     public Communicator R_comm; 
00076     
00078     public long lastReceiveTime;
00079     
00081     public boolean waitingDWA=false;
00082     
00084     public boolean isDynamicPeer=false;
00085     
00087     public Vector<Application> AuthApp;
00088     
00090     public Vector<Application> AcctApp;
00091 
00092     
00093     
00101     public Peer(String fqdn, String realm, int port) {
00102         FQDN = fqdn;
00103         Realm = realm;
00104         this.port = port;
00105         this.AuthApp = new Vector<Application>();
00106         this.AcctApp = new Vector<Application>();
00107     }
00108     
00109     
00118     public boolean sendMessage(DiameterMessage msg)
00119     {
00120         switch (this.state){
00121             case StateMachine.I_Open: 
00122                 //commented because it is processed by peer... anyway, useless...
00123                 //StateMachine.process(this,StateMachine.Send_Message,msg,this.I_comm);
00124                 return I_comm.sendMessage(msg);
00125             case StateMachine.R_Open:
00126                 //commented because it is processed by peer... anyway, useless...
00127                 //StateMachine.process(this,StateMachine.Send_Message,msg,this.R_comm);
00128                 return R_comm.sendMessage(msg);
00129             default:
00130                 System.err.println("Peer: Can't send message when not connected");
00131                 return false;
00132         }
00133     }
00134     
00139     public void refreshTimer()
00140     {
00141         this.lastReceiveTime = System.currentTimeMillis();
00142     }
00143 }

Generated on Thu Oct 23 04:07:36 2008 for Open IMS Core JavaDiameterPeer by  doxygen 1.5.2