/*
	WARNING: This file was generated by dkct.
	Changes you make here will be lost if dkct is run again!
	You should modify the original source and run dkct on it.
	Original source: printqdi.ctr
*/

/*
Copyright (C) 2012-2013, Dirk Krause

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
  this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above opyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.
* Neither the name of the author nor the names of contributors may be used
  to endorse or promote products derived from this software without specific
  prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/**	@file printqdi.h Header file for the printqdi module.
*/

#ifndef PRINTQDI_H_INCLUDED
/** Avoid multiple inclusions. */
#define PRINTQDI_H_INCLUDED 1


#line 9 "printqdi.ctr"


/**	Preprocessor directive to write statistics.
*/
#define	DK3_PRINTQDI_STATISTICS	1

#include "dk3all.h"

#if DK3_CHAR_SIZE == 1
#if DK3_HAVE_PTHREAD_H

#include <stdio.h>
#if DK3_HAVE_STDLIB_H
#include <stdlib.h>
#endif
#if DK3_HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <pthread.h>
#include "printqd.h"



/**	Per-thread structure for printqdi.
*/
typedef struct {
  char			usn[109];	/**< UNIX domain socket name. */
  pthread_mutex_t	mux;		/**< Mutex to protect access to rs. */
  pthread_t		thr;		/**< Thread ID. */
  dk3_socket_t		sock;		/**< Session socket. */
  int			rs;	/**< Run state: 1=running, 0=finished. */
} pqdi_thread_t;



/**	Job structure for printqdi.
*/
typedef struct {
  pthread_attr_t	 tha;	/**< Default thread attributes. */
  pthread_mutexattr_t	 mxa;	/**< Default mutex attributes. */
  pqd_conf_t		 conf;	/**< Configuration. */
  dk3_app_t		*app;	/**< Application structure. */
  dkChar const * const	*lm;	/**< Localized message texts. */
  dkChar const * const	*clm;	/**< Localized message texts for conf. */
  dk3_sto_t		*sth;	/**< Storage for thread structures. */
  dk3_sto_it_t		*ith;	/**< Iterator through threads storage. */
  int			 cco;	/**< Flag: Can continue outer loop. */
} pqdi_job_t;

#endif
#endif


#endif
