kre_threads.h File Reference

kREproxy threads management interface More...

#include <linux/kthread.h>
#include <linux/netdevice.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <asm/semaphore.h>
#include "kre_debug.h"
#include "kre_network.h"

Go to the source code of this file.

Data Structures

struct  kre_thread
 kREproxy thread representation More...

Defines

#define KRE_NAME   "kreproxythread"
#define KRE_NOT_INITIALIZED   0
#define KRE_INITIALIZED   1
#define KRE_RUNNING   2
#define KRE_SHOULD_STOP   3
#define KRE_COMPLETED   4
#define KRE_MAX_THREADS   10

Typedefs

typedef struct kre_thread kre_threads [10]
 kREproxy thread group representation This should be declared once in global scope.

Functions

void kre_threads_register_one_thread (struct kre_thread *t)
 Registration one thread.
void kre_threads_register (kre_threads *)
 Registration group of thread.
int kre_threads_unregister (kre_threads *)
 Unregistration group of thread.
int kre_threads_init (struct kre_thread *t, int(*f)(void *), void *data)
 Initialization of thread.
int kre_threads_start (struct kre_thread *t)
 Starting the new thread.
struct kre_threadkre_threads_fff (kre_threads t)
 Find Firs Free kre_thread structure.
int kre_threads_find_by_pid (pid_t p, kre_threads t)
 Find localization of kre_thread in kre_threads set by pid.
struct kre_threadkre_threads_get_by_id (int id, kre_threads t)
 Return kre thread by id.
void kre_threads_complete (struct kre_thread *t)
 Set things, and inform other task that actual task is completed.
int kre_threads_should_work (struct kre_thread *t)
 It can tell whether kthread should work or finish all jobs.
int kre_threads_stop (struct kre_thread *t)
 The main cause of exist this function is to kill main kreproxy server thread in clear way.


Detailed Description

kREproxy threads management interface


Function Documentation

void kre_threads_complete ( struct kre_thread t  ) 

Set things, and inform other task that actual task is completed.

Parameters:
t Current kre thread structure.

struct kre_thread* kre_threads_fff ( kre_threads  t  )  [read]

Find Firs Free kre_thread structure.

Parameters:
t Set of threads to search.
Returns:
Thread which was found or NULL.

int kre_threads_find_by_pid ( pid_t  p,
kre_threads  t 
)

Find localization of kre_thread in kre_threads set by pid.

Parameters:
p Function search t set looking for pid p.
t Set of kre threads.
Returns:
id of kre_thread struct in set of kre threads or -1 if not found.

struct kre_thread* kre_threads_get_by_id ( int  id,
kre_threads  t 
) [read]

Return kre thread by id.

Parameters:
id Identyficator returned for example by kre_threads_find_by_pid().
t Set of kre threads.

int kre_threads_init ( struct kre_thread t,
int(*)(void *)  f,
void *  data 
)

Initialization of thread.

Parameters:
t Thread to initlize.
f Thread function.
data Pointer to external thread data. NOT WORK AT NOW.
Returns:
Error report or 0 if ok.

void kre_threads_register_one_thread ( struct kre_thread t  ) 

Registration one thread.

This can be used to register main kREproxy server thread.

int kre_threads_should_work ( struct kre_thread t  ) 

It can tell whether kthread should work or finish all jobs.

Parameters:
t Current thread structure.
Returns:
0 - if should stop, 1 - if should work.

int kre_threads_start ( struct kre_thread t  ) 

Starting the new thread.

Parameters:
t Kreporxy thread to start.
Returns:
Error report.

int kre_threads_stop ( struct kre_thread t  ) 

The main cause of exist this function is to kill main kreproxy server thread in clear way.

Parameters:
t kre_thread structure with running task.
Returns:
Error output.


Generated on Fri Feb 20 19:46:05 2009 for kREproxy by  doxygen 1.5.8