Search in sources :

Example 1 with Quad

use of com.google.security.zynamics.zylib.general.Quad in project binnavi by google.

the class CGlobalEdgeCommentSynchronizer method getEdgeData.

/**
   * Returns the edge data of a given edge.
   *
   * @param edge An edge.
   *
   * @return <Source Module ID, Source Address, Target Module ID, Target Address>
   *
   * @throws MaybeNullException Thrown if the edge data could not be determined.
   */
private static Quad<Integer, IAddress, Integer, IAddress> getEdgeData(final INaviEdge edge) throws MaybeNullException {
    IAddress srcAddr = null;
    IAddress dstAddr = null;
    int srcModuleId = -1;
    int dstModuleId = -1;
    if (edge.getSource() instanceof INaviCodeNode) {
        srcAddr = ((INaviCodeNode) edge.getSource()).getAddress();
        srcModuleId = ((INaviCodeNode) edge.getSource()).getParentFunction().getModule().getConfiguration().getId();
    } else if (edge.getSource() instanceof INaviFunctionNode) {
        srcAddr = ((INaviFunctionNode) edge.getSource()).getFunction().getAddress();
        srcModuleId = ((INaviFunctionNode) edge.getSource()).getFunction().getModule().getConfiguration().getId();
    }
    if (edge.getTarget() instanceof INaviCodeNode) {
        dstAddr = ((INaviCodeNode) edge.getTarget()).getAddress();
        dstModuleId = ((INaviCodeNode) edge.getTarget()).getParentFunction().getModule().getConfiguration().getId();
    } else if (edge.getTarget() instanceof INaviFunctionNode) {
        dstAddr = ((INaviFunctionNode) edge.getTarget()).getFunction().getAddress();
        dstModuleId = ((INaviFunctionNode) edge.getTarget()).getFunction().getModule().getConfiguration().getId();
    }
    return new Quad<Integer, IAddress, Integer, IAddress>(srcModuleId, srcAddr, dstModuleId, dstAddr);
}
Also used : Quad(com.google.security.zynamics.zylib.general.Quad) INaviCodeNode(com.google.security.zynamics.binnavi.disassembly.INaviCodeNode) INaviFunctionNode(com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode) IAddress(com.google.security.zynamics.zylib.disassembly.IAddress)

Aggregations

INaviCodeNode (com.google.security.zynamics.binnavi.disassembly.INaviCodeNode)1 INaviFunctionNode (com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode)1 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)1 Quad (com.google.security.zynamics.zylib.general.Quad)1