Commit 92550b59 authored by jan.koester's avatar jan.koester
Browse files

added doxygen support

parent 9cb4ac05
Loading
Loading
Loading
Loading

doc/CMakeLists.txt

0 → 100644
+23 −0
Original line number Diff line number Diff line
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
option(BUILD_DOCUMENTATION "Create and install the HTML based API documentation (requires Doxygen)" ${DOXYGEN_FOUND})

if(BUILD_DOCUMENTATION)
    if(NOT DOXYGEN_FOUND)
        message(FATAL_ERROR "Doxygen is needed to build the documentation.")
    endif()

    set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
    set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)

    configure_file(${doxyfile_in} ${doxyfile} @ONLY)

    add_custom_target(doc
        COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile}
        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
        COMMENT "Generating API documentation with Doxygen"
        VERBATIM)

    install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc/libsecureid)
endif()

doc/Doxyfile.in

0 → 100644
+11 −0
Original line number Diff line number Diff line
PROJECT_NAME           = "@CMAKE_PROJECT_NAME@"
PROJECT_NUMBER         = @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
STRIP_FROM_PATH        = @PROJECT_SOURCE_DIR@ \
                         @PROJECT_BINARY_DIR@
INPUT                  = @doxy_main_page@ \
                         @PROJECT_SOURCE_DIR@ \
                         @PROJECT_BINARY_DIR@
FILE_PATTERNS          = *.h \
                         *.cpp
RECURSIVE              = YES
USE_MDFILE_AS_MAINPAGE = @doxy_main_page@
+12 −12
Original line number Diff line number Diff line
@@ -197,43 +197,43 @@ int parseSID(struct SID *sid,const char *input,int size){
    return sid->SubAuthorityCount;
};

int printSID(struct SID *sid,char *input,int size){
int printSID(struct SID *sid,char *output,int size){
    int written = 0;
    input[written++]='S';
    input[written++]='-';
    input[written++]=sid->Revesion+'0';
    input[written++]='-';
    output[written++]='S';
    output[written++]='-';
    output[written++]=sid->Revesion+'0';
    output[written++]='-';

    int i,z=0,ii;

    for(ii=0; ii<6; ++ii){
        if(sid->IdentifierAuthority.Value[ii]!=0){
            input[written++]=sid->IdentifierAuthority.Value[ii]+'0';
            output[written++]=sid->IdentifierAuthority.Value[ii]+'0';
            z=1;
        }
    }

    if(z==0)
        input[written++]='0';
        output[written++]='0';

    input[written++]='-';
    output[written++]='-';

    char ct[255];
    uint32_t ctt=uint32_t2string(sid->SubAuthorityCount,ct,10);
    memcpy32(input+written,&ct,ctt);
    memcpy32(output+written,&ct,ctt);
    written += ctt;
    if(sid->SubAuthorityCount!=0){
        for (int ii = 0; ii <  (sid->SubAuthorityCount/sizeof(uint32_t))-1; ++ii) {
            if(written>size)
                break;
            input[written++]='-';
            output[written++]='-';
            char tmp[255];
            uint32_t wt=uint32_t2string(sid->SubAuthority[ii],tmp,10);
            memcpy32(input+written,&tmp,wt);
            memcpy32(output+written,&tmp,wt);
            written += wt;
        }
    }
    input[written]='\0';
    output[written]='\0';
    return written;
};

+53 −1
Original line number Diff line number Diff line
@@ -41,29 +41,81 @@ extern Authority ResourceManager;
extern Authority MandatoryLevel;

struct SID_IDENTIFIER_AUTHORITY {
    /**
    * Stores authority;
    */
    uint8_t Value[6];
};

struct SID {
    /**
    * The revesion mostly 1
    */
    uint8_t                         Revesion;
    /**
    * The count of subauthority
    */
    uint8_t                         SubAuthorityCount;
    /**
    * The authority type
    */
    struct SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
    /**
    * The SubAuthority identifier value
    * Waring the real size is subauthoritycount
    */
    uint32_t                        SubAuthority[1];
};

#ifdef __cplusplus
extern "C" {
#endif
    /**
    * With this function will be the memory allocated for SID struct and set as NULL Authority
    * Don't do that by malloc,calloc or new its a 32bit pointer !!
    * @param sid that will be initalized
    **/
    void initSID(struct SID **sid);

    /**
    * With this function will be the memory dellocated for SID struct
    * Don't do that with free or delete its a 32bit pointer !!
    * @param sid that will be dellocated
    **/
    void destroySID(struct SID *sid);

    /**
    * This function will copy from sid to another sid struct
    * importend you initSID for dest before you copy !!
    * @param dest copy destination
    * @param src copy source
    **/
    int  SIDcpy(struct SID *dest,struct SID *src);

    /**
    * This function will set your Authority for example NT look for Authority type.
    * @param sid SID struct set will be the value set
    * @param authority type of authority that genarated the Identifier
    * @param uid the indentifier array that will you set
    * @param count the indentifier array size
    **/
    void setAuthority(struct SID *sid,Authority authority,uint32_t* uid,uint8_t count);

    /**
    * This function will be parse a sid cstring to struct sid
    * @param sid SID struct set will be the destination for parsing
    * @param input a cstring that included the secure indentfier
    * @param size the length of the input
    **/
    int parseSID(struct SID *sid,const char *input,int size);

    int printSID(struct SID *sid,char *input,int size);
    /**
    * This function will be parse a sid cstring to struct sid
    * @param sid SID struct set will be the source for printing
    * @param output a cstring that included the secure indentfier
    * @param size the maximum size that output can be carrier
    **/
    int printSID(struct SID *sid,char *output,int size);

#ifdef __cplusplus
};
+0 −2
Original line number Diff line number Diff line
@@ -30,8 +30,6 @@

#include "secureid.h"

#define _POSIX_C_SOURCE 200809L

int main(int argc, char *argv[]){
    int read=0;