cake
/
libp7
Archived
1
0
Fork 1

Corrected some things, changed the file headers.

This commit is contained in:
Thomas Touhey 2017-02-23 19:17:39 +01:00
parent 0fbc0e2fb8
commit 3091f53c5e
52 changed files with 1106 additions and 560 deletions

View File

@ -138,7 +138,7 @@ $(eval $(call make-moduleobj-rule,$(mod))))
$(if $(FOR_WINDOWS),lib$(NAME).dll.a,$(SONAME))))
$(if $(IWINDLL),$(call qcmd,$(INST) -m 755 -d "$(IBINDIR)"))
$(if $(IWINDLL),$(call qcmd,$(INST) -m 644 -t "$(IBINDIR)" \
$(if $(IWINDLL),$(call qcmd,$(INST) -m 755 -t "$(IBINDIR)" \
lib$(NAME).dll))
$(if $(LINK_TO_MAJOR),\

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* libp7.h |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* libp7.h -- libp7 main public header.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#ifndef LIBP7_H
# define LIBP7_H
# include <libp7/types.h>

View File

@ -1,33 +1,43 @@
/* ************************************************************************** */
/* _____ _ */
/* libp7/buffer.h |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/02/05 17:23:04 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* libp7/buffer.h -- the libp7 buffer interface.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* This interface is there so you can use a custom buffer for file/data
* transferring. There are two use cases:
* - you want to send data: the `size` of the element to send should be set,
* and the `read` callback will be used;
* - you want to receive data: if the `announce` callback is set, it will be
* called with the size of the file to receive, in order to prepare space for
* the file. If the `announce` callback returns an error, then the file
* will not be received. If the announcement is successful, then the
* `write` callback is used.
*
* In each case, the `cookie` is sent as a first argument to your callbacks.
* ************************************************************************** */
#ifndef LIBP7_BUFFER_H
# define LIBP7_BUFFER_H
# include <libp7/types.h>
/* This file is there so it is possible to use a custom buffer for file
* transferring. There are two use cases:
* - if you use a buffer to send data: the size of the element to send should
* be put in `size`, and the `read` function will be used;
* - if you use a buffer to receive data: if the `announce` function is set,
* it will be called with the size of the file to receive, in order to
* prepare space for the file. If the announce function returns an error,
* then the file will not be sent.
*
* Here are the used functions: */
/* the callback types */
typedef int (*p7_buffer_read_t)(void*, unsigned char*, size_t);
typedef int (*p7_buffer_write_t)(void*, const unsigned char*, size_t);
typedef int (*p7_buffer_announce_t)(void*, p7uint_t);
/* And here is the structure of a buffer: */
/* and the buffer structure */
typedef struct {
void *cookie;
p7uint_t size;

View File

@ -1,14 +1,31 @@
/* ************************************************************************** */
/* _____ _ */
/* libp7/internals.h |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* libp7/internals.h -- libp7 private internals header.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* This file is the main internals file, that the library sources will include.
* It contains all the private structures and functions. Also, it will not
* be installed with the public headers.
* ************************************************************************** */
#ifndef LIBP7_INTERNALS_H
# define LIBP7_INTERNALS_H
/* Microsoft Windows minimal version (Vista) */
# undef _WIN32_WINNT
# define _WIN32_WINNT 0x0600
# include <libp7.h>
# include <libp7/packetio.h>
# include <libp7/stream.h>

View File

@ -1,12 +1,25 @@
/* ************************************************************************** */
/* _____ _ */
/* libp7/internals/byteswap.h |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/21 12:06:11 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* libp7/internals/byteswap.h -- platform-agnostic byteswap utilities.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* This file is there to use the platform's byteswapping helpers.
* If the platform is unrecognized, the lib will try to use the `byteswap.h`
* header -- if you don't want to modify the library, you should implement it.
* ************************************************************************** */
#ifndef LIBP7_INTERNALS_BYTESWAP_H
# define LIBP7_INTERNALS_BYTESWAP_H
# if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) \
@ -17,17 +30,14 @@
# include <libp7/config.h>
# include <stdint.h>
# if defined(__linux__) || defined(__CYGWIN__)
# include <byteswap.h>
# elif defined(__WINDOWS__)
# if defined(__WINDOWS__)
# include <stdlib.h>
# define __p7_bswap_16(B) (_byteswap_ushort(B))
# define __p7_bswap_32(B) (_byteswap_ulong(B))
# define __p7_bswap_64(B) (_byteswap_uint64(B))
# else
# error "Unsupported platform."
# include <byteswap.h>
# endif
#endif /* LIBP7_INTERNALS_BYTESWAP_H */

View File

@ -1,30 +1,37 @@
/* ************************************************************************** */
/* _____ _ */
/* libp7/internals/endian.h |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2016/12/20 11:44:12 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* libp7/internals/endian.h -- platform-agnostic endianness utilities.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* This file is there to use the platform's endianness helpers.
* If the platform is unrecognized, the lib will try to use the `endian.h`
* header -- if you don't want to modify the library, you should implement it.
* ************************************************************************** */
#ifndef LIBP7_INTERNALS_ENDIAN_H
# define LIBP7_INTERNALS_ENDIAN_H
# include <libp7/config.h>
# include <libp7/internals/byteswap.h>
/* MS-Windows stuff */
/* MS-Windows specific headers */
# if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) \
&& !defined(__WINDOWS__)
# define __WINDOWS__
# endif
/* "endian.h" is not a cross-platform header, so I'll be re-using and adapting
* some work by Mathias Panzenböck to make this internal header. */
# if defined(__linux__) || defined(__CYGWIN__)
# include <endian.h>
# elif defined(__APPLE__)
# if defined(__APPLE__)
# include <libkern/OSByteOrder.h>
# define be16toh(x) OSSwapBigToHostInt16(x)
@ -61,7 +68,7 @@
# endif
# else
# error Unsupported platform!
# include <endian.h>
# endif
#endif /* LIBP7_INTERNALS_ENDIAN_H */

View File

@ -1,12 +1,30 @@
/* ************************************************************************** */
/* _____ _ */
/* libp7/internals/log.h |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* libp7/internals/log.h -- libp7's logging system.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* The libp7 logging system is quite simple and defined at compilation time.
* It cannot be tweaked at runtime (I should probably correct that someday).
* Also, as it's an internal header, only the libp7 core and built-in streams
* can use it.
*
* `log[m]_*` make use of the `handle` variable to display the name of the
* current handle (e.g. `server` or `client`). If you don't have one (that's
* the case for the streams functions), use the `logr[m]_*` functions.
* ************************************************************************** */
#ifndef LIBP7_INTERNALS_LOG_H
# define LIBP7_INTERNALS_LOG_H
# include <stdio.h>

View File

@ -1,12 +1,26 @@
/* ************************************************************************** */
/* _____ _ */
/* libp7/internals/sleep.h |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/19 12:34:15 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* libp7/internals/sleep.h -- platform-agnostic sleep utility.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* This file is there to use the platform's sleep function (in milliseconds).
* If the platform is unrecognized, the lib will try to use the `usleep`
* function defined in `unistd.h` -- if you don't want to modify this library,
* you should implement it.
* ************************************************************************** */
#ifndef LIBP7_INTERNALS_SLEEP_H
# define LIBP7_INTERNALS_SLEEP_H
@ -16,16 +30,12 @@
# define __WINDOWS__
# endif
/* libp7 wants to sleep in MILLISECONDS */
# if defined(__WINDOWS__)
# include <windows.h>
# define p7_sleep(N) Sleep(N)
# elif defined(__linux__)
# else
# include <unistd.h>
# define p7_sleep(N) usleep((N) * 1000)
# else
# error "Should have the platform's sleep function!"
# endif
#endif /* LIBP7_INTERNALS_SLEEP_H */

View File

@ -1,12 +1,25 @@
/* ************************************************************************** */
/* _____ _ */
/* libp7/internals/stdio_ext.h |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* libp7/internals/stdio_ext.h -- platform-agnostic advanced FILE helpers.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* This file is there to use the platform's advanced FILE utilities.
* Actually, this feature is quite rare, so I accept that the platform doesn't
* have any.
* ************************************************************************** */
#ifndef LIBP7_INTERNALS_STDIO_EXT_H
# define LIBP7_INTERNALS_STDIO_EXT_H
@ -17,11 +30,11 @@
# endif
/* Ever heard of how annoying it is to make something platform-agnostic? */
# ifndef __linux__
# ifdef __linux__
# include <stdio_ext.h>
# else
# define __freadable(F) (1)
# define __fwritable(F) (1)
# else
# include <stdio_ext.h>
# endif
#endif /* LIBP7_INTERNALS_STDIO_EXT_H */

View File

@ -1,12 +1,55 @@
/* ************************************************************************** */
/* _____ _ */
/* libp7/packetio.h |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* libp7/packetio.h -- libp7 Packet I/O interface.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* Aside from the public and easy interface described in `libp7.h`, you may
* want to have more control on the communication. This file is the one: it
* allows you to exchange packets directly, using Protocol 7 (libp7 internals
* will take care of the odd details).
*
* Once the communication is initialized (`p7_init` with the `P7_ACTIVE` flag
* takes care of that), the Protocol 7 is basically a set of packet flows.
*
* A first example of packet flow is: the client sends a command (e.g. delete
* a file), and the server sends back an ACK (command has been executed)
* or the error if there is one (e.g. the command is not implemented, or the
* file doesn't exist).
*
* Another example of packet flow is: the client sends a command (e.g. file
* listing), the server accepts, the client sends a ROLESWP so that it becomes
* a server and the server becomes the client. The calculator (now client) will
* then send (sub-)commands (e.g. "here is a file entry"), then the client
* will ACK to each one, until the calculator finally sends a ROLESWAP to tell
* he has finished.
*
* Yet another example of packet flow (but there are others) is: the client
* sends a command (e.g. send a file), the server ACKs, then the client will
* send the data (libp7 takes care of that with the `p7_send_filestream`
* function).
*
* A last example of packet flow (but there may be others) is: the client
* sends a command (e.g. receive a file), the server ACKs, then the client
* sends a ROLESWP, and the calculator will use a sub-packet flow (e.g. file
* sending) to send the data, and will send a ROLESWP when it's done.
*
* This is just a preview of what you can do with the protocol and the library.
* You should check out the library sources, more importantly the `protocol`
* module, if you want examples :)
* ************************************************************************** */
#ifndef LIBP7_PACKETIO_H
# define LIBP7_PACKETIO_H
# include <libp7/types.h>
@ -15,39 +58,6 @@
extern "C" {
# endif
/* ************************************************************************** */
/* THE LIBP7 PACKET I/O API */
/* ************************************************************************** */
/* Basically, Protocol 7 is all about exchanging packets. libp7 takes care
* of all of the odd details, but you'll want to use this API to implement an
* interaction with the calculator. An interaction is called a packet flow.
* This packet flow highly depends on the command.
*
* A first example of packet flow is: the client sends a command (e.g. delete
* a file), and the server sends back an ACK (command has been executed)
* or the error if there is one (e.g. the command is not implemented, or the
* file doesn't exist).
*
* Another example of packet flow is: the client sends a command (e.g. file
* listing), the server accepts, the client sends a ROLESWP so that it becomes
* a server and the server becomes the client. The calculator (now client) will
* then send (sub-)commands (e.g. "here is a file entry"), then the client
* will ACK to each one, until the calculator finally sends a ROLESWAP to tell
* he has finished.
*
* Yet another example of packet flow (but there are others) is: the client
* sends a command (e.g. send a file), the server ACKs, then the client will
* send the data (libp7 takes care of that with the `p7_send_filestream`
* function).
*
* A last example of packet flow (but there may be others) is: the client
* sends a command (e.g. receive a file), the server ACKs, then the client
* sends a ROLESWP, and the calculator will use a sub-packet flow (e.g. file
* sending) to send the data, and will send a ROLESWP when it's done.
*
* All of these packet flows can be implemented using the methods listed
* here. If you want examples, just check out the `protocol` module in the
* libp7 source! */
/* ************************************************************************** */
/* Enumerations - give sense to those numbers! */
/* ************************************************************************** */
@ -92,27 +102,27 @@ typedef int p7_termtype_t;
/* ************************************************************************** */
/* Commands */
/* ************************************************************************** */
/* Commands have an OW field (overwrite action), an MCS type field,
* a FILESIZE field, and six arguments.
/* Commands have an OW field (overwrite action), an MCS type field,
* a FILESIZE field, and six arguments.
*
* The utility of an argument or not depends on the command, but the places
* of the arguments stay the same:
* The utility of an argument or not depends on the command, but the places
* of the arguments stay the same:
*
* # | Argument signification
* --+-----------------------
* 1 | Directory name
* 2 | File name
* 3 | New directory name
* 4 | New file name
* 5 | Storage device name
* 6 | ??? (unused everywhere)
* # | Argument signification
* --+-----------------------
* 1 | Directory name
* 2 | File name
* 3 | New directory name
* 4 | New file name
* 5 | Storage device name
* 6 | ??? (unused everywhere)
*
* An exception seems to be that argument #2 in commands 0x_2
* (rename directory) is the new directory name (but maybe that's a typo).
* An exception seems to be that argument #2 in commands 0x_2
* (rename directory) is the new directory name (but maybe that's a typo).
*
* Also, command 0x56 has a completely different data format that the others
* commands (and even other packets in general, as it finishes with a binary
* zero, for some reason). */
* Also, command 0x56 has a completely different data format that the others
* commands (and even other packets in general, as it finishes with a binary
* zero, for some reason). */
/* Main commands */
int p7_send_cmd(p7_handle_t *handle, p7ushort_t subtype);

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* libp7/server.h |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:02:44 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* libp7/server.h -- libp7 server header.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#ifndef LIBP7_SERVER_H
# define LIBP7_SERVER_H
# include <libp7.h>

View File

@ -1,12 +1,34 @@
/* ************************************************************************** */
/* _____ _ */
/* libp7/stream.h |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* libp7/stream.h -- libp7 stream interface.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* The libp7 stream abstraction is there so that the core code can be more
* platform-agnostic (althrough platform-specific helpers are built-in for
* popular platforms like Microsoft Windows or GNU/Linux distributions).
*
* A stream is basically what separates libp7 from the calculator.
* When data is read from the stream, what is expected is what the calculator
* has sent, and when data is written to the stream, it is what the calculator
* shall receive.
*
* As some streams can have buffering, there is no buffering system in this
* superset. Also, if you don't succeed totally (all bytes read/written),
* to the library, you have failed, and shall return an error.
* ************************************************************************** */
#ifndef LIBP7_STREAM_H
# define LIBP7_STREAM_H
# include <libp7/types.h>
@ -14,21 +36,9 @@
extern "C" {
# endif
/* This file is there so you can implement your own custom protocol instead
* of CASIO's Protocol 7 to communicate with a CASIO calculator, while
* using libp7 utilities to look for the calculator. */
/* ************************************************************************** */
/* Stream utilities */
/* ************************************************************************** */
/* Structure of a stream - use this to define your custom streams!
* These functions take the uncasted cookie and the required arguments for
* the actions (`timeout` is in milliseconds). They should return the libp7
* error code, or 0 if no error. There is no partial success: you manage to
* receive/send the full buffer, or you do not.
*
* some of the streams managed by default already have buffering, so this
* implementation doesn't add another layer of it.
* if you need buffering, implement it! */
/* The callbacks take the uncasted cookie and the required arguments for
* the action (`timeout` being in milliseconds). They should return the libp7
* error code, or 0 if no error has occured. Again, no partial success. */
typedef struct p7_stream_s {
/* callbacks */
int (*read)(void *cookie, unsigned char *dest, size_t size,

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* libp7/types.h |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/02/07 16:52:51 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* libp7/types.h -- types brought to you by libp7.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#ifndef LIBP7_TYPES_H
# define LIBP7_TYPES_H
# include <libp7/config.h>

View File

@ -1,12 +1,26 @@
/* ************************************************************************** */
/* _____ _ */
/* core/_init.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* core/_init.c -- real libp7 initialization and exit.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* The `p7_sinit` (former `_p7_init`) is the function that really initializes
* the communication using the given stream (once the stream is initialized).
* It went public recently to give the possibility to the user to make a
* custom stream, probably for its platform.
* ************************************************************************** */
#include <libp7/internals.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,12 +1,26 @@
/* ************************************************************************** */
/* _____ _ */
/* core/devices.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* core/devices.c -- libp7 known devices.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* One of the Protocol 7 problems is that it has too few errors, and one of
* them, the 0x04 error (`p7_err_generic`), can mean many things. Knowing the
* device we're talking to, and its capabilities, help us reduce the number
* of possible errors it can be.
* ************************************************************************** */
#include <libp7/internals.h>
#include <string.h>

View File

@ -1,12 +1,25 @@
/* ************************************************************************** */
/* _____ _ */
/* core/init.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/19 12:25:05 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* core/init.c -- easy initialization-related functions.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* These functions are the easy and cross-platform libp7 initialization
* and serial devices listing functions. Their role is to use the
* platform-specific streams (defined in `libp7/streams.h`).
* ************************************************************************** */
#include <libp7/internals.h>
#include <libp7/internals/sleep.h>
#include <stdio.h>

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* core/log.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* core/log.c -- libp7 logging utilities.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
#if LOGLEVEL < ll_none
# include <stdio.h>

View File

@ -1,12 +1,25 @@
/* ************************************************************************** */
/* _____ _ */
/* handle/stream.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* core/stream.c -- libp7 easy stream usage.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* These functions are the ~equivalents of `fread`/`fwrite` for libp7 streams,
* with communication settings function. It is highly advised to use them
* instead of using the streams reading directly.
* ************************************************************************** */
#include <libp7/internals.h>
#include <string.h>

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* core/strerror.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* core/strerror.c -- libp7 error strings.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,23 @@
/* ************************************************************************** */
/* _____ _ */
/* core/version.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* core/version.c -- libp7 version message.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* If the library is run directly, it should put its version message and exit.
* ************************************************************************** */
#include <libp7/internals.h>
#ifndef is_static
# include <unistd.h>

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* packet/ack.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* packet/ack.c -- fifty shades of ACK.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
#include <string.h>

View File

@ -1,12 +1,25 @@
/* ************************************************************************** */
/* _____ _ */
/* packet/command.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* packet/command.c -- the command utilities.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* Actually, most of the commands have the same format, so most are inline
* functions defined in `libp7/packetio.h`. These are the functions for the
* general format, and the commands with custom formats.
* ************************************************************************** */
#include <libp7/internals.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,12 +1,23 @@
/* ************************************************************************** */
/* _____ _ */
/* packet/data.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* packet/data.c -- data packet and buffer sending.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* These functions are about sending and receiving data buffers.
* ************************************************************************** */
#include <libp7/internals.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,12 +1,24 @@
/* ************************************************************************** */
/* _____ _ */
/* packet/recv.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* packet/recv.c -- receive and decode the packet.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* These functions are about receiving and decoding a packet.
* It is also about managing checksum problems and timeouts.
* ************************************************************************** */
#include <libp7/internals.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,12 +1,23 @@
/* ************************************************************************** */
/* _____ _ */
/* packet/send.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* packet/send.c -- prepare and send a packet.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* These functions are the one used behind the others to send a packet.
* ************************************************************************** */
#include <libp7/internals.h>
#include <stdio.h>
#include <string.h>

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* packet/special.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 16:39:00 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* packet/special.c -- send special packets.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* protocol/backup.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* protocol/backup.c -- backup software elements of the calculator.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
#include <string.h>

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* protocol/copy.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* protocol/copy.c -- copy a file on the calculator.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* protocol/createdir.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/27 14:57:34 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* protocol/createdir.c -- create a directory on the calculator.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* protocol/delete.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* protocol/delete.c -- delete a file/directory on the calculator.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* protocol/getcapacity.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/27 14:57:59 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* protocol/getfreemem.c -- get the amount of free memory on the calculator.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* protocol/getscreen.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* protocol/getscreen.c -- receive the streamed screen from the calculator.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* protocol/list.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* protocol/list.c -- list the elements on the calculator.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* protocol/optimize.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* protocol/optimize.c -- optimize a filesystem on the calculator.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* protocol/poke.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/02/19 13:05:59 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* protocol/poke.c -- poke the calculator so the communication doesn't stop.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* protocol/request.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* protocol/request.c -- request a file from the calculator.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* protocol/resetflash.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* protocol/reset.c -- reset a filesystem on the calculator.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* protocol/send.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* protocol/send.c -- send a file to the calculator.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* protocol/sendexe.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* protocol/sendexe.c -- send an update.exe to the calculator.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* protocol/server.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:02:36 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* protocol/server.c -- set up a protocol 7 server.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
#include <string.h>
#define gather_fs() \

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* protocol/setlink.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/02/08 01:10:16 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* protocol/setlink.c -- set link settings.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
#include <libp7/internals/sleep.h>

View File

@ -1,12 +1,24 @@
/* ************************************************************************** */
/* _____ _ */
/* handle/file.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* stream/file.c -- built-in FILE stream.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* `_p7_finit` is there so other built-in streams can use it. `streams.c`
* used to be built on top of it, but not anymore.
* ************************************************************************** */
#include <libp7/internals.h>
#include <libp7/internals/sleep.h>
#ifndef P7_DISABLED_FILE

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* handle/libusb.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* stream/libusb.c -- built-in libusb stream.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
#ifndef P7_DISABLED_LIBUSB
# include <libusb.h>

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* handle/streams.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* stream/streams.c -- built-in STREAMS stream.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
#define ragequit(ERR) { err = p7_error_##ERR; goto fail; }
#ifndef P7_DISABLED_STREAMS

View File

@ -1,14 +1,25 @@
/* ************************************************************************** */
/* _____ _ */
/* stream/windows.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/11 18:36:38 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* stream/windows.c -- built-in Windows API stream.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
#ifndef P7_DISABLED_WINDOWS
/* only works because I redefined the version at the beginning of
* internals.h! */
# include <windows.h>
# include <setupapi.h>
# include <usbiodef.h>
@ -386,11 +397,12 @@ static int p7_win_close(void *vcookie)
static int winit(p7_handle_t **handle, unsigned int flags, const char *path)
{
DWORD werr;
/* open the file handle - my god, this function is so complex. */
logr_info("Opening the stream");
HANDLE fhandle = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
DWORD werr, wsuccess;
if (fhandle == INVALID_HANDLE_VALUE) switch ((werr = GetLastError())) {
case ERROR_FILE_NOT_FOUND:
case ERROR_DEV_NOT_EXIST:
@ -402,16 +414,19 @@ static int winit(p7_handle_t **handle, unsigned int flags, const char *path)
return (p7_error_unknown);
}
/* get product data */
CHANGER_PRODUCT_DATA ProductData; DWORD ReturnedBytes = 0;
wsuccess = DeviceIoControl(fhandle, IOCTL_CHANGER_GET_PRODUCT_DATA,
NULL, 0, &ProductData, sizeof(CHANGER_PRODUCT_DATA),
&ReturnedBytes, 0);
if (wsuccess) logr_info("SUCCESS!");
else logr_info("Error #0x%08lx occurred", GetLastError());
/* get file name? */
DWORD FileNameSize = sizeof(FILE_NAME_INFO) + MAX_PATH * sizeof(WCHAR);
FILE_NAME_INFO *FileName = malloc(FileNameSize);
if (FileName && GetFileInformationByHandleEx(fhandle, FileNameInfo,
FileName, FileNameSize)) {
logr_info("Obtained following path:");
logr_info("%.*ls", (int)FileName->FileNameLength, FileName->FileName);
}
free(FileName);
/* initialize stream properties */
DCB dcb = {0}; dcb.DCBlength = sizeof(DCB);
memset(&dcb, 0, sizeof(DCB));
if (GetCommState(fhandle, &dcb)) {
/* set the DCB thingies */
logr_info("Setting initial communication settings");
@ -421,8 +436,17 @@ static int winit(p7_handle_t **handle, unsigned int flags, const char *path)
dcb.XonLim = 0x4000; dcb.XonChar = 0x11;
dcb.XoffLim = 0x1000; dcb.XoffChar = 0x13;
/* set other things just so the DCB gets accepted */
dcb.BaudRate = CBR_9600;
dcb.StopBits = ONESTOPBIT;
dcb.Parity = NOPARITY;
/* save new state */
wsuccess = SetCommState(fhandle, &dcb);
if (!SetCommState(fhandle, &dcb)) {
logr_error("Got error 0x%08lX while setting communication state",
GetLastError());
return (p7_error_unknown);
}
}
/* make cookie */

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* utils/ascii.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* utils/ascii.c -- ASCII/hex/dec utilities.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
#include <ctype.h>

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* utils/checksum.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* utils/checksum.c -- libp7 checksum utility.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* utils/escape.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* utils/escape.c -- Data escaping utilities.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
/**

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* utils/filebuffer.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/02/05 18:34:15 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* utils/filebuffer.c -- built-in FILE buffer utilities.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
#ifndef P7_DISABLED_FILE

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* utils/membuffer.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/02/15 12:21:09 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* utils/membuffer.c -- built-in memory buffer utilities.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
#include <string.h>

View File

@ -1,12 +1,21 @@
/* ************************************************************************** */
/* _____ _ */
/* utils/validate.c |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2017/01/04 15:01:48 |___/ */
/* */
/* ************************************************************************** */
/* *****************************************************************************
* utils/validate.c -- elements validating utilities.
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#include <libp7/internals.h>
#include <ctype.h>

View File

@ -30,6 +30,29 @@ version_num=$(printf "0x%02X%02X%04X" \
#******************************************************************************#
# Beginning
cat <<_EOF
/* *****************************************************************************
* libp7/config.h -- libp7 configuration header.
* Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libp7.
* libp7 is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libp7 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libp7; if not, see <http://www.gnu.org/licenses/>.
*
* This file is generated from the options you pass to the configure script.
* It shall not be modified by the user after its generation, as this could
* lead to unresolved symbols! If you want another configuration, then you
* will have to build the library again, with your different configuration.
* ************************************************************************** */
#ifndef LIBP7_CONFIG_H
# define LIBP7_CONFIG_H
# define LIBP7_VERSION "${version}"