Files
@ da79b5082151
Branch filter:
Location: DistRen/src/client/libdistren.h
da79b5082151
2.6 KiB
text/plain
Extend the distren CLI a little bit more and specify some more of the protocol so that the client can be further worked on while cleaning up nonfunctional distrend.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | /*
Copyright 2010 Nathan Phillip Brink, Ethan Zonca, Matt Orlando
This file is a part of DistRen.
DistRen is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DistRen 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with DistRen. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBDISTREN_H_
#define LIBDISTREN_H_ 1
/*
Private definitions for libdistren.
*/
#include "distren.h"
#include "common/multiio.h"
#include "common/options.h"
#include "common/remoteio.h"
struct distren
{
struct options_common *options;
char *server;
/* if rem is NULL, we're not connected to the server */
struct remoteio *rem;
/*
* for libdistren_remoteio_read_handle(): determine whether or not
* we've passed through the server's hacky MOTD
*/
short done_ad;
/* something on which to call multiio_poll() ;-) */
multiio_context_t multiio;
};
struct distren_job
{
char *joburi;
};
/*
functions
*/
/**
Avoid poluting the public namespace until we fix visibility.
*/
#define _malloc _distren_malloc
/**
All of libdistren should use this rather than malloc.h's malloc.
*/
void *_malloc(distren_t distren, size_t size);
/**
Avoid poluting the public namespace until we fix visibility.
*/
#define _free _distren_free
/**
All of libdisren should use this instead of malloc.h's free()
*/
void _free(distren_t distren, void *tofree);
/**
* Sets up the distren handle with information garnered from
* configuration files, etc. Uses the environment variable
* DISTREN_CONFIG or the built-in default config file location.
*
* Also initializes multiio.
*/
int _distren_getoptions(distren_t handle);
/**
* Unsets-up the distren handle with options loadable from a config file.
*
* Also unloads multiio.
*/
int _distren_loseoptions(distren_t handle);
/**
* Handle newly read data.
*
* Matches remoteio_read_handle_func_t
*/
size_t libdistren_remoteio_read_handle(struct remoteio *rem, void *garbage, void *buf, size_t len, distren_t distren);
/**
* React to a remoteio-based connection closing.
*
* Matches remoteio_close_handle_func_t
*/
void libdistren_remoteio_close_handle(void *garbage, distren_t distren);
#endif
|