1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- /* Copyright (C) 2016 Max Riechelmann <max.riechelmann@student.kit.edu>
- (Karlsruhe Institute of Technology)
- This library 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 2.1 of the License, or (at your
- option) any later version.
- This library 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 this library; if not, write to the Free Software Foundation, Inc., 51
- Franklin St, Fifth Floor, Boston, MA 02110, USA
- */
- /**
- * SECTION: myco-daemon
- * @Short_description: daemon library
- * @Title: MycoDaemon
- *
- * MycoDaemon implements the daemon side of the Mycorrhiza distributed system.
- */
- #ifndef __MYCO_DAEMON_H
- #define __MYCO_DAEMON_H
- #include <sys/types.h>
- #include <sys/ipc.h>
- #include <sys/msg.h>
- #include <sys/stat.h>
- #include <stdio.h>
- #include <unistd.h>
- #include <errno.h>
- #include <string.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <fcntl.h>
- #include "myco-ipc.c"
- typedef struct myco_agent_ myco_agent;
- struct myco_agent_ {
- char name[AGENT_NAME_LENGTH];
- int message_queue_id;
- in_addr_t node_ip;
- myco_agent *next;
- myco_agent *prev;
- };
- typedef struct myco_resource_ myco_resource;
- struct myco_resource_ {
- char name[RESOURCE_NAME_LENGTH];
- int transactional;
- char agent[AGENT_NAME_LENGTH];
- pid_t pid;
- void* pointer;
- int size;
- int read_locked; // 0 = unlocked, 1 = locked
- int transfer_locked; // 0 = unlocked, 1 = locked
- int version;
- in_addr_t node_ip;
- myco_resource *next;
- myco_resource *prev;
- };
- int myco_daemon_start (pid_t pid, const char *node_ip, const char *indexer_ip);
- myco_agent *myco_daemon_find_agent(const char *agent_name);
- int myco_daemon_register_agent(message msg);
- int myco_daemon_unregister_agent(message msg);
- myco_resource *myco_daemon_find_resource_by_agent(const char *agent_name);
- myco_resource *myco_daemon_find_resource(const char *resource_name);
- int myco_daemon_register_resource(message msg);
- int myco_daemon_unregister_resource(message msg);
- int myco_daemon_request_resource(message msg);
- int myco_daemon_request_list(message msg, pid_t pid);
- int myco_daemon_request_remote_resource(message msg);
- int myco_daemon_write_remote_resource(message msg, int force);
- int myco_daemon_read_remote_resource(message msg);
- #endif //__MYCO_DAEMON_H
|