summaryrefslogtreecommitdiff
path: root/emit.c
diff options
context:
space:
mode:
authorMartin Pool <mbp@sourcefrog.net>2000-05-22 08:56:47 +0000
committerMartin Pool <mbp@sourcefrog.net>2000-05-22 08:56:47 +0000
commit72e8318c582f5a821e4ef8bad23abd9c8b98b841 (patch)
tree2fbdcceef2e4574bec57a11e9a614ef11dc22d78 /emit.c
parent162671e4bfa2abde24a9591ef6132e7ab7ad5cf8 (diff)
downloadlibrsync-72e8318c582f5a821e4ef8bad23abd9c8b98b841.tar.gz
Further implementation of the nad algorithm -- at the moment it
doesn't actually search, but it does do everything else, and it emits literal data correctly.
Diffstat (limited to 'emit.c')
-rw-r--r--emit.c70
1 files changed, 48 insertions, 22 deletions
diff --git a/emit.c b/emit.c
index 8413771..169ed97 100644
--- a/emit.c
+++ b/emit.c
@@ -1,25 +1,24 @@
-/* -*- mode: c; c-file-style: "bsd" -*- */
-/* $Id$ */
-/* emit -- emit encoded commands to the client
-
- Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
- Copyright (C) 1999 by Andrew Tridgell
-
- 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 of the License, 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; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA
-*/
+/* -*- c-file-style: "bsd" -*-
+ *
+ * $Id$
+ *
+ * Copyright (C) 2000 by Martin Pool
+ *
+ * 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 of the License, 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; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
#include "includes.h"
@@ -138,6 +137,33 @@ _hs_emit_literal_cmd(hs_write_fn_t write_fn, void *write_priv, size_t size)
}
+int
+_hs_send_literal(hs_write_fn_t write_fn,
+ void *write_priv,
+ int kind,
+ char const *buf,
+ size_t amount)
+{
+ int ret;
+
+ _hs_trace("flush %d bytes of %s data",
+ (int) amount,
+ kind == op_kind_literal ? "literal" : "signature");
+
+ if (kind == op_kind_literal) {
+ if (_hs_emit_literal_cmd(write_fn, write_priv, amount) < 0)
+ return -1;
+ } else {
+ if (_hs_emit_signature_cmd(write_fn, write_priv, amount) < 0)
+ return -1;
+ }
+
+ ret = hs_must_write(write_fn, write_priv, buf, amount);
+ return_val_if_fail(ret == (int) amount, -1);
+ return amount;
+}
+
+
/* Emit the command header for signature data. */
int
_hs_emit_signature_cmd(hs_write_fn_t write_fn, void *write_priv,