diff options
| -rw-r--r-- | src/backup.c (renamed from backup.c) | 0 | ||||
| -rw-r--r-- | src/complaint_sender.c (renamed from complaint_sender.c) | 0 | ||||
| -rw-r--r-- | src/complaints.c (renamed from complaints.c) | 0 | ||||
| -rw-r--r-- | src/file_operations.c (renamed from file_operations.c) | 0 | ||||
| -rw-r--r-- | src/global.c (renamed from global.c) | 0 | ||||
| -rw-r--r-- | src/id_map.c (renamed from id_map.c) | 0 | ||||
| -rw-r--r-- | src/main.h (renamed from main.h) | 0 | ||||
| -rw-r--r-- | src/main.h.in | 189 | ||||
| -rw-r--r-- | src/multicaster.c (renamed from multicaster.c) | 0 | ||||
| -rw-r--r-- | src/multicatcher.c (renamed from multicatcher.c) | 0 | ||||
| -rw-r--r-- | src/page_reader.c (renamed from page_reader.c) | 0 | ||||
| -rw-r--r-- | src/parse_synclist.c (renamed from parse_synclist.c) | 0 | ||||
| -rw-r--r-- | src/proto.h (renamed from proto.h) | 0 | ||||
| -rw-r--r-- | src/rtt.c (renamed from rtt.c) | 0 | ||||
| -rw-r--r-- | src/rttcatcher.c (renamed from rttcatcher.c) | 0 | ||||
| -rw-r--r-- | src/rttcomplaint_sender.c (renamed from rttcomplaint_sender.c) | 0 | ||||
| -rw-r--r-- | src/rttcomplaints.c (renamed from rttcomplaints.c) | 0 | ||||
| -rw-r--r-- | src/rttmain.h (renamed from rttmain.h) | 0 | ||||
| -rw-r--r-- | src/rttmissings.c (renamed from rttmissings.c) | 0 | ||||
| -rw-r--r-- | src/rttpage_reader.c (renamed from rttpage_reader.c) | 0 | ||||
| -rw-r--r-- | src/rttproto.h (renamed from rttproto.h) | 0 | ||||
| -rw-r--r-- | src/rttsends.c (renamed from rttsends.c) | 0 | ||||
| -rw-r--r-- | src/sends.c (renamed from sends.c) | 0 | ||||
| -rw-r--r-- | src/set_catcher_mcast.c (renamed from set_catcher_mcast.c) | 0 | ||||
| -rw-r--r-- | src/set_mcast.c (renamed from set_mcast.c) | 0 | ||||
| -rw-r--r-- | src/setup_socket.c (renamed from setup_socket.c) | 0 | ||||
| -rw-r--r-- | src/signal.c (renamed from signal.c) | 0 | ||||
| -rw-r--r-- | src/signal.h (renamed from signal.h) | 0 | ||||
| -rw-r--r-- | src/timing.c (renamed from timing.c) | 0 | ||||
| -rw-r--r-- | src/trFilelist.c (renamed from trFilelist.c) | 0 |
30 files changed, 189 insertions, 0 deletions
diff --git a/complaint_sender.c b/src/complaint_sender.c index 53cfdb4..53cfdb4 100644 --- a/complaint_sender.c +++ b/src/complaint_sender.c diff --git a/complaints.c b/src/complaints.c index fb48da2..fb48da2 100644 --- a/complaints.c +++ b/src/complaints.c diff --git a/file_operations.c b/src/file_operations.c index d9a8733..d9a8733 100644 --- a/file_operations.c +++ b/src/file_operations.c diff --git a/src/main.h.in b/src/main.h.in new file mode 100644 index 0000000..600c491 --- /dev/null +++ b/src/main.h.in @@ -0,0 +1,189 @@ +/* + Copyright (C) 2008 Renaissance Technologies Corp. + main developer: HP Wei <hp@rentec.com> + Copyright (C) 2006 Renaissance Technologies Corp. + main developer: HP Wei <hp@rentec.com> + Copyright (C) 2005 Renaissance Technologies Corp. + main developer: HP Wei <hp@rentec.com> + Following the suggestion and the patch by Clint Byrum <clint@careercast.com>, + I added more control to selectively print out messages. + The control is done by the statement 'if (version >= n)' + + Copyright (C) 2001 Renaissance Technologies Corp. + main developer: HP Wei <hp@rentec.com> + This file was modified in 2001 and later from files in the program + multicaster copyrighted by Aaron Hillegass as found at + <http://sourceforge.net/projects/multicaster/> + + Copyright (C) 2000 Aaron Hillegass <aaron@classmax.com> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. + If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef __main_h +#define __main_h + +#include <dirent.h> +#include <time.h> +#include <utime.h> +#include <sys/socket.h> +#include <sys/types.h> +#include <sys/un.h> +#include <stdio.h> +#include <stdlib.h> +#include <netinet/in.h> /* sockaddr_in{} and other Internet defns */ +#include <arpa/inet.h> /* inet(3) functions */ +#include <errno.h> +#include <fcntl.h> /* for nonblocking */ +#include <sys/ioctl.h> +#include <netdb.h> +#include <signal.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> /* for S_xxx file mode constants */ +#include <sys/uio.h> /* for iovec{} and readv/writev */ +#include <unistd.h> +#include <sys/wait.h> +#include <sys/time.h> /* timeval{} for select() */ +#include <sys/times.h> +#include <limits.h> + +#define VERSION "@VERSION@" + +/* logic values */ +#define FALSE 0 +#define TRUE 1 +#define FAIL (FALSE) +#define SUCCESS (TRUE) +#define GOOD_EXIT 0 +#define BAD_EXIT -1 + +/* Ports and addresses */ +#define PORT 8888 /* for multicast */ +#define FLOW_PORT (PORT-1) /* for flow-control */ +#define MCAST_ADDR "239.255.67.92" +#define MCAST_TTL 1 +#define MCAST_LOOP FALSE +#define MCAST_IF NULL + +/* + Handling socket's receive buffer on the target machine: + if the available data size in the receiveing buffer is larger + than TOO_MUCH then a TOO_FAST complaint is triggered. + The master will then sleep for USEC_TO_IDLE + Currently, this is not effective. +*/ +#define TOO_FAST_LIMIT (TOTAL_REC_PAGE / 2) /* if half is full, then too fast */ +#define TOO_MUCH (TOO_FAST_LIMIT * PAGE_BUFFSIZE) +#define USEC_TO_IDLE 1000000 + +/* TIMING stuff */ +#define FAST 5000 /* usec */ +#define DT_PERPAGE 6000 /* usec */ +#define FACTOR 90 /* interpage interval = FACTOR * DT_PERPAGE or DT_PERPAGE*/ +#define SECS_FOR_KILL 30 /* time(sec) allowed for 'kill -9 pid' to finish */ + +/* time for the master to wait for the acknowledgement */ +#define ACK_WAIT_PERIOD 1 /* secs (from time()); */ +#define ACK_WAIT_TIMES 60 /* wait for this many periods */ + +#define SICK_RATIO (0.9) +#define SICK_THRESHOLD (50) /* SICK FOR such many TIMES is really sick */ + +/* max wait time for write() a page of PAGE_SIZE -- 100 msec */ +#define WRITE_WAIT_SEC 0 +#define WRITE_WAIT_USEC 100000 + +#define SET_MON_WAIT_TIMES 6000 /* time = this number * FAST */ +#define NO_FEEDBACK_COUNT_MAX 10 +#define SWITCH_THRESHOLD 50 /* to avoid switching monitor too frequently + because of small diff in missing_pages */ + +/* complaints */ +#define TOO_FAST 100 +#define OPEN_OK 200 +#define CLOSE_OK 300 +#define MISSING_PAGE 400 +#define MISSING_TOTAL 500 +#define EOF_OK 600 +#define SIT_OUT 700 +#define PAGE_RECV 800 +#define MONITOR_OK 900 + +/* Sizes */ +/* 20060427: removed size_t which is arch-dependent */ +#define PAGE_SIZE 64512 +#define HEAD_SIZE (sizeof(int) + 2 * sizeof(int) + 2 * sizeof(int)) +#define PAGE_BUFFSIZE (PAGE_SIZE + HEAD_SIZE) +#define TOTAL_REC_PAGE 20 /* change to 4 in case hit the OS limit in buf size */ + +#define FLOW_HEAD_SIZE (sizeof(int)*4) +#define FLOW_BUFFSIZE (PAGE_SIZE+FLOW_HEAD_SIZE) +#define MAX_NPAGE (PAGE_SIZE / sizeof(int)) +/* + Modes and command codes: + The numerical codes are also the index to retrieve the command names + for printing in complaints.c +*/ +#define TIMED_OUT 0 +#define TEST 1 +#define SENDING_DATA 2 +#define RESENDING_DATA 3 +#define OPEN_FILE_CMD 4 +#define EOF_CMD 5 +#define CLOSE_FILE_CMD 6 +#define CLOSE_ABORT_CMD 7 +#define ALL_DONE_CMD 8 +#define SELECT_MONITOR_CMD 9 +#define NULL_CMD 10 + +/* machine status ----- for caster */ +#define MACHINE_OK_MISSING_PAGES '\2' +#define MACHINE_OK '\1' +#define NOT_READY '\0' + +#define BAD_MACHINE '\1' +#define GOOD_MACHINE '\0' + +#define FILE_RECV '\1' +#define NOT_RECV '\0' + +/* representation of all-targets for sends */ +#define ALL_MACHINES -1 + +/* PAGE STATUS */ +#define MISSING '\0' +#define RECEIVED '\1' + +/* MACHINE STATE ----- for catcher */ +#define IDLE_STATE 0 +#define GET_DATA_STATE 1 +#define DATA_READY_STATE 2 +#define SICK_STATE 3 + +/* + The following two are info to be packed into + meta data to represent either file or directory deletion. +*/ +/* SPECIAL # of PAGES to signal deleting action */ +#define TO_DELETE (-1) + +/* temporary file name prefix for transfering to */ +#define TMP_FILE "mrsync." + +#include "proto.h" + +#endif diff --git a/multicaster.c b/src/multicaster.c index 3b26cae..3b26cae 100644 --- a/multicaster.c +++ b/src/multicaster.c diff --git a/multicatcher.c b/src/multicatcher.c index 76fbc5e..76fbc5e 100644 --- a/multicatcher.c +++ b/src/multicatcher.c diff --git a/page_reader.c b/src/page_reader.c index 8f349a0..8f349a0 100644 --- a/page_reader.c +++ b/src/page_reader.c diff --git a/parse_synclist.c b/src/parse_synclist.c index 0c2a7aa..0c2a7aa 100644 --- a/parse_synclist.c +++ b/src/parse_synclist.c diff --git a/rttcatcher.c b/src/rttcatcher.c index 1af74f1..1af74f1 100644 --- a/rttcatcher.c +++ b/src/rttcatcher.c diff --git a/rttcomplaint_sender.c b/src/rttcomplaint_sender.c index 20d7cda..20d7cda 100644 --- a/rttcomplaint_sender.c +++ b/src/rttcomplaint_sender.c diff --git a/rttcomplaints.c b/src/rttcomplaints.c index 4f9ed9b..4f9ed9b 100644 --- a/rttcomplaints.c +++ b/src/rttcomplaints.c diff --git a/rttmain.h b/src/rttmain.h index 78eb693..78eb693 100644 --- a/rttmain.h +++ b/src/rttmain.h diff --git a/rttmissings.c b/src/rttmissings.c index 774e8b2..774e8b2 100644 --- a/rttmissings.c +++ b/src/rttmissings.c diff --git a/rttpage_reader.c b/src/rttpage_reader.c index 35940e5..35940e5 100644 --- a/rttpage_reader.c +++ b/src/rttpage_reader.c diff --git a/rttproto.h b/src/rttproto.h index 6d4cf62..6d4cf62 100644 --- a/rttproto.h +++ b/src/rttproto.h diff --git a/rttsends.c b/src/rttsends.c index 7038e2c..7038e2c 100644 --- a/rttsends.c +++ b/src/rttsends.c diff --git a/set_catcher_mcast.c b/src/set_catcher_mcast.c index 9a04017..9a04017 100644 --- a/set_catcher_mcast.c +++ b/src/set_catcher_mcast.c diff --git a/set_mcast.c b/src/set_mcast.c index aac3d36..aac3d36 100644 --- a/set_mcast.c +++ b/src/set_mcast.c diff --git a/setup_socket.c b/src/setup_socket.c index 3625a2a..3625a2a 100644 --- a/setup_socket.c +++ b/src/setup_socket.c diff --git a/trFilelist.c b/src/trFilelist.c index 8f65796..8f65796 100644 --- a/trFilelist.c +++ b/src/trFilelist.c |
