package org.freertr.ip; import org.freertr.addr.addrIP; import org.freertr.pack.packHolder; /** * ip core protocol * * @author matecsaba */ public interface ipCor { /** * get ip version info * * @return return ip version */ public int getVersion(); /** * get protocol info * * @return return ip protocol */ public int getProtocol(); /** * get net layer protocol id * * @return return ip version */ public int getNlpid(); /** * get ip header size generated by create * * @return return ip header size */ public int getHeaderSize(); /** * parse ip header * * @param pck packet to parse * @param chksiz check size * @return false if successful, true if error happened */ public boolean parseIPheader(packHolder pck, boolean chksiz); /** * create ip header * * @param pck packet to update */ public void createIPheader(packHolder pck); /** * update ip header it works at data area, not at header area the neader * already have to be parsed and must not skipped over it * * @param pck packet to update * @param src new source address, null=don't set * @param trg new target address, null=don't set * @param prt new protocol value, -1=dont set * @param ttl new ttl value, -1=dont set, -2=decrement * @param tos new tos value, -1=dont set * @param id new id value, -1=dont set * @param len new payload length, -1=dont set */ public void updateIPheader(packHolder pck, addrIP src, addrIP trg, int prt, int ttl, int tos, int id, int len); }