# Interface: com.pnfsoftware.jeb.core.units.code.asm.analyzer.ICallGraph

Callgraphs represent control flow relationships between routines. they are composed of [CallGraphVertex](CallGraphVertex)s connected by [CallGraphEdge](CallGraphEdge)s. 

 Notes: 
 
- while the 'callee' location can be either an external routine \([#recordExternalCall](#recordExternalCall)\), an unresolved location \([#recordUnresolvedCall](#recordUnresolvedCall)\) or an internal location \([#recordInternalCall](#recordInternalCall)\), the 'caller' has to be an internal location with a defined instruction. 
- callgraphs distinguish calls computed by safe analysis versus those computed by unsafe analysis \(e.g. [INativeCodeAdvancedAnalyzer](INativeCodeAdvancedAnalyzer)\) 

 

 Note: semantic of callgraph edges is slightly different than [ReferenceType#ROUTINE_CALL](ReferenceType#ROUTINE_CALL) code references: callgraph edges comprehend any code redirections to a routine \(ie, including those done with simple branches \-\- no routine call instructions\).

## Method: getCalleeRoutines
- parameter: `caller`, type: `long`
- parameter: `onlySafeCalls`, type: `boolean`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.items.INativeMethodItem>`

Description: Get the routines called by an internal address.
parameter: caller: internal address of the caller instruction
parameter: onlySafeCalls: if true only calls resulting from a safe analysis will be considered
return: routines called by the instruction at the given address, never null

## Method: getCallees
- parameter: `callerInternalAddress`, type: `long`
- parameter: `onlySafeCalls`, type: `boolean`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.analyzer.CallGraphVertex>`

Description: Get the targets called from a given instruction.
parameter: callerInternalAddress: internal address of the caller instruction
parameter: onlySafeCalls: if true only calls resulting from a safe analysis will be considered
return: called targets, never null

## Method: getCallees
- parameter: `rtn`, type: `com.pnfsoftware.jeb.core.units.code.asm.items.INativeMethodItem`
- parameter: `onlySafeCalls`, type: `boolean`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.analyzer.CallGraphVertex>`

Description: Convenience method to get all the targets called by an internal routine. A target may appear several times in the result, once for each call from the routine.
parameter: rtn: internal routine
parameter: onlySafeCalls: if true only calls resulting from a safe analysis will be considered
return: targets called by the given routine, never null
throws: on external routines

## Method: getCallerRoutines
- parameter: `callee`, type: `com.pnfsoftware.jeb.core.units.code.CodePointer`
- parameter: `onlySafeCalls`, type: `boolean`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.items.INativeMethodItem>`

Description: Get the routines calling an internal address.
parameter: callee: internal callee address
parameter: onlySafeCalls: if true only calls resulting from a safe analysis will be considered
return: routines calling the given address, never null

## Method: getCallers
- parameter: `callee`, type: `com.pnfsoftware.jeb.core.units.code.asm.analyzer.CallGraphVertex`
- parameter: `onlySafeCalls`, type: `boolean`
- return type: `java.util.List<java.lang.Long>`

Description: Get the addresses calling a given target.
parameter: callee: callee vertex
parameter: onlySafeCalls: if true only calls resulting from a safe analysis will be considered
return: callers addresses, never null

## Method: getCallers
- parameter: `rtn`, type: `com.pnfsoftware.jeb.core.units.code.asm.items.INativeMethodItem`
- parameter: `onlySafeCalls`, type: `boolean`
- return type: `java.util.List<java.lang.Long>`

Description: Convenience method to get all the addresses calling a routine.
parameter: rtn: called routine
parameter: onlySafeCalls: if true only calls resulting from a safe analysis will be considered
return: addresses calling the given routine, never null

## Method: recordExternalCall
- parameter: `callerInternalAddress`, type: `long`
- parameter: `calleeExternalRtn`, type: `com.pnfsoftware.jeb.core.units.code.asm.items.INativeMethodItem`
- parameter: `isSafe`, type: `boolean`

Description: Records a call between an internal address and an external routine.
parameter: callerInternalAddress: internal address of the caller instruction
parameter: calleeExternalRtn: external callee routine
parameter: isSafe: if true, the call relationship has been computed by a safe analysis, otherwise            it was computed by an unsafe analysis

## Method: recordInternalCall
- parameter: `callerInternalAddress`, type: `long`
- parameter: `calleeInternalAddress`, type: `com.pnfsoftware.jeb.core.units.code.CodePointer`
- parameter: `isSafe`, type: `boolean`

Description: Records a call between two internal addresses.
parameter: callerInternalAddress: internal address of the caller instruction
parameter: calleeInternalAddress: internal address of the callee
parameter: isSafe: if true, the call relationship has been computed by a safe analysis, otherwise            it was computed by an unsafe analysis

## Method: recordUnresolvedCall
- parameter: `callerInternalAddress`, type: `long`
- parameter: `calleeDereferencedAddress`, type: `long`
- parameter: `isSafe`, type: `boolean`

Description: Records an unresolved call, i.e. a call for which the final target is unknown, but for which a dereferenced memory address is known.
parameter: callerInternalAddress: internal address of the caller instruction
parameter: calleeDereferencedAddress: dereferenced target address
parameter: isSafe: if true, the call relationship has been computed by a safe analysis, otherwise            it was computed by an unsafe analysis

## Method: removeCallRelationship
- parameter: `address`, type: `long`

Description: Remove all registered call relationships \(from and to\) a given internal address.
parameter: address: internal address whose call relationships should be removed

