package org.freertr.serv; import java.util.List; import org.freertr.addr.addrIP; import org.freertr.pack.packHolder; import org.freertr.pipe.pipeSide; import org.freertr.prt.prtGenConn; import org.freertr.prt.prtServP; import org.freertr.tab.tabGen; import org.freertr.user.userFilter; import org.freertr.user.userHelping; import org.freertr.util.cmds; import org.freertr.util.counter; import org.freertr.util.state; /** * echo (rfc862) server - packet mode * * @author matecsaba */ public class servEchoP extends servGeneric implements prtServP { /** * create instance */ public servEchoP() { } /** * port number */ public final static int port = 7; /** * defaults text */ public final static String[] defaultL = { "server echo .*!" + cmds.tabulator + "port " + port, "server echo .*!" + cmds.tabulator + "protocol " + proto2string(protoAll) }; /** * defaults filter */ public static tabGen defaultF; public tabGen srvDefFlt() { return defaultF; } /** * close connection * * @param id connection */ public void datagramClosed(prtGenConn id) { } /** * connection ready * * @param id connection */ public void datagramReady(prtGenConn id) { } /** * work connection * * @param id connection */ public void datagramWork(prtGenConn id) { } /** * received error * * @param id connection * @param pck packet * @param rtr reporting router * @param err error happened * @param lab error label * @return false on success, true on error */ public boolean datagramError(prtGenConn id, packHolder pck, addrIP rtr, counter.reasons err, int lab) { return false; } /** * notified that state changed * * @param id id number to reference connection * @param stat state * @return return false if successful, true if error happened */ public boolean datagramState(prtGenConn id, state.states stat) { return false; } /** * received packet * * @param id connection * @param pck packet * @return false on success, true on error */ public boolean datagramRecv(prtGenConn id, packHolder pck) { id.send2net(pck); return false; } public void srvShRun(String beg, List lst, int filter) { } public boolean srvCfgStr(cmds cmd) { return true; } public void srvHelp(userHelping l) { } public String srvName() { return "echo"; } public int srvPort() { return port; } public int srvProto() { return protoAll; } public boolean srvInit() { return genDgrmStart(this, 0); } public boolean srvDeinit() { return genericStop(0); } public boolean srvAccept(pipeSide pipe, prtGenConn id) { id.timeout = 10000; return false; } }