Changeset 166

Show
Ignore:
Timestamp:
06/15/05 10:44:14
Author:
rachel
Message:

Doxygen markup added to all functions used by current example programs.
Functions defined in groups for better documentation layout

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openpgpsdk/trunk/doc/doxygen-user.cfg

    r135 r166  
    108108# to NO the shortest path that makes the file name unique will be used. 
    109109 
    110 FULL_PATH_NAMES        = YES 
     110FULL_PATH_NAMES        = NO 
    111111 
    112112# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag  
  • openpgpsdk/trunk/examples/packet-dump.c

    r165 r166  
    104104    } 
    105105 
     106static void printhex(const unsigned char *src,size_t length) 
     107    { 
     108    while(length--) 
     109        printf("%02X",*src++); 
     110    } 
     111 
    106112static void print_hexdump( char *name, 
    107113                          const unsigned char *data, 
     
    111117 
    112118    printf("len=%d, data=0x", len); 
    113     hexdump(data,len); 
     119    printhex(data,len); 
    114120    printf("\n"); 
    115121    } 
     
    122128 
    123129    printf("0x"); 
    124     hexdump(data,len); 
     130    printhex(data,len); 
    125131    printf("\n"); 
    126132    } 
  • openpgpsdk/trunk/src/accumulate.c

    r135 r166  
    264264 
    265265/*! \todo descr for ops_parse_and_accumulate */ 
     266/** 
     267 * \ingroup Parse 
     268 * 
     269 * ops_parse_and_accumulate() calls ops_parse() with accumulate_cb() to do 
     270 * something I'm not clear what. It then calls dump_key_data() on the keyring,  
     271 * and validates all signatures on it.  
     272 * \param keyring 
     273 * \param opt 
     274 * \todo Get Ben to shed some light on this darkness 
     275*/ 
     276 
    266277void ops_parse_and_accumulate(ops_keyring_t *keyring,ops_parse_options_t *opt) 
    267278    { 
  • openpgpsdk/trunk/src/create.c

    r138 r166  
    8282// the safe (i.e. non _fast_) version will, and so will also need to 
    8383// be freed. 
     84 
     85/** 
     86 * \ingroup Create 
     87 * 
     88 * ops_fast_create_user_id() sets #id->user_id to the given #user_id. 
     89 * This is fast because it is only copying a char*. However, if #user_id 
     90 * is changed or freed in the future, this could have injurious results. 
     91 * \param id 
     92 * \param user_id 
     93 */ 
     94 
    8495void ops_fast_create_user_id(ops_user_id_t *id,char *user_id) 
    8596    { 
     
    8798    } 
    8899 
     100/** 
     101 * \ingroup Create 
     102 * 
     103 * Writes a User Id from the information held in #id and #opt 
     104 * 
     105 * \param id 
     106 * \param opt 
     107 * \return Return value from ops_write() unless call to ops_write_ptag() or ops_write_length() failed before it was called, in which case returns 0 
     108 * \todo tidy up that return value description! 
     109 */ 
    89110ops_boolean_t ops_write_struct_user_id(ops_user_id_t *id, 
    90111                                       ops_create_options_t *opt) 
     
    175196    } 
    176197 
     198/** 
     199 * \ingroup Create 
     200 * 
     201 * Writes a Public Key from the information held in #key and #opt 
     202 * 
     203 * \param key 
     204 * \param opt 
     205 * \return Return value from write_public_key_body() unless call to ops_write_ptag() or ops_write_length() failed before it was called, in which case returns 0 
     206 * \todo tidy up that return value description! 
     207 */ 
    177208ops_boolean_t ops_write_struct_public_key(const ops_public_key_t *key, 
    178209                                          ops_create_options_t *opt) 
     
    185216    } 
    186217 
     218/** 
     219 * \ingroup Create 
     220 * 
     221 * Writes an RSA public key. 
     222 * 
     223 * \param time 
     224 * \param n 
     225 * \param e 
     226 * \param opt  
     227 * 
     228 * \return result from ops_write_struct_public_key() 
     229 *  
     230 * \todo get better definition of return values 
     231 * \todo get better description of usage. What writers are provided? When do they get setup? How are you supposed to use this? 
     232 */ 
     233 
    187234ops_boolean_t ops_write_rsa_public_key(time_t time,const BIGNUM *n, 
    188235                                       const BIGNUM *e, 
  • openpgpsdk/trunk/src/fingerprint.c

    r135 r166  
    6666    } 
    6767 
     68/** 
     69 * \ingroup Utils 
     70 * 
     71 * Not sure what this does 
     72 * 
     73 * \param keyid 
     74 * \param key 
     75 * 
     76 * \todo Get descr from Ben what this does 
     77 */ 
     78 
    6879void ops_keyid(unsigned char keyid[8],const ops_public_key_t *key) 
    6980    { 
  • openpgpsdk/trunk/src/keyring.c

    r135 r166  
    4141    } 
    4242 
     43/** 
     44 * \ingroup Memory 
     45 * 
     46 * ops_keyring_free() frees the memory used in one ops_keyring_t structure 
     47 * \param keyring Keyring to be freed. 
     48 */ 
    4349void ops_keyring_free(ops_keyring_t *keyring) 
    4450    { 
  • openpgpsdk/trunk/src/packet-parse.c

    r158 r166  
    11/** \file 
    22 * \brief Parser for OpenPGP packets 
     3 */ 
     4 
     5/** @defgroup PublicAPI Public API 
     6 * These functions are public and available for external use. 
     7 * @{ 
     8 */ 
     9/** 
     10 * @defgroup Parse Parse 
     11 * These functions allow an OpenPGP object (for example, an OpenPGP message or keyring) to be parsed. 
     12 * @ingroup PublicAPI 
     13 */ 
     14/** 
     15 * @defgroup Create Create 
     16 * These functions allow an OpenPGP object to be created. 
     17 * @ingroup PublicAPI 
     18 */ 
     19/** 
     20 * @defgroup Memory Memory 
     21 * These functions relate to memory usage. 
     22 * @ingroup PublicAPI 
     23 */ 
     24/** 
     25 * @defgroup Show Show 
     26 * These functions allow the contents to be displayed in human-readable form. 
     27 * @ingroup PublicAPI 
     28 */ 
     29/** 
     30 * @defgroup Utils Utils 
     31 * These functions are of general utility 
     32 * @ingroup PublicAPI 
     33 */ 
     34/** 
     35 * @} 
    336 */ 
    437 
     
    14371470    } 
    14381471 
     1472/** 
     1473 * \ingroup Memory 
     1474 * 
     1475 * ops_secret_key_free() frees the memory associated with #key. Note that 
     1476 * the key itself is not freed. 
     1477 *  
     1478 * \param key 
     1479 */ 
     1480 
    14391481void ops_secret_key_free(ops_secret_key_t *key) 
    14401482    { 
     
    16261668    } 
    16271669 
    1628 /** Parse packets. 
    1629  * 
     1670/** 
     1671 * \ingroup Parse 
     1672 *  
    16301673 * Parses packets calling #ops_parse_one_packet until an error occurs or until EOF (which is just another error anyway). 
    16311674 * 
     
    16431686    } 
    16441687 
    1645 /* XXX: Make all packet types optional, not just subpackets */ 
    16461688/** 
    1647  * Setup packet options, depending on packet tag and parsing type 
     1689 * \ingroup Parse 
     1690 * 
     1691 * ops_parse_options() sets up the packet options in #*opt, depending on  
     1692 * the packet tag #tag and the parsing type #type 
     1693 * \param       opt     Pointer to previously allocated structure 
     1694 * \param       tag     Packet tag 
     1695 * \param       type    Parse type 
     1696 * \todo  XXX: Make all packet types optional, not just subpackets 
    16481697 */ 
    16491698void ops_parse_options(ops_parse_options_t *opt, 
  • openpgpsdk/trunk/src/packet-show.c

    r165 r166  
    325325    } 
    326326 
    327 /*! generic function to free memory used by ops_text_t structure */ 
     327/** 
     328 * \ingroup Memory 
     329 * 
     330 * ops_text_free() frees the memory used by an ops_text_t structure 
     331 * 
     332 * \param text Pointer to a previously allocated structure. This structure and its contents will be freed. 
     333 */ 
    328334void ops_text_free(ops_text_t *text) 
    329335    { 
     
    475481    } 
    476482 
    477 /*! returns string derived from the type of the Signature Sub-Packet */ 
     483/** 
     484 * \ingroup Show 
     485 * 
     486 * ops_show_ss_type() returns a string pointer which 
     487 * represents the type of the Signature Sub-Packet 
     488 * \param ss_type Signature Sub-Packet type 
     489 * \return string or "Unknown" 
     490 */ 
    478491char *ops_show_ss_type(ops_ss_type_t ss_type) 
    479492    { 
     
    481494    } 
    482495 
    483 /*! returns string derived from the type of the SS Revocation Reaspon */ 
     496/** 
     497 * \ingroup Show 
     498 * 
     499 * ops_show_rr_code() returns a pointer to a string which 
     500 * represents the Revocation Reason code 
     501 * \param ss_rr_code Revocation Reason code 
     502 * \todo add reference 
     503 * \todo make typesafe 
     504 * \return string or "Unknown" 
     505 */ 
    484506char *ops_show_ss_rr_code(ops_ss_rr_code_t ss_rr_code) 
    485507    { 
     
    493515    } 
    494516 
    495 /*! returns all text derived from this signature sub-packet type */ 
     517/** 
     518 * \ingroup Show 
     519 * 
     520 * ops_showall_ss_preferred_compression() returns a pointer to an ops_text_t  
     521 * structure which contains strings representing the Compression Algorithms 
     522 * in the preferred list 
     523 * \param ss_preferred_compression Array of Preferred Compression Algorithms 
     524 * \return NULL if cannot allocate memory or other error 
     525 * \return pointer to structure, if no error 
     526 * \todo make typesafe 
     527 */ 
    496528ops_text_t *ops_showall_ss_preferred_compression(ops_ss_preferred_compression_t ss_preferred_compression) 
    497529    { 
     
    501533 
    502534 
    503 /*! returns string derived from a single octet in this field */ 
    504 char *ops_show_hash_algorithm(unsigned char octet) 
    505     { 
    506     return(str_from_map(octet,hash_algorithm_map)); 
    507     } 
    508  
    509 /*! returns all text derived from this signature sub-packet type */ 
     535/** 
     536 * \ingroup Show 
     537 * 
     538 * ops_show_hash_algorithm() returns a pointer to a string which 
     539 * represents the Hash Algorithm type 
     540 * \param hash Hash Algorithm type 
     541 * \todo add reference 
     542 * \todo make typesafe 
     543 * \return string or "Unknown" 
     544 */ 
     545char *ops_show_hash_algorithm(unsigned char hash) 
     546    { 
     547    return(str_from_map(hash,hash_algorithm_map)); 
     548    } 
     549 
     550/** 
     551 * \ingroup Show 
     552 * 
     553 * ops_showall_ss_preferred_hash() returns a pointer to an ops_text_t  
     554 * structure which contains strings representing the Hash Algorithms 
     555 * in the preferred list 
     556 * \param ss_preferred_hash Array of Preferred Hash Algorithms 
     557 * \return NULL if cannot allocate memory or other error 
     558 * \return pointer to structure, if no error 
     559 * \todo make typesafe 
     560 */ 
    510561ops_text_t *ops_showall_ss_preferred_hash(ops_ss_preferred_hash_t ss_preferred_hash) 
    511562    { 
     
    514565    } 
    515566 
    516 /*! returns string derived from signature type value */ 
     567/** 
     568 * \ingroup Show 
     569 * 
     570 * ops_show_sig_type() returns a pointer to a string which 
     571 * represents the Signature type 
     572 * \param sig_type Signature type 
     573 * \todo add reference 
     574 * \return string or "Unknown" 
     575 */ 
    517576char *ops_show_sig_type(ops_sig_type_t sig_type) 
    518577    { 
     
    520579    } 
    521580 
    522 /*! returns string derived from PKA type */ 
     581/** 
     582 * \ingroup Show 
     583 * 
     584 * ops_show_pka() returns a pointer to a string which 
     585 * represents the Public Key Algorithm 
     586 * \param pka Public Key Algorithm type 
     587 * \todo add reference 
     588 * \return string or "Unknown" 
     589 */ 
    523590char *ops_show_pka(ops_public_key_algorithm_t pka) 
    524591    { 
     
    532599    } 
    533600 
    534 /*! returns all text derived from this signature sub-packet type */ 
     601/** 
     602 * \ingroup Show 
     603 * 
     604 * ops_showall_ss_preferred_ska() returns a pointer to an ops_text_t structure 
     605 * which contains strings representing the Secret Key Algorithms 
     606 * in the preferred list 
     607 * \param ss_preferred_ska Array of Preferred Secret Key Algorithms 
     608 * \return NULL if cannot allocate memory or other error 
     609 * \return pointer to structure, if no error 
     610 * \todo make typesafe 
     611 */ 
    535612ops_text_t *ops_showall_ss_preferred_ska(ops_ss_preferred_ska_t ss_preferred_ska) 
    536613    { 
     
    545622    } 
    546623 
    547 /*! returns all text derived from this signature sub-packet type */ 
     624/** 
     625 * \ingroup Show 
     626 * 
     627 * ops_showall_ss_features() returns a pointer to an ops_text_t  
     628 * structure which contains strings representing the  
     629 * Signature Sub-Packet Features given in #ss_features 
     630 * \param ss_features Signature Sub-Packet Features 
     631 * \return NULL if cannot allocate memory or other error 
     632 * \return pointer to structure, if no error 
     633 * \todo make typesafe 
     634 * \todo add reference 
     635 */ 
    548636ops_text_t *ops_showall_ss_features(ops_ss_features_t ss_features) 
    549637    { 
     
    575663    } 
    576664 
    577 /*! returns all text derived from this signature sub-packet type */ 
     665/** 
     666 * \ingroup Show 
     667 * 
     668 * ops_showall_ss_notation_data_flags() returns a pointer to an ops_text_t  
     669 * structure containing strings representing the  
     670 * Signature Sub-Packet Notation Data Flags given in #ss_notation_data 
     671 * \param ss_notation_data Signature Sub-Packet Notation Data 
     672 * \return NULL if cannot allocate memory or other error 
     673 * \return pointer to structure, if no error 
     674 * \todo make typesafe 
     675 * \todo add reference 
     676 */ 
    578677ops_text_t *ops_showall_ss_notation_data_flags(ops_ss_notation_data_t ss_notation_data) 
    579678    { 
     
    587686    } 
    588687 
    589 /*! returns all text derived from this signature sub-packet type */ 
     688/** 
     689 * \ingroup Show 
     690 * 
     691 * ops_showall_ss_key_flags() returns a pointer to an ops_text_t  
     692 * structure which contains strings representing the Key Flags 
     693 * in the preferred list 
     694 * \param ss_key_flags Array of Key Flags 
     695 * \return NULL if cannot allocate memory or other error 
     696 * \return pointer to structure, if no error 
     697 * \todo make typesafe 
     698 */ 
    590699ops_text_t *ops_showall_ss_key_flags(ops_ss_key_flags_t ss_key_flags) 
    591700    { 
     
    617726    } 
    618727 
    619 /*! returns string derived from one bitfield in this signature-subpacket type */ 
    620 char *ops_show_ss_key_server_prefs(unsigned char octet, bit_map_t *map) 
    621     { 
    622     return(str_from_bitfield(octet,map)); 
     728/** 
     729 * \ingroup Show 
     730 * 
     731 * ops_show_ss_key_server_prefs() returns a string pointer 
     732 * which represents the user's preferences that should be 
     733 * observed by the key server. 
     734 * 
     735 * \param prefs Byte containing bitfield of preferences 
     736 * \param map 
     737 * \return string or "Unknown" 
     738 * \todo add reference 
     739 * \todo make typesafe 
     740 */ 
     741char *ops_show_ss_key_server_prefs(unsigned char prefs, bit_map_t *map) 
     742    { 
     743    return(str_from_bitfield(prefs,map)); 
    623744    } 
    624745 
  • openpgpsdk/trunk/src/signature.c

    r142 r166  
    247247    } 
    248248 
     249/** 
     250 * \ingroup Create 
     251 * 
     252 * ops_signature_start() creates a V4 signature with a SHA1 hash. 
     253 *  
     254 * \param sig 
     255 * \param key 
     256 * \param id 
     257 * \param type 
     258 * \todo Expand description. 
     259 */ 
    249260void ops_signature_start(ops_create_signature_t *sig, 
    250261                         const ops_public_key_t *key, 
     
    285296    } 
    286297 
     298/** 
     299 * \ingroup Create 
     300 * 
     301 * Mark the end of the hashed subpackets in the signature 
     302 * 
     303 * \param sig 
     304 */ 
     305 
    287306void ops_signature_hashed_subpackets_end(ops_create_signature_t *sig) 
    288307    { 
     
    295314    } 
    296315 
     316/** 
     317 * \ingroup Create 
     318 * 
     319 * Write out a signature 
     320 * 
     321 * \param sig 
     322 * \param key 
     323 * \param skey 
     324 * \param opt 
     325 * 
     326 * \todo get a better description of how/when this is used 
     327 */ 
     328 
    297329void ops_write_signature(ops_create_signature_t *sig,ops_public_key_t *key, 
    298330                         ops_secret_key_t *skey,ops_create_options_t *opt) 
     
    321353    } 
    322354 
     355/** 
     356 * \ingroup Create 
     357 *  
     358 * ops_signature_add_creation_time() adds a creation time to the signature. 
     359 *  
     360 * \param sig 
     361 * \param when 
     362 */ 
    323363void ops_signature_add_creation_time(ops_create_signature_t *sig,time_t when) 
    324364    { 
     
    327367    } 
    328368 
     369/** 
     370 * \ingroup Create 
     371 * 
     372 * Adds issuer's key ID to the signature 
     373 * 
     374 * \param sig 
     375 * \param keyid 
     376 */ 
     377 
    329378void ops_signature_add_issuer_key_id(ops_create_signature_t *sig, 
    330379                                     const unsigned char keyid[OPS_KEY_ID_SIZE]) 
     
    334383    } 
    335384 
     385/** 
     386 * \ingroup Create 
     387 * 
     388 * Adds primary user ID to the signature 
     389 * 
     390 * \param sig 
     391 * \param keyid 
     392 */ 
    336393void ops_signature_add_primary_user_id(ops_create_signature_t *sig, 
    337394                                       ops_boolean_t primary) 
  • openpgpsdk/trunk/src/util.c

    r135 r166  
    1616    } 
    1717 
     18/** 
     19 * \ingroup Utils 
     20 * 
     21 * ops_init() just calls ops_crypto_init() 
     22 * \todo Ask Ben why we need this extra layer 
     23 */ 
     24 
    1825void ops_init(void) 
    1926    { 
    2027    ops_crypto_init(); 
    2128    } 
     29 
     30/** 
     31 * \ingroup Utils 
     32 * 
     33 * ops_finish() just calls ops_crypto_finish() 
     34 * \todo Ask Ben why we need this extra layer 
     35 */ 
    2236 
    2337void ops_finish(void) 
     
    2640    } 
    2741 
     42/** 
     43 * \ingroup Parse 
     44 * 
     45 * ops_reader_fd() attempts to read up to #plength bytes from the file  
     46 * descriptor in #arg_ into the buffer starting at #dest using the 
     47 * rules contained in #flags 
     48 *  
     49 * \param       dest    Pointer to previously allocated buffer 
     50 * \param       plength Number of bytes to try to read 
     51 * \param       flags   Rules about reading to use 
     52 * \param       arg_    Gets cast to #ops_reader_fd_arg_t 
     53 * 
     54 * \return      OPS_R_EOF       if no bytes read 
     55 * \return      OPS_R_PARTIAL_READ      if not enough bytes read, and OPS_RETURN_LENGTH set in #flags 
     56 * \return      OPS_R_EARLY_EOF if not enough bytes read, and OPS_RETURN_LENGTH not set in #flags 
     57 * \return      OPS_R_OK        if expected length read 
     58 * \todo change arg_ to typesafe?  
     59 */ 
    2860ops_reader_ret_t ops_reader_fd(unsigned char *dest,unsigned *plength, 
    2961                               ops_reader_flags_t flags,void *arg_) 
     
    5385    } 
    5486 
     87/** 
     88 * \ingroup Create 
     89 * 
     90 * ops_writer_fd() attempts to write up to #length bytes  
     91 * to the file descriptor in #arg_ from the buffer #src  
     92 * using the rules contained in #flags 
     93 *  
     94 * \param       src 
     95 * \param       length Number of bytes to try to write 
     96 * \param       flags   Rules to use 
     97 * \param       arg_    Gets cast to #ops_writer_fd_arg_t 
     98 * 
     99 * \return      OPS_W_ERROR     if not enough bytes written 
     100 * \return      OPS_W_OK if all bytes written 
     101 * \todo change arg_ to typesafe?  
     102 */ 
    55103ops_writer_ret_t ops_writer_fd(const unsigned char *src,unsigned length, 
    56104                               ops_writer_flags_t flags,void *arg_)