Skip to content
Snippets Groups Projects
Select Git revision
  • labcomm2014
  • labcomm2006
  • master default
  • python_sig_hash
  • typedefs
  • anders.blomdell
  • typeref
  • pragma
  • compiler-refactoring
  • labcomm2013
  • v2014.6
  • v2015.0
  • v2014.5
  • v2014.4
  • v2006.0
  • v2014.3
  • v2014.2
  • v2014.1
  • v2014.0
  • v2013.0
20 results

labcomm_mem_writer.h

Blame
  • labcomm_mem_writer.h 1013 B
    #ifndef LABCOMM_MEM_WRITER_H
    #define LABCOMM_MEM_WRITER_H
    
    #include "labcomm.h"
    
    /* Wrapper structure for the memory buffer including a writer position. */
    typedef struct labcomm_mem_writer_context_t labcomm_mem_writer_context_t;
    struct labcomm_mem_writer_context_t {
      size_t write_pos;  // Position where next write should be.
      size_t length;  // Length of the buffer.
      unsigned char *buf;  // Allocated destination buffer.
    };
    
    int labcomm_mem_writer(labcomm_writer_t *w, labcomm_writer_action_t action, ...);
    
    /* Wrapper the internal static function copy_data. This is needed so that the exceptions can be unit tested. */
    void test_copy_data(labcomm_writer_t *w, labcomm_mem_writer_context_t *mcontext, unsigned char *mbuf);
    
    /* Allocate new labcomm_mem_writer_context_t. */
    labcomm_mem_writer_context_t *labcomm_mem_writer_context_t_new(size_t init_pos, size_t length, unsigned char *buf);
    
    /* Deallocate mcontext. */
    void labcomm_mem_writer_context_t_free(labcomm_mem_writer_context_t **mcontext);
    
    #endif