Ignore:
Timestamp:
06/06/10 20:36:27 (14 years ago)
Author:
tim
Message:

began implementing independent python subkey and value iterators

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python2/regfi/pyregfi.h

    r200 r202  
    11/*
    2 ** regfi.h
    3 **
    4 ** Made by mic
    5 ** Login   <mic@laptop>
    6 **
    7 ** Started on  Fri Apr 30 02:06:43 2010 mic
    8 ** Last update Fri Apr 30 02:06:43 2010 mic
    9 */
     2 * Top-level definitions for pyregfi to be processed by Michael Cohen's
     3 * automated Python bindings generator.
     4 *
     5 * Copyright (C) 2010 Michael I. Cohen
     6 * Copyright (C) 2010 Timothy D. Morgan
     7 *
     8 * This program is free software; you can redistribute it and/or modify
     9 * it under the terms of the GNU General Public License as published by
     10 * the Free Software Foundation; version 3 of the License.
     11 *
     12 * This program is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20 *
     21 * $Id: $
     22 *
     23 */
    1024
    1125#ifndef         PYREGFI_H_
    1226# define        PYREGFI_H_
     27
    1328#include "class.h"
    1429#include "aff4_errors.h"
    1530#include "regfi.h"
    1631
    17 /** Forward declerations */
     32/** Forward declarations */
    1833struct RegistryFile_t;
     34struct RegistryKey_t;
     35struct SubkeyIterator_t;
    1936struct ValueIterator_t;
     37struct TreeIterator_t;
    2038
    2139BIND_STRUCT(REGFI_NK_REC)
     
    4664END_CLASS
    4765
    48 /** This is an iterator for reading keys from the registry */
    49 CLASS(KeyIterator, Object)
     66/** This is an iterator for traversing an entire registry hive */
     67CLASS(TreeIterator, Object)
    5068     PRIVATE REGFI_ITERATOR *iter;
     69     PRIVATE struct RegistryFile_t *file;
    5170     PRIVATE bool root_traversed;
    5271
    53      KeyIterator METHOD(KeyIterator, Con, struct RegistryFile_t *file, char **path,
    54                         REGFI_ENCODING encoding);
     72     struct TreeIterator_t *METHOD(TreeIterator, Con, struct RegistryFile_t *file,
     73                                   char **path, REGFI_ENCODING encoding);
    5574
    56      struct ValueIterator_t *METHOD(KeyIterator, list_values);
     75/*     struct ValueIterator_t *METHOD(TreeIterator, list_values);*/
    5776
    58      void METHOD(KeyIterator, __iter__);
    59      BORROWED REGFI_NK_REC *METHOD(KeyIterator, iternext);
     77     void METHOD(TreeIterator, __iter__);
     78     struct RegistryKey_t *METHOD(TreeIterator, iternext);
    6079
    61      int METHOD(KeyIterator, down);
    62      int METHOD(KeyIterator, up);
     80     int METHOD(TreeIterator, down);
     81     int METHOD(TreeIterator, up);
    6382END_CLASS
     83
     84
     85/** XXX */
     86CLASS(RegistryKey, Object)
     87     struct RegistryFile_t *file;
     88     const REGFI_NK_REC *key;      /* XXX: temporary */
     89
     90     struct RegistryKey_t *METHOD(RegistryKey, Con,
     91                                  struct RegistryFile_t *file, REGFI_NK_REC *base_key);
     92
     93     struct SubkeyIterator_t *METHOD(RegistryKey, subkeys);
     94     struct ValueIterator_t *METHOD(RegistryKey, values);
     95
     96END_CLASS
     97
     98
     99/** This is an iterator for reading keys from the registry */
     100CLASS(SubkeyIterator, Object)
     101     struct RegistryFile_t *file;
     102     PRIVATE const REGFI_SUBKEY_LIST *list;
     103     PRIVATE uint32_t cur;
     104     
     105     SubkeyIterator METHOD(SubkeyIterator, Con,
     106                           struct RegistryFile_t *file, REGFI_NK_REC *key);
     107
     108     void METHOD(SubkeyIterator, __iter__);
     109     RegistryKey METHOD(SubkeyIterator, iternext);
     110END_CLASS
     111
     112
    64113
    65114/** This is an iterator for reading values from the registry */
    66115CLASS(ValueIterator, Object)
    67      PRIVATE REGFI_ITERATOR *iter;
    68      PRIVATE bool first_called;
     116     struct RegistryFile_t *file;
     117     PRIVATE const REGFI_VALUE_LIST *list;
     118     PRIVATE uint32_t cur;
    69119     
    70      ValueIterator METHOD(ValueIterator, Con, KeyIterator key);
     120     ValueIterator METHOD(ValueIterator, Con,
     121                          struct RegistryFile_t *file, REGFI_NK_REC *key);
    71122
    72123     void METHOD(ValueIterator, __iter__);
    73124     REGFI_VK_REC *METHOD(ValueIterator, iternext);
    74125END_CLASS
     126
     127
    75128
    76129CLASS(RegistryFile, Object)
     
    83136     specified.
    84137
     138     XXX: can we switch to UTF-8 and have Python properly import that?
     139
    85140     DEFAULT(path) == NULL;
    86141     DEFAULT(encoding) = REGFI_ENCODING_ASCII;
    87142  */
    88   KeyIterator METHOD(RegistryFile, get_key, char **path, REGFI_ENCODING encoding);
     143  TreeIterator METHOD(RegistryFile, TreeIterator, char **path, REGFI_ENCODING encoding);
    89144
    90145  /** Set the verbosity level of messages generated by the library for the
Note: See TracChangeset for help on using the changeset viewer.