sediffx.h File Reference


Detailed Description

Headers for main sediffx program.

Author:
Jeremy A. Mowery jmowery@tresys.com

Jason Tang jtang@tresys.com

Brandon Whalen bwhalen@tresys.com

Randy Wicks rwicks@tresys.com

Copyright (C) 2005-2007 Tresys Technology, LLC

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Definition in file sediffx.h.

#include <apol/policy.h>
#include <apol/policy-path.h>
#include <poldiff/poldiff.h>

Go to the source code of this file.


Defines

#define COPYRIGHT_INFO   "Copyright (C) 2004-2007 Tresys Technology, LLC"

Typedefs

typedef sediffx sediffx_t
typedef enum sediffx_policy sediffx_policy_e
 enumeration of which policy to affect -- the original policy (used to be called "policy 1") or the modified policy ("policy 2")

Enumerations

enum  sediffx_policy { SEDIFFX_POLICY_ORIG = 0, SEDIFFX_POLICY_MOD, SEDIFFX_POLICY_NUM }
 enumeration of which policy to affect -- the original policy (used to be called "policy 1") or the modified policy ("policy 2") More...

Functions

void sediffx_set_policy (sediffx_t *s, sediffx_policy_e which, apol_policy_t *policy, apol_policy_path_t *path)
 Set one of the policies for sediffx.
const apol_policy_path_tsediffx_get_policy_path (sediffx_t *s, const sediffx_policy_e which)
 Return the policy path for the policy given.
poldiff_tsediffx_get_poldiff (sediffx_t *s, poldiff_handle_fn_t fn, void *arg)
 Return the currently active poldiff object.
void sediffx_set_poldiff_run_flags (sediffx_t *s, uint32_t flags)
 Set the flags that were used to run a poldiff.
uint32_t sediffx_get_poldiff_run_flags (sediffx_t *s)
 Get the flags that were used to run a poldiff.

Define Documentation

#define COPYRIGHT_INFO   "Copyright (C) 2004-2007 Tresys Technology, LLC"
 

Definition at line 43 of file sediffx.h.


Typedef Documentation

typedef struct sediffx sediffx_t
 

Definition at line 34 of file sediffx.h.

Referenced by main(), sediffx_destroy(), sediffx_get_poldiff(), sediffx_get_poldiff_run_flags(), sediffx_get_policy_path(), sediffx_set_poldiff_run_flags(), sediffx_set_policy(), and toplevel_create().

typedef enum sediffx_policy sediffx_policy_e
 

enumeration of which policy to affect -- the original policy (used to be called "policy 1") or the modified policy ("policy 2")

Referenced by open_policy_init_signals(), remap_types_init_combos(), remap_types_update(), results_on_line_event(), toplevel_create(), toplevel_destroy(), toplevel_open_policies(), toplevel_open_policy_runner(), and toplevel_update_title_bar().


Enumeration Type Documentation

enum sediffx_policy
 

enumeration of which policy to affect -- the original policy (used to be called "policy 1") or the modified policy ("policy 2")

Enumeration values:
SEDIFFX_POLICY_ORIG 
SEDIFFX_POLICY_MOD 
SEDIFFX_POLICY_NUM 

Definition at line 38 of file sediffx.h.

00039 {
00040         SEDIFFX_POLICY_ORIG = 0, SEDIFFX_POLICY_MOD, SEDIFFX_POLICY_NUM
00041 } sediffx_policy_e;


Function Documentation

void sediffx_set_policy sediffx_t s,
sediffx_policy_e  which,
apol_policy_t policy,
apol_policy_path_t path
 

Set one of the policies for sediffx.

This will invalidate any currently executed poldiff_t objects.

Parameters:
s sediffx object to query.
which Which policy to set.
policy New policy file for sediffx. If NULL then no policy is opened. Afterwards sediffx takes ownership of the policy.
path If policy is not NULL, then the path that was used to open the policy.

Definition at line 55 of file sediffx.c.

