diff --git a/examples/filelist.h b/examples/filelist.h new file mode 100644 index 0000000..3c152b7 --- /dev/null +++ b/examples/filelist.h @@ -0,0 +1,45 @@ +/* + * Secure X Message Passing Library v2 examples. + * + * (c) Alexander Vdolainen 2013-2015 + * + * libsxmp 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 of the License, or + * (at your option) any later version. + * + * libsxmp 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 General Public License + * along with this program. If not, see ."; + * + */ + +/* + * This is an example of sxmp usage. + * NOTE: It was developed quite fast within one day, + * btw - this the reason of some ugly code here. + * + * This is a master or simply - daemon part, it will + * listen a requests and create a stream with directory entries, + * which ridden by the client. + * This implements a simple client-server topology, to see + * more advanced technics check out other examples. + * + * NOTE(win32): don't have a time to test it or fix it to + * make it works on windows, if you can - u're welcome. + */ + +#ifndef __SXMP_EXAMPLES_FILELIST_H__ +#define __SXMP_EXAMPLES_FILELIST_H__ + +#define DEFAULT_PORT 10240 + +#define DEBUG +#define FREE(x) { if (x) { free(x); x = NULL; } } +#define MAX_STREAMS INT_MAX + +#endif /*__SXMP_EXAMPLES_FILELIST_H__*/ diff --git a/examples/filelistc.c b/examples/filelistc.c new file mode 100644 index 0000000..b0aa0f7 --- /dev/null +++ b/examples/filelistc.c @@ -0,0 +1,70 @@ +/* + * Secure X Message Passing Library v2 examples. + * + * (c) Alexander Vdolainen 2013-2015 + * + * libsxmp 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 of the License, or + * (at your option) any later version. + * + * libsxmp 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 General Public License + * along with this program. If not, see ."; + * + */ + +/* + * This is an example of sxmp usage. + * NOTE: It was developed quite fast within one day, + * btw - this the reason of some ugly code here. + * + * This is a master or simply - daemon part, it will + * listen a requests and create a stream with directory entries, + * which ridden by the client. + * This implements a simple client-server topology, to see + * more advanced technics check out other examples. + * + * NOTE(win32): don't have a time to test it or fix it to + * make it works on windows, if you can - u're welcome. + */ + +#include +#include +#define __USE_GNU +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "filelist.h" + +int main(int argc, char **argv) +{ + int opt; + + return 0; +} diff --git a/examples/filelistd.c b/examples/filelistd.c index 0b65691..40bb8db 100644 --- a/examples/filelistd.c +++ b/examples/filelistd.c @@ -60,9 +60,7 @@ #include #include -#define DEBUG -#define FREE(x) { if (x) { free(x); x = NULL; } } -#define MAX_STREAMS INT_MAX +#include "filelist.h" /* * type used to stream a directory contents @@ -319,8 +317,6 @@ static int __dir_close(void *m, sexp_t *sx) return sxmsg_return(msg, SXE_SUCCESS); } -#define DEFAULT_PORT 10240 - int main(int argc, char **argv) { char *rootca = NULL, *cert = NULL;