Commit c60ec56c authored by Tomáš Stefan's avatar Tomáš Stefan

documentation of modules header, sig_dict, sig_field

parent 1089796c
......@@ -7,9 +7,20 @@
#include "types.h"
/** @brief Read the header at the beginning of the PDF and get the PDF version
*
* @param sgl context
* @return ERR_NONE if success
*/
sigil_err_t process_header(sigil_t *sgl);
/** @brief Tests for the header module
*
* @param verbosity output level - 0 means nothing, 1 prints module names with
* the overall module result, and 2 prints also each test inside
* of the module
* @return 0 if success, 1 if failed
*/
int sigil_header_self_test(int verbosity);
#endif /* PDF_SIGIL_HEADER_H */
......@@ -7,9 +7,21 @@
#include "types.h"
/** @brief Does the signature dictionary processing. Does't depend on the current
* position in the PDF
*
* @param sgl context
* @return ERR_NONE if success
*/
sigil_err_t process_sig_dict(sigil_t *sgl);
/** @brief Tests for the sig_dict module
*
* @param verbosity output level - 0 means nothing, 1 prints module names with
* the overall module result, and 2 prints also each test inside
* of the module
* @return 0 if success, 1 if failed
*/
int sigil_sig_dict_self_test(int verbosity);
#endif /* PDF_SIGIL_SIG_DICT_H */
......@@ -7,11 +7,31 @@
#include "types.h"
/** @brief Go through all the objects mentioned in the Fields entry from the
* interactive form dictionary (AcroForm) and look for the signature
* field. If found, save the object reference inside the context
*
* @param sgl context
* @return ERR_NONE if success
*/
sigil_err_t find_sig_field(sigil_t *sgl);
/** @brief Does processing of the signature field and saves the position of the
* signature dictionary (V entry). Doesn't depend on the current
* position in the PDF
*
* @param sgl context
* @return ERR_NONE if success
*/
sigil_err_t process_sig_field(sigil_t *sgl);
int sigil_sigil_self_test(int verbosity);
/** @brief Tests for the sig_field module
*
* @param verbosity output level - 0 means nothing, 1 prints module names with
* the overall module result, and 2 prints also each test inside
* of the module
* @return 0 if success, 1 if failed
*/
int sigil_sig_field_self_test(int verbosity);
#endif /* PDF_SIGIL_SIG_FIELD_H */
......@@ -126,30 +126,25 @@ sigil_err_t process_sig_dict(sigil_t *sgl)
case DICT_KEY_SubFilter:
if ((err = parse_subfilter(sgl)) != ERR_NONE)
return err;
break;
case DICT_KEY_Cert:
err = parse_certs(sgl);
if (err != ERR_NONE)
return err;
break;
case DICT_KEY_Contents:
err = parse_contents(sgl);
if (err != ERR_NONE)
return err;
break;
case DICT_KEY_ByteRange:
if ((err = parse_byte_range(sgl)) != ERR_NONE)
return err;
break;
case DICT_KEY_UNKNOWN:
err = skip_dict_unknown_value(sgl);
if (err != ERR_NONE)
return err;
break;
default:
return ERR_PDF_CONTENT;
......@@ -160,5 +155,22 @@ sigil_err_t process_sig_dict(sigil_t *sgl)
return ERR_NONE;
return err;
}
int sigil_sig_dict_self_test(int verbosity)
{
print_module_name("sig_dict", verbosity);
// place for possible later tests
// ...
// all tests done
print_module_result(1, verbosity);
return 0;
failed:
print_test_result(0, verbosity);
print_module_result(0, verbosity);
return 1;
}
......@@ -117,4 +117,22 @@ sigil_err_t process_sig_field(sigil_t *sgl)
return ERR_NONE;
return err;;
}
int sigil_sig_field_self_test(int verbosity)
{
print_module_name("sig_field", verbosity);
// place for possible later tests
// ...
// all tests done
print_module_result(1, verbosity);
return 0;
failed:
print_test_result(0, verbosity);
print_module_result(0, verbosity);
return 1;
}
\ No newline at end of file
......@@ -8,6 +8,8 @@
#include "contents.h"
#include "cryptography.h"
#include "header.h"
#include "sig_dict.h"
#include "sig_field.h"
#include "sigil.h"
#include "trailer.h"
#include "xref.h"
......@@ -70,6 +72,10 @@ int main(int argc, char **argv)
failed++;
if (sigil_cryptography_self_test(verbosity) != 0)
failed++;
if (sigil_sig_dict_self_test(verbosity) != 0)
failed++;
if (sigil_sig_field_self_test(verbosity) != 0)
failed++;
if (sigil_sigil_self_test(verbosity) != 0)
failed++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment