- removed strongswan includes, we are now self-contained ;-)

This commit is contained in:
Martin Willi 2005-11-10 09:17:23 +00:00
parent d62ea0ddf2
commit 67a57dc6f4
26 changed files with 28 additions and 88 deletions

View file

@ -23,9 +23,6 @@
*/
#include <stdlib.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "allocator.h"
#include "types.h"

View file

@ -21,9 +21,6 @@
*/
#include <stdio.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "types.h"
#include "tester.h"

View file

@ -25,9 +25,12 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "encodings.h"
#include "encodings/ike_header.h"
#include <stdlib.h>
#include "types.h"
#include "encodings.h"
#include "encodings/ike_header.h"
extern payload_info_t ike_header_info;

View file

@ -29,9 +29,8 @@
#ifndef ENCODINGS_H_
#define ENCODINGS_H_
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "types.h"
/**
* @brief All different kinds of encoding types.

View file

@ -25,9 +25,6 @@
#ifndef IKE_HEADER_H_
#define IKE_HEADER_H_
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
/**
* Data structure to hold the data of an IKEv2-Header

View file

@ -20,9 +20,6 @@
* for more details.
*/
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include <pthread.h>
#include <stdlib.h>

View file

@ -22,9 +22,6 @@
#include <stdlib.h>
#include <string.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "allocator.h"
#include "types.h"

View file

@ -22,9 +22,6 @@
#include <stdlib.h>
#include <string.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "allocator.h"
#include "types.h"

View file

@ -24,10 +24,6 @@
#ifndef IKE_SA_ID_H_
#define IKE_SA_ID_H_
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "types.h"
/**

View file

@ -21,9 +21,6 @@
*/
#include <stdlib.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "allocator.h"
#include "job.h"

View file

@ -22,9 +22,6 @@
#include <stdlib.h>
#include <pthread.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "allocator.h"
#include "job_queue.h"

View file

@ -21,9 +21,6 @@
*/
#include <stdlib.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "allocator.h"
#include "linked_list.h"

View file

@ -23,10 +23,6 @@
#ifndef LINKED_LIST_H_
#define LINKED_LIST_H_
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "types.h"
/**

View file

@ -23,11 +23,6 @@
#ifndef LOGGER_H_
#define LOGGER_H_
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "types.h"
/**

View file

@ -21,9 +21,6 @@
*/
#include <stdlib.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "allocator.h"
#include "types.h"

View file

@ -31,9 +31,6 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
/**

View file

@ -21,9 +21,6 @@
*/
#include <stdlib.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "allocator.h"
#include "types.h"

View file

@ -22,9 +22,6 @@
#include <stdlib.h>
#include <pthread.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "allocator.h"
#include "receiver.h"

View file

@ -22,9 +22,6 @@
#include <stdlib.h>
#include <pthread.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "allocator.h"
#include "scheduler.h"

View file

@ -22,9 +22,6 @@
#include <stdlib.h>
#include <pthread.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "allocator.h"
#include "sender.h"

View file

@ -28,9 +28,6 @@
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "allocator.h"
#include "socket.h"

View file

@ -22,9 +22,6 @@
#include <stdlib.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include <string.h>
#include <pthread.h>
#include <sys/time.h>

View file

@ -24,12 +24,10 @@
#define TESTER_H_
#include <stdio.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "types.h"
/**
* @brief Specifies a test
*/

View file

@ -21,9 +21,6 @@
*/
#include <string.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include "../allocator.h"
#include "generator_test.h"

View file

@ -22,9 +22,6 @@
#include <stdlib.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include <pthread.h>
#include <unistd.h>

View file

@ -21,12 +21,12 @@
*/
#include <stdlib.h>
#include <freeswan.h>
#include <pluto/constants.h>
#include <pluto/defs.h>
#include <pthread.h>
#include <string.h>
#include <errno.h>
#include "allocator.h"
#include "logger.h"
#include "thread_pool.h"
#include "job_queue.h"
#include "globals.h"
@ -47,6 +47,10 @@ typedef struct {
* array of thread ids
*/
pthread_t *threads;
/**
* logger of the threadpool
*/
logger_t *logger;
} private_thread_pool_t;
@ -83,13 +87,15 @@ static status_t destroy(private_thread_pool_t *this)
{
int current;
/* flag thread for termination */
for (current = 0; current < this->pool_size; current++) {
for (current = 0; current < this->pool_size; current++) {
this->logger->log(this->logger, CONTROL, "cancelling thread %u", this->threads[current]);
pthread_cancel(this->threads[current]);
}
/* wait for all threads */
for (current = 0; current < this->pool_size; current++) {
pthread_join(this->threads[current], NULL);
this->logger->log(this->logger, CONTROL, "thread %u terminated", this->threads[current]);
}
/* free mem */
@ -113,19 +119,23 @@ thread_pool_t *thread_pool_create(size_t pool_size)
this->pool_size = pool_size;
this->threads = allocator_alloc(sizeof(pthread_t) * pool_size);
this->logger = logger_create("thread_pool", 0);
/* try to create as many threads as possible, up tu pool_size */
for (current = 0; current < pool_size; current++) {
if (pthread_create(&(this->threads[current]), NULL, (void*(*)(void*))job_processing, this)) {
/* did we get any? */
if (current == 0) {
if (pthread_create(&(this->threads[current]), NULL, (void*(*)(void*))job_processing, this))
{
/* did we get any? */
if (current == 0)
{
this->logger->log(this->logger, CONTROL, "could not create any thread: %s\n", strerror(errno));
allocator_free(this->threads);
allocator_free(this);
return NULL;
}
/* not all threads could be created, but at least one :-/ */
this->logger->log(this->logger, CONTROL, "could only create %d from requested %d threads: %s\n", current, pool_size, strerror(errno));
this->pool_size = current;
return (thread_pool_t*)this;
}