References apol_policy_destroy(), apol_policy_path_destroy(), apol_policy_path_t, apol_policy_t, sediffx::paths, sediffx::poldiff, poldiff_destroy(), sediffx::policies, and sediffx_t.

Referenced by toplevel_open_policies().

00056 {
00057         poldiff_destroy(&s->poldiff);
00058         if (policy != NULL) {
00059                 apol_policy_destroy(&s->policies[which]);
00060                 s->policies[which] = policy;
00061                 if (path != s->paths[which]) {
00062                         apol_policy_path_destroy(&s->paths[which]);
00063                 }
00064                 s->paths[which] = path;
00065         } else {
00066                 apol_policy_destroy(&s->policies[which]);
00067                 apol_policy_path_destroy(&s->paths[which]);
00068         }
00069 }

const apol_policy_path_t* sediffx_get_policy_path sediffx_t s,
const sediffx_policy_e  which
 

Return the policy path for the policy given.

If the policy has not yet been loaded then return NULL.

Parameters:
s sediffx object to query.
which Which policy path to get.
Returns:
Path to the policy, or NULL if none set.

Definition at line 71 of file sediffx.c.

References apol_policy_path_t, sediffx::paths, and sediffx_t.

Referenced by toplevel_on_open_activate(), toplevel_on_open_policies_button_click(), and toplevel_update_title_bar().

00072 {
00073         return sediffx->paths[which];
00074 }

poldiff_t* sediffx_get_poldiff sediffx_t s,
poldiff_handle_fn_t  fn,
void *  arg
 

Return the currently active poldiff object.

If one is not yet created or if a policy has changed since the last time this function was called, then build a new one and return it. Note that this does not actually call poldiff_run(); it is up to the caller of this function to do that.

Parameters:
s sediffx object to query.
fn If a poldiff object is being created, a valid callback function to receive poldiff messages.
arg Arbitrary argument to poldiff callback handler.
Returns:
Poldiff object for currently loaded policies, or NULL upon error.

Definition at line 76 of file sediffx.c.

References sediffx::poldiff, poldiff_create(), poldiff_t, sediffx::policies, SEDIFFX_POLICY_MOD, SEDIFFX_POLICY_ORIG, and sediffx_t.

Referenced by toplevel_get_poldiff(), and toplevel_run_diff_runner().

00077 {
00078         if (s->poldiff != NULL) {
00079                 return s->poldiff;
00080         }
00081         if (s->policies[SEDIFFX_POLICY_ORIG] == NULL || s->policies[SEDIFFX_POLICY_MOD] == NULL) {
00082                 return NULL;
00083         }
00084         s->poldiff = poldiff_create(s->policies[SEDIFFX_POLICY_ORIG], s->policies[SEDIFFX_POLICY_MOD], fn, arg);
00085         if (s->poldiff != NULL) {
00086                 /* poldiff_create() took ownership of the policies */
00087                 s->policies[SEDIFFX_POLICY_ORIG] = NULL;
00088                 s->policies[SEDIFFX_POLICY_MOD] = NULL;
00089         }
00090         return s->poldiff;
00091 }

void sediffx_set_poldiff_run_flags sediffx_t s,
uint32_t  flags
 

Set the flags that were used to run a poldiff.

This function should be called immediately proceeding a call to poldiff_run().

Parameters:
s sediffx object that contained the poldiff object that ran.
flags Flags for that were used during the run.
See also:
sediffx_get_poldiff_run_flags

Definition at line 93 of file sediffx.c.

References sediffx::flags, and sediffx_t.

Referenced by toplevel_run_diff_runner().

00094 {
00095         s->flags = flags;
00096 }

uint32_t sediffx_get_poldiff_run_flags sediffx_t s  ) 
 

Get the flags that were used to run a poldiff.

Parameters:
s sediffx object to query.
Returns:
poldiff run flags, or 0 in none set.
See also:
sediffx_set_poldiff_run_flags

Definition at line 98 of file sediffx.c.

References sediffx::flags, and sediffx_t.

Referenced by toplevel_get_poldiff_run_flags().

00099 {
00100         return s->flags;
00101 }