Index: courgette/courgette.h |
diff --git a/courgette/courgette.h b/courgette/courgette.h |
index 84ab7cddd3d9d25708ec7048bf161aace3ad813a..5a98a469a34f96b8de89683bd06075d9d2ee38fa 100644 |
--- a/courgette/courgette.h |
+++ b/courgette/courgette.h |
@@ -90,6 +90,30 @@ |
Status GenerateEnsemblePatch(SourceStream* old, SourceStream* target, |
SinkStream* patch); |
+// Detects the type of an executable file, and it's length. The length |
+// may be slightly smaller than some executables (like ELF), but will include |
+// all bytes the courgette algorithm has special benefit for. |
+// On success: |
+// Fill in type and detected_length, and return C_OK. |
+// On failure: |
+// Fill in type with UNKNOWN, detected_length with 0, and |
+// return C_INPUT_NOT_RECOGNIZED |
+Status DetectExecutableType(const void* buffer, size_t length, |
+ ExecutableType* type, |
+ size_t* detected_length); |
+ |
+// Attempts to detect the type of executable, and parse it with the |
+// appropriate tools, storing the pointer to the AssemblyProgram in |*output|. |
+// Returns C_OK if successful, otherwise returns an error status and sets |
+// |*output| to NULL. |
+Status ParseDetectedExecutable(const void* buffer, size_t length, |
+ AssemblyProgram** output); |
+ |
+// Converts |program| into encoded form, returning it as |*output|. |
+// Returns C_OK if succeeded, otherwise returns an error status and |
+// sets |*output| to NULL |
+Status Encode(AssemblyProgram* program, EncodedProgram** output); |
+ |
// Serializes |encoded| into the stream set. |
// Returns C_OK if succeeded, otherwise returns an error status. |
Status WriteEncodedProgram(EncodedProgram* encoded, SinkStreamSet* sink); |
@@ -99,10 +123,20 @@ |
// |buffer| in an undefined state. |
Status Assemble(EncodedProgram* encoded, SinkStream* buffer); |
+// Deserializes program from the stream set. |
+// Returns C_OK if succeeded, otherwise returns an error status and |
+// sets |*output| to NULL |
+Status ReadEncodedProgram(SourceStreamSet* source, EncodedProgram** output); |
+ |
+// Used to free an AssemblyProgram returned by other APIs. |
+void DeleteAssemblyProgram(AssemblyProgram* program); |
+ |
+// Used to free an EncodedProgram returned by other APIs. |
+void DeleteEncodedProgram(EncodedProgram* encoded); |
+ |
// Adjusts |program| to look more like |model|. |
// |
Status Adjust(const AssemblyProgram& model, AssemblyProgram *program); |
} // namespace courgette |
- |
#endif // COURGETTE_COURGETTE_H_ |