From f43289158457fa4f390e32e7962281fd06e46db2 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 7 Jun 2014 00:13:06 +0200 Subject: fix file names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 4 +- src/mds-server/client.h | 2 +- src/mds-server/interception-condition.c | 97 +++++++++++++++++++++++++++++++++ src/mds-server/interception-condition.h | 96 ++++++++++++++++++++++++++++++++ src/mds-server/interception_condition.c | 97 --------------------------------- src/mds-server/interception_condition.h | 96 -------------------------------- src/mds-server/interceptors.c | 4 +- src/mds-server/interceptors.h | 4 +- src/mds-server/mds-server.c | 4 +- src/mds-server/multicast.c | 2 +- src/mds-server/multicast.h | 2 +- src/mds-server/queued-interception.c | 81 +++++++++++++++++++++++++++ src/mds-server/queued-interception.h | 93 +++++++++++++++++++++++++++++++ src/mds-server/queued_interception.c | 81 --------------------------- src/mds-server/queued_interception.h | 93 ------------------------------- src/mds-server/sending.c | 2 +- 16 files changed, 379 insertions(+), 379 deletions(-) create mode 100644 src/mds-server/interception-condition.c create mode 100644 src/mds-server/interception-condition.h delete mode 100644 src/mds-server/interception_condition.c delete mode 100644 src/mds-server/interception_condition.h create mode 100644 src/mds-server/queued-interception.c create mode 100644 src/mds-server/queued-interception.h delete mode 100644 src/mds-server/queued_interception.c delete mode 100644 src/mds-server/queued_interception.h diff --git a/Makefile b/Makefile index faf08df..e24f8af 100644 --- a/Makefile +++ b/Makefile @@ -79,8 +79,8 @@ LIBOBJ = linked-list hash-table fd-table mds-message util all: obj/mds-base.o bin/mds bin/mds-server bin/libmdsserver.so -MDS_SERVER_OBJ_ = mds-server interception_condition client multicast \ - queued_interception globals signals interceptors \ +MDS_SERVER_OBJ_ = mds-server interception-condition client multicast \ + queued-interception globals signals interceptors \ sending slavery reexec receiving MDS_SERVER_OBJ = obj/mds-base.o $(foreach O,$(MDS_SERVER_OBJ_),obj/mds-server/$(O).o) diff --git a/src/mds-server/client.h b/src/mds-server/client.h index ab8046a..cd838a0 100644 --- a/src/mds-server/client.h +++ b/src/mds-server/client.h @@ -19,7 +19,7 @@ #define MDS_MDS_SERVER_CLIENT_H -#include "interception_condition.h" +#include "interception-condition.h" #include "multicast.h" #include diff --git a/src/mds-server/interception-condition.c b/src/mds-server/interception-condition.c new file mode 100644 index 0000000..b625b2e --- /dev/null +++ b/src/mds-server/interception-condition.c @@ -0,0 +1,97 @@ +/** + * mds — A micro-display server + * Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "interception-condition.h" + +#include + +#include +#include + + + +/** + * Calculate the buffer size need to marshal an interception condition + * + * @param this The interception condition + * @return The number of bytes to allocate to the output buffer + */ +size_t interception_condition_marshal_size(const interception_condition_t* restrict this) +{ + return sizeof(size_t) + sizeof(int64_t) + 2 * sizeof(int) + (strlen(this->condition) + 1) * sizeof(char); +} + +/** + * Marshals an interception condition + * + * @param this The interception condition + * @param data Output buffer for the marshalled data + * @return The number of bytes that have been written (everything will be written) + */ +size_t interception_condition_marshal(const interception_condition_t* restrict this, char* restrict data) +{ + size_t n = (strlen(this->condition) + 1) * sizeof(char); + buf_set_next(data, int, INTERCEPTION_CONDITION_T_VERSION); + buf_set_next(data, size_t, this->header_hash); + buf_set_next(data, int64_t, this->priority); + buf_set_next(data, int, this->modifying); + memcpy(data, this->condition, n); + return sizeof(size_t) + sizeof(int64_t) + 2 * sizeof(int) + n; +} + + +/** + * Unmarshals an interception condition + * + * @param this Memory slot in which to store the new interception condition + * @param data In buffer with the marshalled data + * @return Zero on error, errno will be set accordingly, otherwise the number of read bytes + */ +size_t interception_condition_unmarshal(interception_condition_t* restrict this, char* restrict data) +{ + size_t n; + this->condition = NULL; + /* buf_get_next(data, int, INTERCEPTION_CONDITION_T_VERSION); */ + buf_next(data, int, 1); + buf_get_next(data, size_t, this->header_hash); + buf_get_next(data, int64_t, this->priority); + buf_get_next(data, int, this->modifying); + n = (strlen(data) + 1) * sizeof(char); + if ((this->condition = malloc(n)) == NULL) + return 0; + memcpy(this->condition, data, n); + return sizeof(size_t) + sizeof(int64_t) + sizeof(int) + n; +} + + +/** + * Pretend to an interception condition + * + * @param data In buffer with the marshalled data + * @return The number of read bytes + */ +size_t interception_condition_unmarshal_skip(char* restrict data) +{ + size_t n = sizeof(size_t) + sizeof(int64_t) + sizeof(int); + buf_next(data, int, 1); + buf_next(data, size_t, 1); + buf_next(data, int64_t, 1); + buf_next(data, int, 1); + n += (strlen(data) + 1) * sizeof(char); + return n; +} + diff --git a/src/mds-server/interception-condition.h b/src/mds-server/interception-condition.h new file mode 100644 index 0000000..19f2c68 --- /dev/null +++ b/src/mds-server/interception-condition.h @@ -0,0 +1,96 @@ +/** + * mds — A micro-display server + * Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef MDS_MDS_SERVER_INTERCEPTION_CONDITION_H +#define MDS_MDS_SERVER_INTERCEPTION_CONDITION_H + + +#include +#include + + +#define INTERCEPTION_CONDITION_T_VERSION 0 + +/** + * A condition for a message being intercepted by a client + */ +typedef struct interception_condition +{ + /** + * The header of messages to intercept, optionally with a value, + * empty (most not be NULL) for all messages. + */ + char* condition; + + /** + * The hash of the header of messages to intercept + */ + size_t header_hash; + + /** + * The interception priority. The client should be + * consistent with the priority for conditions that + * are not mutually exclusive. + */ + int64_t priority; + + /** + * Whether the messages may get modified by the client + */ + int modifying; + +} interception_condition_t; + + +/** + * Calculate the buffer size need to marshal an interception condition + * + * @param this The interception condition + * @return The number of bytes to allocate to the output buffer + */ +size_t interception_condition_marshal_size(const interception_condition_t* restrict this) __attribute__((pure)); + +/** + * Marshals an interception condition + * + * @param this The interception condition + * @param data Output buffer for the marshalled data + * @return The number of bytes that have been written (everything will be written) + */ +size_t interception_condition_marshal(const interception_condition_t* restrict this, char* restrict data); + +/** + * Unmarshals an interception condition + * + * @param this Memory slot in which to store the new interception condition + * @param data In buffer with the marshalled data + * @return Zero on error, errno will be set accordingly, otherwise the number of read bytes. + * Destroy the interception condition on error. + */ +size_t interception_condition_unmarshal(interception_condition_t* restrict this, char* restrict data); + +/** + * Pretend to an interception condition + * + * @param data In buffer with the marshalled data + * @return The number of read bytes + */ +size_t interception_condition_unmarshal_skip(char* restrict data) __attribute__((pure)); + + +#endif + diff --git a/src/mds-server/interception_condition.c b/src/mds-server/interception_condition.c deleted file mode 100644 index 8f11adb..0000000 --- a/src/mds-server/interception_condition.c +++ /dev/null @@ -1,97 +0,0 @@ -/** - * mds — A micro-display server - * Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include "interception_condition.h" - -#include - -#include -#include - - - -/** - * Calculate the buffer size need to marshal an interception condition - * - * @param this The interception condition - * @return The number of bytes to allocate to the output buffer - */ -size_t interception_condition_marshal_size(const interception_condition_t* restrict this) -{ - return sizeof(size_t) + sizeof(int64_t) + 2 * sizeof(int) + (strlen(this->condition) + 1) * sizeof(char); -} - -/** - * Marshals an interception condition - * - * @param this The interception condition - * @param data Output buffer for the marshalled data - * @return The number of bytes that have been written (everything will be written) - */ -size_t interception_condition_marshal(const interception_condition_t* restrict this, char* restrict data) -{ - size_t n = (strlen(this->condition) + 1) * sizeof(char); - buf_set_next(data, int, INTERCEPTION_CONDITION_T_VERSION); - buf_set_next(data, size_t, this->header_hash); - buf_set_next(data, int64_t, this->priority); - buf_set_next(data, int, this->modifying); - memcpy(data, this->condition, n); - return sizeof(size_t) + sizeof(int64_t) + 2 * sizeof(int) + n; -} - - -/** - * Unmarshals an interception condition - * - * @param this Memory slot in which to store the new interception condition - * @param data In buffer with the marshalled data - * @return Zero on error, errno will be set accordingly, otherwise the number of read bytes - */ -size_t interception_condition_unmarshal(interception_condition_t* restrict this, char* restrict data) -{ - size_t n; - this->condition = NULL; - /* buf_get_next(data, int, INTERCEPTION_CONDITION_T_VERSION); */ - buf_next(data, int, 1); - buf_get_next(data, size_t, this->header_hash); - buf_get_next(data, int64_t, this->priority); - buf_get_next(data, int, this->modifying); - n = (strlen(data) + 1) * sizeof(char); - if ((this->condition = malloc(n)) == NULL) - return 0; - memcpy(this->condition, data, n); - return sizeof(size_t) + sizeof(int64_t) + sizeof(int) + n; -} - - -/** - * Pretend to an interception condition - * - * @param data In buffer with the marshalled data - * @return The number of read bytes - */ -size_t interception_condition_unmarshal_skip(char* restrict data) -{ - size_t n = sizeof(size_t) + sizeof(int64_t) + sizeof(int); - buf_next(data, int, 1); - buf_next(data, size_t, 1); - buf_next(data, int64_t, 1); - buf_next(data, int, 1); - n += (strlen(data) + 1) * sizeof(char); - return n; -} - diff --git a/src/mds-server/interception_condition.h b/src/mds-server/interception_condition.h deleted file mode 100644 index 19f2c68..0000000 --- a/src/mds-server/interception_condition.h +++ /dev/null @@ -1,96 +0,0 @@ -/** - * mds — A micro-display server - * Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#ifndef MDS_MDS_SERVER_INTERCEPTION_CONDITION_H -#define MDS_MDS_SERVER_INTERCEPTION_CONDITION_H - - -#include -#include - - -#define INTERCEPTION_CONDITION_T_VERSION 0 - -/** - * A condition for a message being intercepted by a client - */ -typedef struct interception_condition -{ - /** - * The header of messages to intercept, optionally with a value, - * empty (most not be NULL) for all messages. - */ - char* condition; - - /** - * The hash of the header of messages to intercept - */ - size_t header_hash; - - /** - * The interception priority. The client should be - * consistent with the priority for conditions that - * are not mutually exclusive. - */ - int64_t priority; - - /** - * Whether the messages may get modified by the client - */ - int modifying; - -} interception_condition_t; - - -/** - * Calculate the buffer size need to marshal an interception condition - * - * @param this The interception condition - * @return The number of bytes to allocate to the output buffer - */ -size_t interception_condition_marshal_size(const interception_condition_t* restrict this) __attribute__((pure)); - -/** - * Marshals an interception condition - * - * @param this The interception condition - * @param data Output buffer for the marshalled data - * @return The number of bytes that have been written (everything will be written) - */ -size_t interception_condition_marshal(const interception_condition_t* restrict this, char* restrict data); - -/** - * Unmarshals an interception condition - * - * @param this Memory slot in which to store the new interception condition - * @param data In buffer with the marshalled data - * @return Zero on error, errno will be set accordingly, otherwise the number of read bytes. - * Destroy the interception condition on error. - */ -size_t interception_condition_unmarshal(interception_condition_t* restrict this, char* restrict data); - -/** - * Pretend to an interception condition - * - * @param data In buffer with the marshalled data - * @return The number of read bytes - */ -size_t interception_condition_unmarshal_skip(char* restrict data) __attribute__((pure)); - - -#endif - diff --git a/src/mds-server/interceptors.c b/src/mds-server/interceptors.c index 0c22d78..38442bd 100644 --- a/src/mds-server/interceptors.c +++ b/src/mds-server/interceptors.c @@ -18,9 +18,9 @@ #include "interceptors.h" #include "globals.h" -#include "interception_condition.h" +#include "interception-condition.h" #include "client.h" -#include "queued_interception.h" +#include "queued-interception.h" #include #include diff --git a/src/mds-server/interceptors.h b/src/mds-server/interceptors.h index 06c76e1..7bb60e5 100644 --- a/src/mds-server/interceptors.h +++ b/src/mds-server/interceptors.h @@ -19,9 +19,9 @@ #define MDS_MDS_SERVER_INTERCEPTORS_H -#include "interception_condition.h" +#include "interception-condition.h" #include "client.h" -#include "queued_interception.h" +#include "queued-interception.h" #include #include diff --git a/src/mds-server/mds-server.c b/src/mds-server/mds-server.c index b1008cd..361c52a 100644 --- a/src/mds-server/mds-server.c +++ b/src/mds-server/mds-server.c @@ -18,9 +18,9 @@ #include "mds-server.h" #include "globals.h" -#include "interception_condition.h" +#include "interception-condition.h" #include "client.h" -#include "queued_interception.h" +#include "queued-interception.h" #include "multicast.h" #include "interceptors.h" #include "sending.h" diff --git a/src/mds-server/multicast.c b/src/mds-server/multicast.c index a901194..e6f38fe 100644 --- a/src/mds-server/multicast.c +++ b/src/mds-server/multicast.c @@ -17,7 +17,7 @@ */ #include "multicast.h" -#include "interception_condition.h" +#include "interception-condition.h" #include diff --git a/src/mds-server/multicast.h b/src/mds-server/multicast.h index d23d7ce..4747a20 100644 --- a/src/mds-server/multicast.h +++ b/src/mds-server/multicast.h @@ -19,7 +19,7 @@ #define MDS_MDS_SERVER_MULTICAST_H -#include "queued_interception.h" +#include "queued-interception.h" #define MULTICAST_T_VERSION 0 diff --git a/src/mds-server/queued-interception.c b/src/mds-server/queued-interception.c new file mode 100644 index 0000000..22e01b7 --- /dev/null +++ b/src/mds-server/queued-interception.c @@ -0,0 +1,81 @@ +/** + * mds — A micro-display server + * Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "queued-interception.h" + +#include + + +/** + * Calculate the buffer size need to marshal a queued interception + * + * @param this The client information + * @return The number of bytes to allocate to the output buffer + */ +size_t queued_interception_marshal_size(void) +{ + return sizeof(int64_t) + 3 * sizeof(int); +} + + +/** + * Marshals a queued interception + * + * @param this The queued interception + * @param data Output buffer for the marshalled data + * @return The number of bytes that have been written (everything will be written) + */ +size_t queued_interception_marshal(const queued_interception_t* restrict this, char* restrict data) +{ + buf_set_next(data, int, QUEUED_INTERCEPTION_T_VERSION); + buf_set_next(data, int64_t, this->priority); + buf_set_next(data, int, this->modifying); + buf_set_next(data, int, this->client->socket_fd); + return queued_interception_marshal_size(); +} + + +/** + * Unmarshals a queued interception + * + * @param this Memory slot in which to store the new queued interception + * @param data In buffer with the marshalled data + * @return Zero on error, errno will be set accordingly, otherwise the number of read bytes. + */ +size_t queued_interception_unmarshal(queued_interception_t* restrict this, char* restrict data) +{ + this->client = NULL; + /* buf_get_next(data, int, QUEUED_INTERCEPTION_T_VERSION); */ + buf_next(data, int, 1); + buf_get_next(data, int64_t, this->priority); + buf_get_next(data, int, this->modifying); + buf_get_next(data, int, this->socket_fd); + return queued_interception_marshal_size(); +} + + +/** + * Pretend to unmarshal a queued interception + * + * @param data In buffer with the marshalled data + * @return The number of read bytes + */ +size_t queued_interception_unmarshal_skip(void) +{ + return queued_interception_marshal_size(); +} + diff --git a/src/mds-server/queued-interception.h b/src/mds-server/queued-interception.h new file mode 100644 index 0000000..3c7fe51 --- /dev/null +++ b/src/mds-server/queued-interception.h @@ -0,0 +1,93 @@ +/** + * mds — A micro-display server + * Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef MDS_MDS_SERVER_QUEUED_INTERCEPTION_H +#define MDS_MDS_SERVER_QUEUED_INTERCEPTION_H + + +#include "client.h" + +#include + + +#define QUEUED_INTERCEPTION_T_VERSION 0 + +/** + * A queued interception + */ +typedef struct queued_interception +{ + /** + * The intercepting client + */ + struct client* client; + + /** + * The interception priority + */ + int64_t priority; + + /** + * Whether the messages may get modified by the client + */ + int modifying; + + /** + * The file descriptor of the intercepting client's socket (used for unmarshalling) + */ + int socket_fd; + +} queued_interception_t; + + +/** + * Calculate the buffer size need to marshal a queued interception + * + * @param this The client information + * @return The number of bytes to allocate to the output buffer + */ +size_t queued_interception_marshal_size(void) __attribute__((const)); + +/** + * Marshals a queued interception + * + * @param this The queued interception + * @param data Output buffer for the marshalled data + * @return The number of bytes that have been written (everything will be written) + */ +size_t queued_interception_marshal(const queued_interception_t* restrict this, char* restrict data); + +/** + * Unmarshals a queued interception + * + * @param this Memory slot in which to store the new queued interception + * @param data In buffer with the marshalled data + * @return Zero on error, errno will be set accordingly, otherwise the number of read bytes. + */ +size_t queued_interception_unmarshal(queued_interception_t* restrict this, char* restrict data); + +/** + * Pretend to unmarshal a queued interception + * + * @param data In buffer with the marshalled data + * @return The number of read bytes + */ +size_t queued_interception_unmarshal_skip(void) __attribute__((const)); + + +#endif + diff --git a/src/mds-server/queued_interception.c b/src/mds-server/queued_interception.c deleted file mode 100644 index d162558..0000000 --- a/src/mds-server/queued_interception.c +++ /dev/null @@ -1,81 +0,0 @@ -/** - * mds — A micro-display server - * Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include "queued_interception.h" - -#include - - -/** - * Calculate the buffer size need to marshal a queued interception - * - * @param this The client information - * @return The number of bytes to allocate to the output buffer - */ -size_t queued_interception_marshal_size(void) -{ - return sizeof(int64_t) + 3 * sizeof(int); -} - - -/** - * Marshals a queued interception - * - * @param this The queued interception - * @param data Output buffer for the marshalled data - * @return The number of bytes that have been written (everything will be written) - */ -size_t queued_interception_marshal(const queued_interception_t* restrict this, char* restrict data) -{ - buf_set_next(data, int, QUEUED_INTERCEPTION_T_VERSION); - buf_set_next(data, int64_t, this->priority); - buf_set_next(data, int, this->modifying); - buf_set_next(data, int, this->client->socket_fd); - return queued_interception_marshal_size(); -} - - -/** - * Unmarshals a queued interception - * - * @param this Memory slot in which to store the new queued interception - * @param data In buffer with the marshalled data - * @return Zero on error, errno will be set accordingly, otherwise the number of read bytes. - */ -size_t queued_interception_unmarshal(queued_interception_t* restrict this, char* restrict data) -{ - this->client = NULL; - /* buf_get_next(data, int, QUEUED_INTERCEPTION_T_VERSION); */ - buf_next(data, int, 1); - buf_get_next(data, int64_t, this->priority); - buf_get_next(data, int, this->modifying); - buf_get_next(data, int, this->socket_fd); - return queued_interception_marshal_size(); -} - - -/** - * Pretend to unmarshal a queued interception - * - * @param data In buffer with the marshalled data - * @return The number of read bytes - */ -size_t queued_interception_unmarshal_skip(void) -{ - return queued_interception_marshal_size(); -} - diff --git a/src/mds-server/queued_interception.h b/src/mds-server/queued_interception.h deleted file mode 100644 index 3c7fe51..0000000 --- a/src/mds-server/queued_interception.h +++ /dev/null @@ -1,93 +0,0 @@ -/** - * mds — A micro-display server - * Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#ifndef MDS_MDS_SERVER_QUEUED_INTERCEPTION_H -#define MDS_MDS_SERVER_QUEUED_INTERCEPTION_H - - -#include "client.h" - -#include - - -#define QUEUED_INTERCEPTION_T_VERSION 0 - -/** - * A queued interception - */ -typedef struct queued_interception -{ - /** - * The intercepting client - */ - struct client* client; - - /** - * The interception priority - */ - int64_t priority; - - /** - * Whether the messages may get modified by the client - */ - int modifying; - - /** - * The file descriptor of the intercepting client's socket (used for unmarshalling) - */ - int socket_fd; - -} queued_interception_t; - - -/** - * Calculate the buffer size need to marshal a queued interception - * - * @param this The client information - * @return The number of bytes to allocate to the output buffer - */ -size_t queued_interception_marshal_size(void) __attribute__((const)); - -/** - * Marshals a queued interception - * - * @param this The queued interception - * @param data Output buffer for the marshalled data - * @return The number of bytes that have been written (everything will be written) - */ -size_t queued_interception_marshal(const queued_interception_t* restrict this, char* restrict data); - -/** - * Unmarshals a queued interception - * - * @param this Memory slot in which to store the new queued interception - * @param data In buffer with the marshalled data - * @return Zero on error, errno will be set accordingly, otherwise the number of read bytes. - */ -size_t queued_interception_unmarshal(queued_interception_t* restrict this, char* restrict data); - -/** - * Pretend to unmarshal a queued interception - * - * @param data In buffer with the marshalled data - * @return The number of read bytes - */ -size_t queued_interception_unmarshal_skip(void) __attribute__((const)); - - -#endif - diff --git a/src/mds-server/sending.c b/src/mds-server/sending.c index ec29a81..338ce68 100644 --- a/src/mds-server/sending.c +++ b/src/mds-server/sending.c @@ -19,7 +19,7 @@ #include "globals.h" #include "client.h" -#include "queued_interception.h" +#include "queued-interception.h" #include "multicast.h" #include -- cgit v1.2.3-70-g09d2