OW2 Consortium accord

Compare Revisions

Ignore whitespace Rev 933 → Rev 934

/tags/odetteftp-1.2.0.RC1/cli-oftp/src/test/java/org/neociclo/accord/components/OftpCmdOptionsTest.java
New file
0,0 → 1,62
package org.neociclo.accord.components;
 
import static org.junit.Assert.assertTrue;
 
import java.io.File;
import java.lang.reflect.Field;
 
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.PosixParser;
import org.junit.Test;
import org.neociclo.accord.components.oftpcmd.CommandLineOption;
import org.neociclo.accord.components.oftpcmd.OftpCmdOptions;
import org.neociclo.odetteftp.TransferMode;
 
/**
* Unit test for simple App.
*/
public class OftpCmdOptionsTest {
 
@Test
public void testOptions() {
OftpCmdOptions options = new OftpCmdOptions();
Options cmdOptions = options.getCommandOptions();
 
int optionField = 0;
Field[] fields = OftpCmdOptions.class.getDeclaredFields();
for (Field field : fields) {
if (field.getAnnotation(CommandLineOption.class) != null) {
optionField++;
}
}
 
assertTrue(optionField == cmdOptions.getOptions().size());
}
 
@SuppressWarnings("deprecation")
@Test
public void testCommandLine() throws Exception {
String[] arguments = { "-oid", "foo", "-verbose", "-server",
"localhost", "-file", "foobar.ext", "-transferMode", "BOTH",
"-fileTimestamp", "01321336" };
OftpCmdOptions options = new OftpCmdOptions();
 
CommandLine cmdLine = new PosixParser().parse(options
.getCommandOptions(), arguments);
 
options.fillOptionsValues(cmdLine);
 
assertTrue("foo".equals(options.getOid()));
assertTrue(options.isVerbose());
assertTrue("localhost".equals(options.getServer()));
assertTrue(new File("foobar.ext").equals(options.getFile()));
assertTrue(options.getTransferMode() == TransferMode.BOTH);
assertTrue(options.getFileTimestamp() != null);
assertTrue(options.getFileTimestamp().getMonth() == 1);
assertTrue(options.getFileTimestamp().getDate() == 1);
assertTrue(options.getFileTimestamp().getHours() == 13);
assertTrue(options.getFileTimestamp().getMinutes() == 36);
}
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/assembly/bin.xml
New file
0,0 → 1,83
<?xml version="1.0" encoding="UTF-8"?>
<!--
Neociclo Accord, Open Source B2Bi Middleware
Copyright (c) 2005-2009 Neociclo, http://www.neociclo.com
 
This program 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.
 
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 Affero General Public License for more details.
 
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
 
<!-- $Id$ -->
 
<assembly>
<id>bin</id>
 
<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>
 
<fileSets>
<fileSet>
<directory>src/main/underlay</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.txt</include>
</includes>
</fileSet>
 
<fileSet>
<directory>src/main/underlay/bin</directory>
<outputDirectory>bin</outputDirectory>
<includes>
<include>aoc.bat</include>
</includes>
<lineEnding>dos</lineEnding>
</fileSet>
 
<fileSet>
<directory>src/main/underlay/bin</directory>
<outputDirectory>bin</outputDirectory>
<includes>
<include>aoc</include>
</includes>
<lineEnding>unix</lineEnding>
<fileMode>0755</fileMode>
</fileSet>
 
<fileSet>
<directory>src/main/underlay/etc</directory>
<outputDirectory>etc</outputDirectory>
</fileSet>
</fileSets>
 
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<useStrictFiltering>true</useStrictFiltering>
<excludes>
<exclude>org.apache.geronimo.gshell:gshell-bootstrap</exclude>
</excludes>
</dependencySet>
 
<dependencySet>
<outputDirectory>lib/boot</outputDirectory>
<outputFileNameMapping>gshell-bootstrap.jar</outputFileNameMapping>
<useStrictFiltering>true</useStrictFiltering>
<includes>
<include>org.apache.geronimo.gshell:gshell-bootstrap</include>
</includes>
</dependencySet>
</dependencySets>
 
</assembly>
Property changes:
Added: svn:eol-style
+ native
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Revision Date Author Id
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/java/org/neociclo/accord/components/oftpcmd/OftpParameters.java
New file
0,0 → 1,44
package org.neociclo.accord.components.oftpcmd;
 
import java.io.File;
import java.util.Date;
 
import org.neociclo.odetteftp.TransferMode;
 
public interface OftpParameters {
 
boolean isVerbose();
 
String getOid();
 
String getServer();
 
File getFile();
 
String getPass();
 
String getOriginator();
 
String getDestination();
 
int getBufferSize();
 
int getWindowSize();
 
int getRecordSize();
 
int getTimeout();
 
TransferMode getTransferMode();
 
String getCipher();
 
boolean isSigned();
 
boolean isEncripted();
 
boolean isCompressed();
 
Date getFileTimestamp();
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/java/org/neociclo/accord/components/oftpcmd/DateCommandOptionConverter.java
New file
0,0 → 1,43
package org.neociclo.accord.components.oftpcmd;
 
import java.util.Calendar;
import java.util.Date;
 
/**
* Parse date based on format MMddHHmm[yy][.ss]
*
* @author bruno
*
*/
public class DateCommandOptionConverter implements CommandOptionConverter<Date> {
 
public Date convert(String... optionArguments) throws Exception {
String value = optionArguments[0];
 
Calendar cal = Calendar.getInstance();
 
try {
cal.set(Calendar.MONTH, Integer.valueOf(value.substring(0, 2)) - 1);
cal.set(Calendar.DAY_OF_MONTH, Integer.valueOf(value
.substring(2, 4)));
cal.set(Calendar.HOUR_OF_DAY, Integer
.valueOf(value.substring(4, 6)));
cal.set(Calendar.MINUTE, Integer.valueOf(value.substring(6, Math
.min(8, value.length()))));
 
if (value.length() > 8 && value.charAt(8) != '.') {
cal.set(Calendar.YEAR, Integer.valueOf(value.substring(8, 10)));
}
 
if (value.indexOf('.') != -1) {
cal.set(Calendar.SECOND, Integer.valueOf(value.substring(value
.indexOf('.') + 1)));
}
} catch (IndexOutOfBoundsException e) {
throw new RuntimeException("Could not parse date: " + value
+ " with format MMddHHmm[yy][.ss]", e);
}
 
return cal.getTime();
}
}
Property changes:
Added: svn:eol-style
+ native
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/java/org/neociclo/accord/components/oftpcmd/OftpMain.java
New file
0,0 → 1,13
package org.neociclo.accord.components.oftpcmd;
 
public class OftpMain {
 
/**
* @param args
*/
public static void main(String[] args) {
OftpCommand command = new OftpCommand();
command.command(args);
}
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/java/org/neociclo/accord/components/oftpcmd/CommandLineOption.java
New file
0,0 → 1,26
package org.neociclo.accord.components.oftpcmd;
 
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
 
import org.apache.commons.cli.Option;
 
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface CommandLineOption {
 
boolean required() default false;
 
boolean hasArg() default true;
 
String description() default "";
 
String name() default "";
 
Class<? extends CommandOptionConverter<?>> converter() default CommandOptionConverter.NullConverter.class;
 
int hasArgs() default Option.UNINITIALIZED;
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/java/org/neociclo/accord/components/oftpcmd/CommandOptionConverter.java
New file
0,0 → 1,10
package org.neociclo.accord.components.oftpcmd;
 
public interface CommandOptionConverter<T> {
 
public interface NullConverter extends CommandOptionConverter<Void> {
}
 
public T convert(String ... options) throws Exception;
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/java/org/neociclo/accord/components/oftpcmd/OftpCommand.java
New file
0,0 → 1,68
package org.neociclo.accord.components.oftpcmd;
 
import java.io.PrintWriter;
import java.util.Arrays;
 
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
 
/**
*
*/
public class OftpCommand {
 
private OftpCmdOptions options = new OftpCmdOptions();
private String[] args;
 
public void command(String... args) {
assignArguments(args);
printHeaderAndVersion();
printHelpIfNeeded();
parseCommandLineOptions();
doCommand();
}
 
private void doCommand() {
OftpProcess process = new OftpProcess(options);
process.start();
}
 
private void assignArguments(String... args) {
this.args = Arrays.copyOf(args, args.length);
}
 
private void parseCommandLineOptions() {
try {
CommandLineParser parser = new PosixParser();
CommandLine cmdLine = parser.parse(options.getCommandOptions(),
args);
 
options.fillOptionsValues(cmdLine);
} catch (ParseException e) {
System.err.println();
System.err.println("** " + e.getMessage());
System.exit(1);
}
}
 
private void printHelpIfNeeded() {
if (args == null || args.length == 0 || "-h".equals(args[0])) {
// automatically generate the help statement
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("aoc", options.getCommandOptions());
System.exit(0);
}
}
 
private void printHeaderAndVersion() {
PrintWriter ps = new PrintWriter(System.out);
ps.println();
ps.println(" Accord OFTP Client v1.0");
ps.println();
ps.flush();
}
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/java/org/neociclo/accord/components/oftpcmd/OftpProcess.java
New file
0,0 → 1,43
package org.neociclo.accord.components.oftpcmd;
 
import static org.neociclo.accord.filetransfer.util.SecurityContextHelper.createUserPasswordCallbackContext;
 
import org.neociclo.accord.core.ContainerFactory;
import org.neociclo.accord.core.IContainer;
import org.neociclo.accord.filetransfer.IConnectContext;
import org.neociclo.accord.filetransfer.IOutgoingFileTransferContainerAdapter;
import org.neociclo.accord.filetransfer.ITransientConnectionContainerAdapter;
 
public class OftpProcess {
 
private static final String OFTP_PROVIDER = "accord.odette-ftp";
 
private OftpParameters options;
 
public OftpProcess(OftpParameters options) {
this.options = options;
}
 
public void start() {
// create container
IContainer oftpc = ContainerFactory.getDefault().createContainer(
OFTP_PROVIDER);
 
// get outgoing file transfer container adapter
if (options.getFile() != null) {
IOutgoingFileTransferContainerAdapter oftpSender = oftpc
.getAdapter(IOutgoingFileTransferContainerAdapter.class);
 
}
 
// do transfer
ITransientConnectionContainerAdapter oftpConn = oftpc
.getAdapter(ITransientConnectionContainerAdapter.class);
String targetID = "oftps://O0055PARTNERA@localhost:6619";
IConnectContext targetConnectContext = createUserPasswordCallbackContext(
"O0055PARTNERA", "NEOCICLO");
oftpConn.execute(targetID, targetConnectContext);
 
}
 
}
Property changes:
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
Added: svn:mime-type
+ text/plain
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/java/org/neociclo/accord/components/oftpcmd/OftpCmdOptions.java
New file
0,0 → 1,280
package org.neociclo.accord.components.oftpcmd;
 
import java.io.File;
import java.lang.reflect.Field;
import java.util.Date;
 
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.neociclo.accord.components.oftpcmd.CommandOptionConverter.NullConverter;
import org.neociclo.odetteftp.TransferMode;
 
public class OftpCmdOptions implements OftpParameters {
 
private static final long serialVersionUID = -4585287071879110557L;
 
private static final int DEFAULT_BUFFERSIZE = 0;
 
private static final int DEFAULT_WINDOWSIZE = 0;
 
private static final int DEFAULT_RECORDSIZE = 0;
 
private static final int DEFAULT_TIMEOUT = 0;
 
private static final TransferMode DEFAULT_TRANSFERMODE = TransferMode.RECEIVER_ONLY;
 
@CommandLineOption(required = true)
private String oid = null;
 
@CommandLineOption(required = true)
private String server = null;
 
@CommandLineOption
private File file = null;
 
@CommandLineOption
private String pass = null;
 
@CommandLineOption
private String originator = null;
 
@CommandLineOption
private String destination = null;
 
@CommandLineOption
private int bufferSize = DEFAULT_BUFFERSIZE;
 
@CommandLineOption
private int windowSize = DEFAULT_WINDOWSIZE;
 
@CommandLineOption
private int recordSize = DEFAULT_RECORDSIZE;
 
@CommandLineOption
private int timeout = DEFAULT_TIMEOUT;
 
@CommandLineOption
private TransferMode transferMode = DEFAULT_TRANSFERMODE;
 
@CommandLineOption
private String cipher = null;
 
@CommandLineOption(hasArg = false)
private boolean signed = false;
 
@CommandLineOption(hasArg = false)
private boolean encripted = false;
 
@CommandLineOption(hasArg = false)
private boolean compressed = false;
 
@CommandLineOption(hasArg = false)
private boolean verbose = false;
 
@CommandLineOption(converter = DateCommandOptionConverter.class, hasArgs = 2)
// first
private Date fileTimestamp;
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#isVerbose()
*/
public boolean isVerbose() {
return verbose;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#getOid()
*/
public String getOid() {
return oid;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#getServer()
*/
public String getServer() {
return server;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#getFile()
*/
public File getFile() {
return file;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#getPass()
*/
public String getPass() {
return pass;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#getOriginator()
*/
public String getOriginator() {
return originator;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#getDestination()
*/
public String getDestination() {
return destination;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#getBufferSize()
*/
public int getBufferSize() {
return bufferSize;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#getWindowSize()
*/
public int getWindowSize() {
return windowSize;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#getRecordSize()
*/
public int getRecordSize() {
return recordSize;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#getTimeout()
*/
public int getTimeout() {
return timeout;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#getTransferMode()
*/
public TransferMode getTransferMode() {
return transferMode;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#getCipher()
*/
public String getCipher() {
return cipher;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#isSigned()
*/
public boolean isSigned() {
return signed;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#isEncripted()
*/
public boolean isEncripted() {
return encripted;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#isCompressed()
*/
public boolean isCompressed() {
return compressed;
}
 
/* (non-Javadoc)
* @see org.neociclo.accord.components.oftpcmd.OftpParameters#getFileTimestamp()
*/
public Date getFileTimestamp() {
return fileTimestamp;
}
 
public static long getSerialversionuid() {
return serialVersionUID;
}
 
private Options options;
 
public Options getCommandOptions() {
if (options != null) {
return options;
}
options = new Options();
 
iterateFields(new IterationFieldCallback() {
public void iterate(Field field, CommandLineOption cmdOption) {
Option option = new Option(field.getName(), cmdOption.hasArg(),
cmdOption.description());
 
option.setType(field.getType());
options.addOption(option);
}
});
 
return options;
}
 
public void fillOptionsValues(final CommandLine cmdLine) {
iterateFields(new IterationFieldCallback() {
@SuppressWarnings({ "rawtypes", "unchecked" })
public void iterate(Field field, CommandLineOption cmdOption)
throws Exception {
String option = cmdOption.name().length() > 0 ? cmdOption
.name() : field.getName();
 
if (cmdLine.hasOption(option) == false) {
return;
}
 
Object parsedValue = null;
 
if (cmdOption.converter() != NullConverter.class) {
CommandOptionConverter converter = cmdOption.converter()
.newInstance();
String[] optionArgs = cmdLine.getOptionValues(option);
parsedValue = converter.convert(optionArgs);
} else if (field.getType() == boolean.class
|| field.getType() == Boolean.class) {
parsedValue = cmdLine.hasOption(option);
} else if (field.getType().isEnum()) {
Class<Enum> enumType = (Class<Enum>) field.getType();
parsedValue = Enum.valueOf(enumType, cmdLine
.getOptionValue(option).toUpperCase());
} else {
parsedValue = cmdLine.getParsedOptionValue(option);
}
 
field.set(OftpCmdOptions.this, parsedValue);
}
});
}
 
private void iterateFields(IterationFieldCallback callback) {
Class<OftpCmdOptions> clazz = OftpCmdOptions.class;
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
if (field.isAnnotationPresent(CommandLineOption.class) == false) {
continue;
}
 
field.setAccessible(true);
try {
callback.iterate(field, field
.getAnnotation(CommandLineOption.class));
} catch (Exception e) {
e.printStackTrace();
}
}
}
 
private interface IterationFieldCallback {
void iterate(Field field, CommandLineOption cmdOption) throws Exception;
}
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/underlay/bin/aoc
New file
0,0 → 1,63
#!/bin/sh
##
## Licensed to the Apache Software Foundation (ASF) under one
## or more contributor license agreements. See the NOTICE file
## distributed with this work for additional information
## regarding copyright ownership. The ASF licenses this file
## to you under the Apache License, Version 2.0 (the
## "License"); you may not use this file except in compliance
## with the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing,
## software distributed under the License is distributed on an
## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
## KIND, either express or implied. See the License for the
## specific language governing permissions and limitations
## under the License.
##
 
##
## $Rev: 572508 $ $Date: 2007-09-04 01:21:20 -0300 (Tue, 04 Sep 2007) $
##
 
DIRNAME=`dirname "$0"`
GSHELL_PROGRAM="-Dgshell.program=$0"
 
# OS specific support (must be 'true' or 'false').
cygwin=false;
case "`uname`" in
CYGWIN*)
cygwin=true
;;
esac
 
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$GSHELL_HOME" ] && GSHELL_HOME=`cygpath --unix "$GSHELL_HOME"`
[ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"`
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
 
# Locate GSHELL_HOME if not it is not set
if [ "x$GSHELL_HOME" = "x" ]; then
GSHELL_HOME=`cd "$DIRNAME/.."; pwd`
fi
 
# Determine the Java command to use to start the JVM
if [ -z "$JAVACMD" ]; then
if [ -n "$JAVA_HOME" ]; then
JAVACMD="$JAVA_HOME/bin/java"
else
JAVACMD="java"
fi
fi
 
BOOTJAR="$GSHELL_HOME/lib/boot/gshell-bootstrap.jar"
if $cygwin ; then
BOOTJAR=`cygpath --windows "$BOOTJAR"`
fi
 
# Start the JVM
exec "$JAVACMD" $JAVA_OPTS -jar "$BOOTJAR" "$@"
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/underlay/bin/aoc.bat
New file
0,0 → 1,81
@REM
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM
@if "%DEBUG%" == "" @echo off
 
@REM
@REM $Rev$ $Date$
@REM
 
if "%OS%"=="Windows_NT" setlocal enableextensions
set ERRORLEVEL=0
 
:begin
 
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.\
 
:check_JAVACMD
if not "%JAVACMD%" == "" goto check_GSHELL_HOME
 
:check_JAVA_HOME
if not "%JAVA_HOME%" == "" goto have_JAVA_HOME
set JAVACMD=java
goto check_GSHELL_HOME
 
:have_JAVA_HOME
set JAVACMD=%JAVA_HOME%\bin\java
goto check_GSHELL_HOME
 
:check_GSHELL_HOME
if "%GSHELL_HOME%" == "" set GSHELL_HOME=%DIRNAME%..
 
:init
@REM Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%eval[2+2]" == "4" goto 4NT_args
 
@REM Regular WinNT shell
set ARGS=%*
goto execute
 
:win9xME_args
@REM Slurp the command line arguments. This loop allows for an unlimited number
set ARGS=
 
:win9xME_args_slurp
if "x%1" == "x" goto execute
set ARGS=%ARGS% %1
shift
goto win9xME_args_slurp
 
:4NT_args
@REM Get arguments from the 4NT Shell from JP Software
set ARGS=%$
 
:execute
 
set BOOTJAR=%GSHELL_HOME%\lib\boot\gshell-bootstrap.jar
 
@REM Start the JVM
"%JAVACMD%" %JAVA_OPTS% -jar "%BOOTJAR%" %ARGS%
 
:end
 
if "%OS%"=="Windows_NT" endlocal
if "%GSHELL_BATCH_PAUSE%" == "on" pause
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ CRLF
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/underlay/etc/gshell.properties
New file
0,0 → 1,9
##
## $Rev: 726410 $ $Date: 2008-12-14 08:48:08 -0200 (Sun, 14 Dec 2008) $
##
 
 
##
## DO NOT EDIT THIS LINE
##
gshell.main=org.neociclo.accord.components.oftpcmd.OftpMain
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/underlay/etc/log4j.xml
New file
0,0 → 1,82
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
 
http://www.apache.org/licenses/LICENSE-2.0
 
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
 
<!-- $Rev$ $Date$ -->
 
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
 
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
 
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<param name="Threshold" value="${gshell.log.console.level}"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %-25.30c{1} [%t] %m%n"/>
</layout>
</appender>
 
<appender name="FILE" class="org.apache.log4j.FileAppender">
<param name="File" value="${gshell.home}/var/log/gshell.log"/>
<param name="Append" value="false"/>
<param name="Threshold" value="DEBUG"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p (%t) [%c] %m%n"/>
</layout>
</appender>
 
<logger name="org.apache.geronimo.gshell.parser.CommandLineParser">
<level value="INFO"/>
</logger>
 
<logger name="org.apache.geronimo.gshell.wisdom.application.ApplicationSecurityManager">
<level value="DEBUG"/>
</logger>
 
<logger name="org.apache.geronimo.gshell.console">
<level value="INFO"/>
</logger>
 
<logger name="org.springframework">
<level value="WARN"/>
</logger>
 
<logger name="org.apache.commons.vfs.cache">
<level value="INFO"/>
</logger>
<logger name="org.apache.maven">
<level value="INFO"/>
</logger>
 
<logger name="org.apache.maven.artifact.manager.WagonManager:default">
<level value="ERROR"/>
</logger>
 
<logger name="org.apache.commons.jexl.ExpressionFactory">
<level value="INFO"/>
</logger>
<root>
<level value="${gshell.log.console.level}"/>
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
 
</log4j:configuration>
Property changes:
Added: svn:eol-style
+ native
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Revision Date Author Id
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/underlay/etc/security.properties
New file
0,0 → 1,27
##
## Licensed to the Apache Software Foundation (ASF) under one
## or more contributor license agreements. See the NOTICE file
## distributed with this work for additional information
## regarding copyright ownership. The ASF licenses this file
## to you under the Apache License, Version 2.0 (the
## "License"); you may not use this file except in compliance
## with the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing,
## software distributed under the License is distributed on an
## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
## KIND, either express or implied. See the License for the
## specific language governing permissions and limitations
## under the License.
##
 
##
## $Rev: 720453 $ $Date: 2008-11-25 07:48:10 -0200 (Tue, 25 Nov 2008) $
##
 
# user.username = password,role1,role2,...
# role.rolename = permissionDefinition1, permissionDefinition2, ...
 
user.test=test
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/underlay/NOTICE.txt
New file
0,0 → 1,10
=========================================================================
== NOTICE file corresponding to section 4(d) of the Apache License, ==
== Version 2.0, in this case for the Apache Geronimo distribution. ==
=========================================================================
 
Apache Geronimo
Copyright 2007-2009 The Apache Software Foundation
 
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/cli-oftp/src/main/underlay/LICENSE.txt
New file
0,0 → 1,202
 
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
 
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
 
1. Definitions.
 
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
 
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
 
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
 
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
 
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
 
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
 
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
 
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
 
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
 
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
 
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
 
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
 
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
 
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
 
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
 
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
 
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
 
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
 
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
 
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
 
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
 
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
 
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
 
END OF TERMS AND CONDITIONS
 
APPENDIX: How to apply the Apache License to your work.
 
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
 
Copyright [yyyy] [name of copyright owner]
 
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
 
http://www.apache.org/licenses/LICENSE-2.0
 
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/cli-oftp/pom.xml
New file
0,0 → 1,90
<?xml version="1.0" encoding="UTF-8"?>
<!--
Neociclo Accord, Open Source B2Bi Middleware
Copyright (c) 2005-2009 Neociclo, http://www.neociclo.com
 
This program 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.
 
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 Affero General Public License for more details.
 
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
 
<!-- $Id$ -->
 
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
<parent>
<groupId>org.neociclo.accord.odetteftp</groupId>
<artifactId>odetteftp-parent</artifactId>
<version>1.2.0-SNAPSHOT</version>
</parent>
 
<modelVersion>4.0.0</modelVersion>
<artifactId>cli-oftp</artifactId>
<name>Accord Odette FTP :: OFTP Command-line Interface</name>
 
<dependencies>
<dependency>
<groupId>org.neociclo.accord.odetteftp</groupId>
<artifactId>oftp-core</artifactId>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.neociclo.accord.components</groupId>
<artifactId>gshell-bootstrap</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.0-RC0</version>
</dependency>
</dependencies>
 
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
</descriptors>
<finalName>accord-cli-oftp-${version}</finalName>
</configuration>
</plugin>
 
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>ianal-maven-plugin</artifactId>
<configuration>
<searchPaths>
<searchPath>accord-cli-oftp-${version}</searchPath>
</searchPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>
Property changes:
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/simpleserver-data/o0055supplier1/accord-oftp.conf
New file
0,0 → 1,2
userCode=O0055SUPPLIER1
password=NEOCICLO
/tags/odetteftp-1.2.0.RC1/examples/simpleserver-data/o0039oemcompany/accord-oftp.conf
New file
0,0 → 1,4
userCode=O0039OEMCOMPANY
password=NEOCICLO
dataExchangeBuffer=728
window=10
/tags/odetteftp-1.2.0.RC1/examples/src/main/resources/keystores/client-bogus.p12
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/tags/odetteftp-1.2.0.RC1/examples/src/main/resources/keystores/server-bogus.p12
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/tags/odetteftp-1.2.0.RC1/examples/src/main/resources/log4j.properties
New file
0,0 → 1,33
#
# Neociclo Accord - Open Source B2B Integration Suite
# Copyright (c) 2005-2008 Neociclo, http://www.neociclo.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 3 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, see <http://www.gnu.org/licenses/>.
#
# $Id$
#
 
#
# The logging properties used for eclipse testing, We want to see INFO output on the console.
#
log4j.rootLogger=TRACE, out
 
#
# uncomment the following line to enable debugging of Camel
#
#log4j.logger.org.apache.camel=DEBUG
 
log4j.appender.out=org.apache.log4j.ConsoleAppender
log4j.appender.out.layout=org.apache.log4j.PatternLayout
log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
Property changes:
Added: svn:mime-type
+ text/plain
/tags/odetteftp-1.2.0.RC1/examples/src/main/resources/mailboxes.properties
New file
0,0 → 1,21
# Neociclo Accord, Open Source B2B Integration Suite
# Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
#
# This program 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.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
 
# $Id: mailboxes.properties 69 2009-01-26 11:44:20Z rafael.marins $
 
O0055FIRSTUSER=NEOCICLO
O0055SECONDUSER=NEOCICLO
Property changes:
Added: svn:mime-type
+ text/plain
/tags/odetteftp-1.2.0.RC1/examples/src/main/resources/odette.properties.sample
New file
0,0 → 1,4
server=
port=
odetteid=
password=
/tags/odetteftp-1.2.0.RC1/examples/src/main/resources/certificates/o0055partnera-public.cer
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/tags/odetteftp-1.2.0.RC1/examples/src/main/resources
Property changes:
Added: svn:ignore
+ odette.properties_
odette.properties
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/server/AuthenticateUsersServerOftplet.java
New file
0,0 → 1,167
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.server;
 
import org.neociclo.odetteftp.OdetteFtpException;
import org.neociclo.odetteftp.OdetteFtpSession;
import org.neociclo.odetteftp.OdetteFtpVersion;
import org.neociclo.odetteftp.oftplet.AnswerReasonInfo;
import org.neociclo.odetteftp.oftplet.EndFileResponse;
import org.neociclo.odetteftp.oftplet.Oftplet;
import org.neociclo.odetteftp.oftplet.OftpletAdapter;
import org.neociclo.odetteftp.oftplet.OftpletListener;
import org.neociclo.odetteftp.oftplet.OftpletSpeaker;
import org.neociclo.odetteftp.oftplet.StartFileResponse;
import org.neociclo.odetteftp.protocol.DeliveryNotification;
import org.neociclo.odetteftp.protocol.OdetteFtpObject;
import org.neociclo.odetteftp.protocol.VirtualFile;
import org.neociclo.odetteftp.security.DefaultSecurityContext;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.security.SecurityContext;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
import org.neociclo.odetteftp.support.OftpletEventListener;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
class AuthenticateUsersServerOftplet extends OftpletAdapter implements Oftplet, OftpletSpeaker, OftpletListener {
 
private OdetteFtpConfiguration config;
private OftpletEventListener listener;
private SecurityContext securityContext;
 
public AuthenticateUsersServerOftplet(OdetteFtpConfiguration config, MappedCallbackHandler securityCallbackHandler, OftpletEventListener listener) {
super();
this.config = config;
this.securityContext = new DefaultSecurityContext(securityCallbackHandler);
this.listener = listener;
}
 
// -------------------------------------------------------------------------
// Oftplet implementation
// -------------------------------------------------------------------------
 
@Override
public boolean isProtocolVersionSupported(OdetteFtpVersion version) {
// server that accepts downgrading the version
return (config != null ? config.getVersion().isEqualOrOlder(version) : super.isProtocolVersionSupported(version));
};
 
@Override
public SecurityContext getSecurityContext() {
return securityContext;
}
 
@Override
public void init(OdetteFtpSession session) throws OdetteFtpException {
config.setup(session);
if (listener != null) {
listener.init(session);
}
}
 
@Override
public void destroy() {
this.config = null;
if (listener != null) {
listener.destroy();
}
}
 
@Override
public void onSessionStart() {
if (listener != null) {
listener.onSessionStart();
}
}
 
@Override
public void onExceptionCaught(Throwable cause) {
if (listener != null) {
listener.onExceptionCaught(cause);
}
}
 
@Override
public void onSessionEnd() {
if (listener != null) {
listener.onSessionEnd();
}
}
 
@Override
public OftpletSpeaker getSpeaker() {
return this;
}
 
@Override
public OftpletListener getListener() {
return this;
}
 
// -------------------------------------------------------------------------
// OftpletSpeaker implementation
// -------------------------------------------------------------------------
 
public OdetteFtpObject nextOftpObjectToSend() {
return null;
}
 
public void onSendFileStart(VirtualFile virtualFile, long answerCount) {
}
 
public void onDataSent(VirtualFile virtualFile, long totalOctetsSent) {
}
 
public void onSendFileEnd(VirtualFile virtualFile) {
}
 
public void onSendFileError(VirtualFile virtualFile, AnswerReasonInfo reason, boolean retryLater) {
}
 
public void onNotificationSent(DeliveryNotification notif) {
}
 
// -------------------------------------------------------------------------
// OftpletListener implementation
// -------------------------------------------------------------------------
 
public StartFileResponse acceptStartFile(VirtualFile virtualFile) {
return null;
}
 
public void onReceiveFileStart(VirtualFile virtualFile, long answerCount) {
}
 
public void onDataReceived(VirtualFile virtualFile, long totalOctetsReceived) {
}
 
public EndFileResponse onReceiveFileEnd(VirtualFile virtualFile, long recordCount, long unitCount) {
return null;
}
 
public void onReceiveFileError(VirtualFile virtualFile, AnswerReasonInfo reason) {
}
 
public void onNotificationReceived(DeliveryNotification notif) {
}
 
}
Property changes:
Added: svn:eol-style
+ native
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/server/SimpleServerOftpletFactory.java
New file
0,0 → 1,57
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.server;
 
import java.io.File;
 
import org.neociclo.odetteftp.oftplet.Oftplet;
import org.neociclo.odetteftp.oftplet.OftpletFactory;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
import org.neociclo.odetteftp.support.OftpletEventListener;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class SimpleServerOftpletFactory implements OftpletFactory {
 
private File serverBaseDir;
private OdetteFtpConfiguration config;
private OftpletEventListener listener;
private MappedCallbackHandler securityCallbackHandler;
 
public SimpleServerOftpletFactory(File serverBaseDir, OdetteFtpConfiguration config, MappedCallbackHandler serverSecurityHandler) {
this(serverBaseDir, config, serverSecurityHandler, null);
}
 
public SimpleServerOftpletFactory(File serverBaseDir, OdetteFtpConfiguration config, MappedCallbackHandler serverSecurityHandler, OftpletEventListener listener) {
super();
this.serverBaseDir = serverBaseDir;
this.config = config;
this.securityCallbackHandler = serverSecurityHandler;
this.listener = listener;
}
 
public Oftplet createProvider() {
return new SimpleServerOftplet(serverBaseDir, config, securityCallbackHandler, listener);
}
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/server/AuthenticateUsersServer.java
New file
0,0 → 1,106
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.server;
 
import java.io.File;
import java.net.InetSocketAddress;
import java.net.URISyntaxException;
import java.net.URL;
 
import org.neociclo.odetteftp.OdetteFtpVersion;
import org.neociclo.odetteftp.TransferMode;
import org.neociclo.odetteftp.examples.support.SessionFinalizationListener;
import org.neociclo.odetteftp.examples.support.UserPropertiesAutheticationHandler;
import org.neociclo.odetteftp.protocol.v20.CipherSuite;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.security.PasswordAuthenticationCallback;
import org.neociclo.odetteftp.security.PasswordCallback;
import org.neociclo.odetteftp.service.TcpServer;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
import org.neociclo.odetteftp.support.PasswordHandler;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class AuthenticateUsersServer {
 
private static final String USER_PROPERTIES_RES = "mailboxes.properties";
 
private static final int SERVER_PORT = 13305;
 
public static void main(String[] args) throws Exception {
 
InetSocketAddress localAddress = new InetSocketAddress(SERVER_PORT);
 
OdetteFtpConfiguration config = createInitialServerConfig();
 
MappedCallbackHandler serverSecurityHandler = new MappedCallbackHandler();
 
//
// add server password authentication handler based on the users
// properties file
//
File userProperties = getResourceFile(USER_PROPERTIES_RES);
serverSecurityHandler.addHandler(PasswordAuthenticationCallback.class,
new UserPropertiesAutheticationHandler(userProperties));
 
//
// add password callback which tells the library to reply with server
// side identification and password
//
serverSecurityHandler.addHandler(PasswordCallback.class,
new PasswordHandler("O0055MYSERVERID", "MYPASSWD"));
 
SessionFinalizationListener sessionFinalizer = new SessionFinalizationListener(1);
 
AuthenticateUsersServerOftpletFactory factory = new AuthenticateUsersServerOftpletFactory(config, serverSecurityHandler, sessionFinalizer);
TcpServer server = new TcpServer(localAddress, factory);
 
server.start();
 
sessionFinalizer.waitFinalization();
server.stop();
 
}
 
private static OdetteFtpConfiguration createInitialServerConfig() {
OdetteFtpConfiguration c = new OdetteFtpConfiguration();
 
c.setTransferMode(TransferMode.BOTH);
c.setVersion(OdetteFtpVersion.OFTP_V14);
c.setDataExchangeBufferSize(4096);
c.setWindowSize(64);
 
c.setUseSecureAuthentication(false);
c.setCipherSuiteSelection(CipherSuite.NO_CIPHER_SUITE_SELECTION);
 
return c;
}
 
public static URL getResource(String name) {
return Thread.currentThread().getContextClassLoader().getResource(name);
}
 
public static File getResourceFile(String name) throws URISyntaxException {
return new File(getResource(name).toURI());
}
 
}
Property changes:
Added: svn:eol-style
+ native
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/server/AuthenticateUsersServerOftpletFactory.java
New file
0,0 → 1,50
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.server;
 
import org.neociclo.odetteftp.oftplet.Oftplet;
import org.neociclo.odetteftp.oftplet.OftpletFactory;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
import org.neociclo.odetteftp.support.OftpletEventListener;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class AuthenticateUsersServerOftpletFactory implements OftpletFactory {
 
private OdetteFtpConfiguration config;
private MappedCallbackHandler securityHandler;
private OftpletEventListener listener;
 
public AuthenticateUsersServerOftpletFactory(OdetteFtpConfiguration config, MappedCallbackHandler securityHandler,
OftpletEventListener listener) {
super();
this.config = config;
this.securityHandler = securityHandler;
this.listener = listener;
}
 
public Oftplet createProvider() {
return new AuthenticateUsersServerOftplet(config, securityHandler, listener);
}
 
}
Property changes:
Added: svn:eol-style
+ native
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/server/SimpleServerAuthenticationHandler.java
New file
0,0 → 1,118
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.server;
 
import static org.neociclo.odetteftp.security.PasswordAuthenticationCallback.AuthenticationResult.*;
import static org.neociclo.odetteftp.examples.server.SimpleServerHelper.*;
 
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Properties;
 
import org.neociclo.odetteftp.protocol.CommandExchangeBuffer;
import org.neociclo.odetteftp.security.PasswordAuthenticationCallback.AuthenticationResult;
import org.neociclo.odetteftp.support.PasswordAuthenticationHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
class SimpleServerAuthenticationHandler extends PasswordAuthenticationHandler {
 
private static final Logger LOGGER = LoggerFactory.getLogger(SimpleServerAuthenticationHandler.class);
 
private File serverBaseDir;
private boolean useMd5Digest;
 
public SimpleServerAuthenticationHandler(File serverDataDir) {
this(serverDataDir, false);
}
 
public SimpleServerAuthenticationHandler(File serverDataDir, boolean useMd5Digest) {
super();
this.serverBaseDir = serverDataDir;
this.useMd5Digest = useMd5Digest;
}
 
@Override
public AuthenticationResult authenticate(String authenticatingUser, String authenticatingPassword) throws IOException {
 
LOGGER.trace("Authenticating user: {}", authenticatingUser);
 
File cfile = getUserConfigFile(serverBaseDir, authenticatingUser);
 
if (!cfile.exists()) {
LOGGER.warn("User mailbox structure doesn't exist: {}", cfile);
return UNKNOWN_USER;
}
 
Properties conf = new Properties();
conf.load(new FileInputStream(cfile));
 
String pwd = (String) conf.get("password");
 
if (pwd == null) {
LOGGER.warn("No user password were set in config file: {}", cfile);
return INVALID_PASSWORD;
}
 
boolean passwordMatch = false;
if (useMd5Digest) {
String passwordHash;
try {
passwordHash = hash(authenticatingPassword);
} catch (NoSuchAlgorithmException e) {
throw new IOException("Failed to generate MD5 digest over the password.", e);
}
passwordMatch = (passwordHash.equals(pwd));
} else {
passwordMatch = (authenticatingPassword.equalsIgnoreCase(pwd));
}
 
return (passwordMatch ? SUCCESS : INVALID_PASSWORD);
}
 
private String hash(String text) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(text.getBytes(CommandExchangeBuffer.DEFAULT_PROTOCOL_CHARSET));
byte[] digest = md.digest();
return toHexString(digest);
}
 
private String toHexString(byte[] digest) {
StringBuffer sb = new StringBuffer();
for (byte d : digest) {
String hex = Integer.toHexString((int) (d & 0xff));
if (hex.length() == 1) {
sb.append('0').append(hex);
} else {
sb.append(hex);
}
}
return sb.toString();
}
 
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/server/SimpleServerOftplet.java
New file
0,0 → 1,381
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.server;
 
import static org.neociclo.odetteftp.examples.server.SimpleServerHelper.*;
import static org.neociclo.odetteftp.protocol.DefaultStartFileResponse.*;
import static org.neociclo.odetteftp.protocol.DefaultEndFileResponse.*;
 
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
 
import org.neociclo.odetteftp.OdetteFtpException;
import org.neociclo.odetteftp.OdetteFtpSession;
import org.neociclo.odetteftp.OdetteFtpVersion;
import org.neociclo.odetteftp.oftplet.AnswerReasonInfo;
import org.neociclo.odetteftp.oftplet.EndFileResponse;
import org.neociclo.odetteftp.oftplet.OftpletAdapter;
import org.neociclo.odetteftp.oftplet.OftpletListener;
import org.neociclo.odetteftp.oftplet.OftpletSpeaker;
import org.neociclo.odetteftp.oftplet.StartFileResponse;
import org.neociclo.odetteftp.protocol.AnswerReason;
import org.neociclo.odetteftp.protocol.DeliveryNotification;
import org.neociclo.odetteftp.protocol.OdetteFtpObject;
import org.neociclo.odetteftp.protocol.VirtualFile;
import org.neociclo.odetteftp.security.DefaultSecurityContext;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.security.SecurityContext;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
import org.neociclo.odetteftp.support.OftpletEventListener;
import org.neociclo.odetteftp.support.PropertiesBasedConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
class SimpleServerOftplet extends OftpletAdapter implements org.neociclo.odetteftp.oftplet.ServerOftplet, OftpletSpeaker, OftpletListener {
 
private static final Logger LOGGER = LoggerFactory.getLogger(SimpleServerOftplet.class);
 
private static final SimpleServerRoutingWorker ROUTING_WORKER = new SimpleServerRoutingWorker();
 
private File serverBaseDir;
private OftpletEventListener listener;
private SecurityContext securityContext;
private OdetteFtpConfiguration config;
private OdetteFtpSession session;
 
public SimpleServerOftplet(File serverBaseDir, OdetteFtpConfiguration config, MappedCallbackHandler securityCallbackHandler, OftpletEventListener listener) {
super();
this.serverBaseDir = serverBaseDir;
this.config = config;
this.securityContext = new DefaultSecurityContext(securityCallbackHandler);
this.listener = listener;
}
 
// -------------------------------------------------------------------------
// Oftplet implementation
// -------------------------------------------------------------------------
 
@Override
public boolean isProtocolVersionSupported(OdetteFtpVersion version) {
// server that accepts downgrading the version
return (config != null ? config.getVersion().isEqualOrOlder(version) : super.isProtocolVersionSupported(version));
};
 
@Override
public SecurityContext getSecurityContext() {
return securityContext;
}
 
@Override
public void init(OdetteFtpSession session) throws OdetteFtpException {
this.session = session;
config.setup(session);
 
if (listener != null) {
listener.init(session);
}
}
 
public void configure() {
 
// setup custom parameters specific to this user configuration
String userCode = session.getUserCode();
File configFile = getUserConfigFile(serverBaseDir, userCode);
PropertiesBasedConfiguration customConfig = new PropertiesBasedConfiguration();
 
try {
customConfig.load(new FileInputStream(configFile));
customConfig.setup(session);
} catch (IOException e) {
LOGGER.error("Cannot load user's custom configuration.", e);
}
 
if (listener != null) {
listener.configure(session);
}
}
 
@Override
public void destroy() {
this.config = null;
this.session = null;
this.securityContext = null;
if (listener != null) {
listener.destroy();
}
}
 
@Override
public void onSessionStart() {
 
String userCode = session.getUserCode();
createUserDirStructureIfNotExist(userCode);
 
if (listener != null) {
listener.onSessionStart();
}
}
 
@Override
public void onExceptionCaught(Throwable cause) {
LOGGER.error("Exception Caught.", cause);
if (listener != null) {
listener.onExceptionCaught(cause);
}
}
 
@Override
public void onSessionEnd() {
if (listener != null) {
listener.onSessionEnd();
}
}
 
@Override
public OftpletSpeaker getSpeaker() {
return this;
}
 
@Override
public OftpletListener getListener() {
return this;
}
 
// -------------------------------------------------------------------------
// OftpletSpeaker implementation
// -------------------------------------------------------------------------
 
public OdetteFtpObject nextOftpObjectToSend() {
 
OdetteFtpObject next = null;
 
String userCode = session.getUserCode();
File[] exchanges = listExchanges(userCode);
 
if (exchanges.length > 0) {
File cur = exchanges[0];
try {
next = loadObject(cur);
} catch (IOException e) {
LOGGER.error("Failed to load Odette FTP obejct file: " + cur, e);
if (cur.exists()) {
cur.delete();
}
}
}
 
return next;
 
}
 
public void onSendFileStart(VirtualFile virtualFile, long answerCount) {
}
 
public void onDataSent(VirtualFile virtualFile, long totalOctetsSent) {
}
 
public void onSendFileEnd(VirtualFile virtualFile) {
deleteExchange(virtualFile);
}
 
public void onSendFileError(VirtualFile virtualFile, AnswerReasonInfo reason, boolean retryLater) {
}
 
public void onNotificationSent(DeliveryNotification notif) {
deleteExchange(notif);
}
 
// -------------------------------------------------------------------------
// OftpletListener implementation
// -------------------------------------------------------------------------
 
public StartFileResponse acceptStartFile(VirtualFile vf) {
 
String userCode = session.getUserCode();
String recipientOid = vf.getDestination();
 
if (!recipientExists(userCode, recipientOid)) {
return negativeStartFileAnswer(AnswerReason.INVALID_DESTINATION,
"Recipient [" + recipientOid + "] doesn't exist.", false);
}
createUserDirStructureIfNotExist(recipientOid);
 
if (targetFileExists(recipientOid, vf)) {
return negativeStartFileAnswer(AnswerReason.DUPLICATE_FILE,
"File already exist in the recipient [" + recipientOid + "].", true);
}
 
File dataFile = null;
try {
dataFile = createDataFile(vf);
} catch (IOException e) {
LOGGER.error("Cannot create data file for object: " + vf, e);
return negativeStartFileAnswer(AnswerReason.ACCESS_METHOD_FAILURE, "Couldn't store file in local system.",
true);
}
return positiveStartFileAnswer(dataFile);
}
 
public void onReceiveFileStart(VirtualFile virtualFile, long answerCount) {
 
try {
store(virtualFile);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
 
}
 
public void onDataReceived(VirtualFile virtualFile, long totalOctetsReceived) {
}
 
public EndFileResponse onReceiveFileEnd(VirtualFile virtualFile, long recordCount, long unitCount) {
 
String userCode = session.getUserCode();
ROUTING_WORKER.deliver(serverBaseDir, userCode, virtualFile);
 
return positiveEndFileAnswer(hasExchange(userCode));
}
 
public void onReceiveFileError(VirtualFile virtualFile, AnswerReasonInfo reason) {
}
 
public void onNotificationReceived(DeliveryNotification notif) {
 
String userCode = session.getUserCode();
 
try {
store(notif);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
 
ROUTING_WORKER.deliver(serverBaseDir, userCode, notif);
 
}
 
// -------------------------------------------------------------------------
// Implementation specific methods
// -------------------------------------------------------------------------
 
private void store(OdetteFtpObject obj) throws IOException {
 
String userCode = session.getUserCode();
 
File workDir = getUserWorkDir(serverBaseDir, userCode);
String filename = createFileName(obj);
 
File outputFile = new File(workDir, filename);
storeObject(outputFile, obj);
 
}
 
private void createUserDirStructureIfNotExist(String userCode) {
 
File dataDir = getServerDataDir(serverBaseDir);
File mailboxDir = getUserMailboxDir(serverBaseDir, userCode);
File workDir = getUserWorkDir(serverBaseDir, userCode);
 
if (!dataDir.exists()) {
dataDir.mkdirs();
}
 
if (!mailboxDir.exists()) {
mailboxDir.mkdirs();
}
 
if (!workDir.exists()) {
workDir.mkdirs();
}
 
}
 
private boolean recipientExists(String userCode, String recipientOid) {
File recipientConf = getUserConfigFile(serverBaseDir, recipientOid);
return recipientConf.exists();
}
 
/**
* Check if the Virtual File already exist in the recipient mailbox.
*
* @param recipientOid
* @param vf
* @return
*/
private boolean targetFileExists(String recipientOid, VirtualFile vf) {
 
String filename = createFileName(vf);
File mailboxDir = getUserMailboxDir(serverBaseDir, recipientOid);
 
File target = new File(mailboxDir, filename);
return target.exists();
}
 
private File createDataFile(VirtualFile vf) throws IOException {
String filename = createFileName(vf);
File dataDir = getServerDataDir(serverBaseDir);
return File.createTempFile(filename + "_", null, dataDir);
}
 
/**
* Check it has exchange in the user mailbox.
*
* @param userCode
* @return
*/
private boolean hasExchange(String userCode) {
File[] exchanges = listExchanges(userCode);
return (exchanges != null && exchanges.length > 0);
}
 
private File[] listExchanges(String userCode) {
File mailboxDir = getUserMailboxDir(serverBaseDir, userCode);
File[] exchanges = mailboxDir.listFiles(EXCHANGES_FILENAME_FILTER);
return exchanges;
}
 
private void deleteExchange(OdetteFtpObject obj) {
if (obj instanceof VirtualFile) {
VirtualFile vf = (VirtualFile) obj;
File payloadFile = vf.getFile();
if (payloadFile.exists()) {
payloadFile.delete();
}
}
 
String userCode = session.getUserCode();
File mailboxDir = getUserMailboxDir(serverBaseDir, userCode);
String filename = createFileName(obj);
File mailboxFile = new File(mailboxDir, filename);
 
if (mailboxFile.exists()) {
mailboxFile.delete();
}
}
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/server/SimpleServer.java
New file
0,0 → 1,99
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.server;
 
import java.io.File;
import java.net.InetSocketAddress;
import java.net.URISyntaxException;
import java.net.URL;
 
import org.neociclo.odetteftp.OdetteFtpVersion;
import org.neociclo.odetteftp.TransferMode;
import org.neociclo.odetteftp.protocol.v20.CipherSuite;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.security.PasswordAuthenticationCallback;
import org.neociclo.odetteftp.security.PasswordCallback;
import org.neociclo.odetteftp.service.TcpServer;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
import org.neociclo.odetteftp.support.PasswordHandler;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class SimpleServer {
 
private static final int SERVER_PORT = 13305;
 
private static final File SERVER_DIR = new File(".", "simpleserver-data");
 
public static void main(String[] args) throws Exception {
 
InetSocketAddress localAddress = new InetSocketAddress(SERVER_PORT);
 
OdetteFtpConfiguration config = createInitialServerConfig();
 
MappedCallbackHandler serverSecurityHandler = new MappedCallbackHandler();
 
//
// add server password authentication handler based on the users
// properties file
//
serverSecurityHandler.addHandler(PasswordAuthenticationCallback.class,
new SimpleServerAuthenticationHandler(SERVER_DIR));
 
//
// add password callback which tells the library to reply with server
// side identification and password
//
serverSecurityHandler.addHandler(PasswordCallback.class,
new PasswordHandler("O0055MYSERVERID", "MYPASSWD"));
 
SimpleServerOftpletFactory factory = new SimpleServerOftpletFactory(SERVER_DIR, config, serverSecurityHandler);
TcpServer server = new TcpServer(localAddress, factory);
 
server.start();
 
System.out.println("Press Ctrl+C to stop.");
}
 
private static OdetteFtpConfiguration createInitialServerConfig() {
OdetteFtpConfiguration c = new OdetteFtpConfiguration();
 
c.setTransferMode(TransferMode.BOTH);
c.setVersion(OdetteFtpVersion.OFTP_V14);
c.setDataExchangeBufferSize(4096);
c.setWindowSize(64);
 
c.setUseSecureAuthentication(false);
c.setCipherSuiteSelection(CipherSuite.NO_CIPHER_SUITE_SELECTION);
 
return c;
}
 
public static URL getResource(String name) {
return Thread.currentThread().getContextClassLoader().getResource(name);
}
 
public static File getResourceFile(String name) throws URISyntaxException {
return new File(getResource(name).toURI());
}
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/server/SimpleServerHelper.java
New file
0,0 → 1,134
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.server;
 
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
 
import org.neociclo.odetteftp.protocol.OdetteFtpObject;
import org.neociclo.odetteftp.protocol.VirtualFile;
import org.neociclo.odetteftp.util.ProtocolUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
class SimpleServerHelper {
 
private static final Logger LOGGER = LoggerFactory.getLogger(SimpleServerHelper.class);
public static final FilenameFilter EXCHANGES_FILENAME_FILTER = new FilenameFilter() {
public boolean accept(File dir, String name) {
return (name.endsWith(".vfile") || name.endsWith(".notif"));
}
};
 
private SimpleServerHelper() {
}
 
public static String createFileName(OdetteFtpObject obj) {
StringBuffer sb = new StringBuffer();
sb.append(obj.getOriginator()).append('$');
sb.append(obj.getDestination()).append('$');
sb.append(ProtocolUtil.formatDate("yyyyMMddHHmmSS.sss", obj.getDateTime())).append('$');
sb.append(obj.getDatasetName());
if (obj instanceof VirtualFile) {
sb.append(".vfile");
} else {
sb.append(".notif");
}
return sb.toString();
}
 
public static File getServerDataDir(File baseDir) {
return new File(baseDir, "data");
}
 
public static File getUserDir(File baseDir, String userCode) {
return new File(baseDir, userCode.toLowerCase());
}
 
public static File getUserMailboxDir(File baseDir, String userCode) {
return new File(getUserDir(baseDir, userCode), "mailbox");
}
 
public static File getUserWorkDir(File baseDir, String userCode) {
return new File(getUserDir(baseDir, userCode), "work");
}
 
public static File getUserConfigFile(File baseDir, String userCode) {
return new File(getUserDir(baseDir, userCode), "accord-oftp.conf");
}
 
public static OdetteFtpObject loadObject(File input) throws IOException {
OdetteFtpObject obj = null;
FileInputStream stream = new FileInputStream(input);
ObjectInputStream os = new ObjectInputStream(stream);
try {
obj = (OdetteFtpObject) os.readObject();
} catch (ClassNotFoundException cnfe) {
LOGGER.error("Cannot load Odette FTP Object file: " + input, cnfe);
} finally {
try {
os.close();
} catch (Throwable t) {
// do nothing
}
try {
stream.close();
} catch (Throwable t) {
// do nothing
}
}
return obj;
}
 
public static void storeObject(File output, OdetteFtpObject obj) throws IOException {
FileOutputStream stream = new FileOutputStream(output);
ObjectOutputStream os = new ObjectOutputStream(stream);
try {
os.writeObject(obj);
os.flush();
stream.flush();
} finally {
try {
os.close();
stream.close();
} catch (Throwable t) {
// do nothing
}
}
}
 
}
Property changes:
Added: svn:eol-style
+ native
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/server/SimpleServerRoutingWorker.java
New file
0,0 → 1,97
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.server;
 
import java.io.File;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
 
import org.neociclo.odetteftp.protocol.OdetteFtpObject;
import org.neociclo.odetteftp.util.IoUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
 
class SimpleServerRoutingWorker {
 
private static final Logger LOGGER = LoggerFactory.getLogger(SimpleServerRoutingWorker.class);
 
private static class MakeDeliveryTask implements Runnable {
private String userCode;
private OdetteFtpObject obj;
private File baseDir;
public MakeDeliveryTask(File baseDir, String userCode, OdetteFtpObject obj) {
super();
this.baseDir = baseDir;
this.userCode = userCode;
this.obj = obj;
}
public void run() {
String filename = SimpleServerHelper.createFileName(obj);
File sourceDir = SimpleServerHelper.getUserWorkDir(baseDir, userCode);
File sourceFile = new File(sourceDir, filename);
String recipientOid = obj.getDestination();
File destDir = SimpleServerHelper.getUserMailboxDir(baseDir, recipientOid);
File destFile = new File(destDir, filename);
if (destFile.exists()) {
LOGGER.warn("Delivery failed. Duplicate file in recipient mailbox. This is a simple server " +
"implementation and it doesn't support delivery retries. Overwriting file: {}", destFile);
}
 
try {
IoUtil.move(sourceFile, destFile);
LOGGER.info("Delivered to [{}]: ", recipientOid, obj);
} catch (IOException e) {
LOGGER.info("Delivery failed. Cannot move object file to the recipient box [{}]: {}", recipientOid,
sourceFile);
LOGGER.error("Routing failed.", e);
return;
}
}
}
 
private ExecutorService executor;
 
public SimpleServerRoutingWorker() {
super();
this.executor = Executors.newCachedThreadPool();
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
public void run() {
executor.shutdown();
}
}));
}
 
public void deliver(File baseDir, String userCode, OdetteFtpObject obj) {
 
SimpleServerRoutingWorker.MakeDeliveryTask task = new MakeDeliveryTask(baseDir, userCode, obj);
executor.submit(task);
 
}
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/support/SessionFinalizationListener.java
New file
0,0 → 1,73
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.support;
 
import static java.util.concurrent.TimeUnit.*;
 
import java.util.concurrent.atomic.AtomicInteger;
 
import org.neociclo.odetteftp.OdetteFtpException;
import org.neociclo.odetteftp.OdetteFtpSession;
import org.neociclo.odetteftp.support.OftpletEventListenerAdapter;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class SessionFinalizationListener extends OftpletEventListenerAdapter {
 
private final Object lock = new Object();
 
private final AtomicInteger noInits = new AtomicInteger();
private final AtomicInteger noDestroys = new AtomicInteger();
 
private int noOfSessions;
 
public SessionFinalizationListener(int noOfSessions) {
super();
this.noOfSessions = noOfSessions;
}
 
@Override
public void init(OdetteFtpSession session) throws OdetteFtpException {
synchronized (noInits) {
noInits.incrementAndGet();
}
}
 
@Override
public void destroy() {
synchronized (noDestroys) {
int deltaStarts = noInits.get();
int deltaEnds = noDestroys.incrementAndGet();
if (deltaStarts >= noOfSessions && deltaEnds >= noOfSessions) {
synchronized (lock) {
lock.notifyAll();
}
}
}
}
 
public void waitFinalization() throws InterruptedException {
synchronized (lock) {
lock.wait(MINUTES.toMillis(5));
}
}
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/support/DefaultOftplet.java
New file
0,0 → 1,67
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.support;
 
import org.neociclo.odetteftp.OdetteFtpException;
import org.neociclo.odetteftp.OdetteFtpSession;
import org.neociclo.odetteftp.oftplet.OftpletAdapter;
import org.neociclo.odetteftp.protocol.EndSessionException;
import org.neociclo.odetteftp.security.DefaultSecurityContext;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.security.SecurityContext;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
 
/**
* @author Rafael Marins
* @version $Rev$
*/
public class DefaultOftplet extends OftpletAdapter {
 
private OdetteFtpConfiguration conf;
private SecurityContext securityContext;
 
public DefaultOftplet(OdetteFtpConfiguration conf, MappedCallbackHandler callbackHandler) {
this.conf = conf;
this.securityContext = new DefaultSecurityContext(callbackHandler);
}
 
@Override
public void init(OdetteFtpSession session) throws OdetteFtpException {
// use the SessionConfig object to configure session parameters
if (conf != null) {
conf.setup(session);
}
}
 
@Override
public SecurityContext getSecurityContext() {
return securityContext;
}
 
@Override
public void onExceptionCaught(Throwable cause) {
if (cause instanceof EndSessionException) {
EndSessionException es = (EndSessionException) cause;
System.err.println("SESSION ERROR: " + es.getReason());
} else {
cause.printStackTrace();
}
}
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/support/BogusTrustManagerFactory.java
New file
0,0 → 1,85
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.support;
 
import java.security.InvalidAlgorithmParameterException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
 
import javax.net.ssl.ManagerFactoryParameters;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactorySpi;
import javax.net.ssl.X509TrustManager;
 
/**
* Bogus {@link TrustManagerFactorySpi} which accepts any certificate
* even if it is invalid.
*
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
* @version $Rev$ $Date$
*/
public class BogusTrustManagerFactory extends TrustManagerFactorySpi {
 
private static final TrustManager DUMMY_TRUST_MANAGER = new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
 
public void checkClientTrusted(
X509Certificate[] chain, String authType) throws CertificateException {
// Always trust - it is an example.
// You should do something in the real world.
// You will reach here only if you enabled client certificate auth,
// as described in SecureChatSslContextFactory.
System.err.println(
"UNKNOWN CLIENT CERTIFICATE: " + chain[0].getSubjectDN());
}
 
public void checkServerTrusted(
X509Certificate[] chain, String authType) throws CertificateException {
// Always trust - it is an example.
// You should do something in the real world.
System.err.println(
"UNKNOWN SERVER CERTIFICATE: " + chain[0].getSubjectDN());
}
};
 
public static TrustManager[] getTrustManagers() {
return new TrustManager[] { DUMMY_TRUST_MANAGER };
}
 
@Override
protected TrustManager[] engineGetTrustManagers() {
return getTrustManagers();
}
 
@Override
protected void engineInit(KeyStore keystore) throws KeyStoreException {
// Unused
}
 
@Override
protected void engineInit(ManagerFactoryParameters managerFactoryParameters)
throws InvalidAlgorithmParameterException {
// Unused
}
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/support/SampleOftpSslContextFactory.java
New file
0,0 → 1,58
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.support;
 
import java.security.Security;
 
import javax.net.ssl.SSLContext;
 
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class SampleOftpSslContextFactory {
 
private static final String PROTOCOL = "TLS";
private static final SSLContext CLIENT_CONTEXT;
 
static {
String algorithm = Security.getProperty("ssl.KeyManagerFactory.algorithm");
if (algorithm == null) {
algorithm = "SunX509";
}
 
SSLContext clientContext = null;
try {
clientContext = SSLContext.getInstance(PROTOCOL);
clientContext.init(null, BogusTrustManagerFactory.getTrustManagers(), null);
} catch (Exception e) {
throw new Error(
"Failed to initialize the client-side SSLContext", e);
}
 
CLIENT_CONTEXT = clientContext;
}
 
public static SSLContext getClientContext() {
return CLIENT_CONTEXT;
}
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/support/DefaultOftpletFactory.java
New file
0,0 → 1,50
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.support;
 
import org.neociclo.odetteftp.oftplet.Oftplet;
import org.neociclo.odetteftp.oftplet.OftpletFactory;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
 
/**
* @author Rafael Marins
* @version $Rev$
*/
public class DefaultOftpletFactory implements OftpletFactory {
 
private OdetteFtpConfiguration conf;
private MappedCallbackHandler callbackHandler;
 
public DefaultOftpletFactory(MappedCallbackHandler callbackHandler) {
this(new OdetteFtpConfiguration(), callbackHandler);
}
 
public DefaultOftpletFactory(OdetteFtpConfiguration conf, MappedCallbackHandler callbackHandler) {
this.conf = conf;
this.callbackHandler = callbackHandler;
}
 
public Oftplet createProvider() {
Oftplet oftplet = new DefaultOftplet(conf, callbackHandler);
return oftplet;
}
 
}
Property changes:
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
Added: svn:mime-type
+ text/plain
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/support/UserPropertiesAutheticationHandler.java
New file
0,0 → 1,118
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.support;
 
import static org.neociclo.odetteftp.security.PasswordAuthenticationCallback.AuthenticationResult.*;
 
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Properties;
 
import org.neociclo.odetteftp.protocol.CommandExchangeBuffer;
import org.neociclo.odetteftp.security.PasswordAuthenticationCallback.AuthenticationResult;
import org.neociclo.odetteftp.support.PasswordAuthenticationHandler;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class UserPropertiesAutheticationHandler extends PasswordAuthenticationHandler {
 
private Properties users;
private boolean useMd5Digest;
 
public UserPropertiesAutheticationHandler(File propertiesFile) {
this(propertiesFile, false);
}
 
public UserPropertiesAutheticationHandler(File propertiesFile, boolean useMd5Digest) {
super();
this.users = loadUsers(propertiesFile);
this.useMd5Digest = useMd5Digest;
}
 
private Properties loadUsers(File file) {
 
if (file == null) {
throw new NullPointerException("file");
}
 
Properties p = new Properties();
 
try {
FileInputStream in;
in = new FileInputStream(file);
p.load(in);
} catch (IOException e) {
throw new IllegalArgumentException("Cannot load the specified users file: " + file, e);
}
 
return p;
}
 
@Override
public AuthenticationResult authenticate(String authenticatingUser, String authenticatingPassword) throws IOException {
 
String oid = authenticatingUser.toUpperCase();
if (!users.containsKey(oid)) {
return UNKNOWN_USER;
}
 
String pwd = users.getProperty(oid);
 
boolean passwordMatch = false;
if (useMd5Digest) {
String passwordHash;
try {
passwordHash = hash(authenticatingPassword);
} catch (NoSuchAlgorithmException e) {
throw new IOException("Failed to generate MD5 digest over the password.", e);
}
passwordMatch = (passwordHash.equals(pwd));
} else {
passwordMatch = (authenticatingPassword.equalsIgnoreCase(pwd));
}
 
return (passwordMatch ? SUCCESS : INVALID_PASSWORD);
}
 
private String hash(String text) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(text.getBytes(CommandExchangeBuffer.DEFAULT_PROTOCOL_CHARSET));
byte[] digest = md.digest();
return toHexString(digest);
}
 
private String toHexString(byte[] digest) {
StringBuffer sb = new StringBuffer();
for (byte d : digest) {
String hex = Integer.toHexString((int) (d & 0xff));
if (hex.length() == 1) {
sb.append('0').append(hex);
} else {
sb.append(hex);
}
}
return sb.toString();
}
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/client/HandlingSendFileEvents.java
New file
0,0 → 1,143
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.client;
 
import static org.neociclo.odetteftp.TransferMode.SENDER_ONLY;
 
import java.io.File;
import java.io.IOException;
import java.util.Queue;
import java.util.Random;
import java.util.concurrent.ConcurrentLinkedQueue;
 
import org.neociclo.odetteftp.examples.MainSupport;
import org.neociclo.odetteftp.oftplet.AnswerReasonInfo;
import org.neociclo.odetteftp.protocol.AnswerReason;
import org.neociclo.odetteftp.protocol.DefaultVirtualFile;
import org.neociclo.odetteftp.protocol.DeliveryNotification;
import org.neociclo.odetteftp.protocol.OdetteFtpObject;
import org.neociclo.odetteftp.protocol.VirtualFile;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.security.PasswordCallback;
import org.neociclo.odetteftp.service.TcpClient;
import org.neociclo.odetteftp.support.InOutSharedQueueOftpletFactory;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
import org.neociclo.odetteftp.support.OftpletEventListenerAdapter;
import org.neociclo.odetteftp.support.PasswordHandler;
import org.neociclo.odetteftp.util.IoUtil;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class HandlingSendFileEvents {
 
public static void main(String[] args) throws Exception {
 
MainSupport ms = new MainSupport(HandlingSendFileEvents.class, args, "server", "port", "odetteid", "password",
"payload");
args = ms.args();
 
String server = args[0];
int port = Integer.parseInt(args[1]);
String userCode = args[2];
String userPassword = args[3];
final File payload = new File(args[4]);
 
OdetteFtpConfiguration conf = new OdetteFtpConfiguration();
conf.setTransferMode(SENDER_ONLY);
 
MappedCallbackHandler securityCallbacks = new MappedCallbackHandler();
securityCallbacks.addHandler(PasswordCallback.class,
new PasswordHandler(userCode, userPassword));
 
final Queue<OdetteFtpObject> filesToSend = new ConcurrentLinkedQueue<OdetteFtpObject>();
 
DefaultVirtualFile vf = new DefaultVirtualFile();
vf.setFile(payload);
 
filesToSend.offer(vf);
 
InOutSharedQueueOftpletFactory factory = new InOutSharedQueueOftpletFactory(
conf, securityCallbacks, filesToSend, null, null);
TcpClient oftp = new TcpClient(server, port, factory);
 
factory.setEventListener(new OftpletEventListenerAdapter() {
 
// handle sent file end-to-end response
@Override
public void onNotificationReceived(DeliveryNotification notif) {
System.out.println("Received EERP: " + notif);
}
 
@Override
public void onSendFileStart(VirtualFile virtualFile,
long answerCount) {
 
File sourceFile = virtualFile.getFile();
File tempFile = null;
 
try {
tempFile = File.createTempFile("oftp-", ".sent");
IoUtil.copy(sourceFile, tempFile);
 
System.out
.println("Copying payload in temporary before sending: "
+ tempFile);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
 
}
 
@Override
public void onSendFileEnd(VirtualFile virtualFile) {
File tempFile = virtualFile.getFile();
IoUtil.delete(tempFile);
System.out.println("Deleting temporary payload file: "
+ tempFile);
}
 
// send file errors
@Override
public void onSendFileError(VirtualFile virtualFile,
AnswerReasonInfo reason, boolean retryLater) {
 
// re-send file with different name
if (reason.getAnswerReason() == AnswerReason.DUPLICATE_FILE) {
DefaultVirtualFile renamedFile = new DefaultVirtualFile();
renamedFile.setFile(payload);
renamedFile.setDatasetName(payload.getName() + "-"
+ (new Random()).nextInt(100));
filesToSend.add(renamedFile);
} else {
System.out.println("Send File Error: " + reason);
}
}
 
});
 
// perform connection and transfer
oftp.connect(true);
 
}
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/client/EstablishSecureConnection.java
New file
0,0 → 1,67
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.client;
 
import java.net.InetSocketAddress;
 
import javax.net.ssl.SSLEngine;
 
import org.neociclo.odetteftp.examples.MainSupport;
import org.neociclo.odetteftp.examples.support.DefaultOftpletFactory;
import org.neociclo.odetteftp.examples.support.SampleOftpSslContextFactory;
import org.neociclo.odetteftp.oftplet.OftpletFactory;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.security.PasswordCallback;
import org.neociclo.odetteftp.service.TcpClient;
import org.neociclo.odetteftp.support.PasswordHandler;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class EstablishSecureConnection {
 
public static void main(String[] args) throws Exception {
 
MainSupport ms = new MainSupport(EstablishSecureConnection.class, args, "server", "port", "oid", "password");
 
String server = ms.get(0);
int port = Integer.parseInt(ms.get(1));
String userCode = ms.get(2);
String userPassword = ms.get(3);
 
MappedCallbackHandler securityCallbacks = new MappedCallbackHandler();
securityCallbacks.addHandler(PasswordCallback.class,
new PasswordHandler(userCode, userPassword));
 
OftpletFactory factory = new DefaultOftpletFactory(securityCallbacks);
 
// create the client mode SSL engine
SSLEngine sslEngine = SampleOftpSslContextFactory.getClientContext().createSSLEngine();
sslEngine.setUseClientMode(true);
sslEngine.setEnableSessionCreation(true);
 
TcpClient oftp = new TcpClient(new InetSocketAddress(server, port), sslEngine, factory);
 
oftp.connect(true);
 
}
 
}
Property changes:
Added: svn:eol-style
+ native
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/client/ConnectAndDisconnect.java
New file
0,0 → 1,56
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.client;
 
import org.neociclo.odetteftp.examples.MainSupport;
import org.neociclo.odetteftp.examples.support.DefaultOftpletFactory;
import org.neociclo.odetteftp.oftplet.OftpletFactory;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.security.PasswordCallback;
import org.neociclo.odetteftp.service.TcpClient;
import org.neociclo.odetteftp.support.PasswordHandler;
 
/**
* @author Rafael Marins
* @version $Rev$
*/
public class ConnectAndDisconnect {
 
public static void main(String[] args) throws Exception {
 
MainSupport ms = new MainSupport(ConnectAndDisconnect.class, args, "server", "port", "odetteid", "password");
 
String server = ms.get(0);
int port = Integer.parseInt(ms.get(1));
String userCode = ms.get(2);
String userPassword = ms.get(3);
 
MappedCallbackHandler securityCallbacks = new MappedCallbackHandler();
securityCallbacks.addHandler(PasswordCallback.class,
new PasswordHandler(userCode, userPassword));
 
OftpletFactory factory = new DefaultOftpletFactory(securityCallbacks);
TcpClient oftp = new TcpClient(server, port, factory);
 
oftp.connect(true);
 
}
 
}
Property changes:
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
Added: svn:mime-type
+ text/plain
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/client/SendFile.java
New file
0,0 → 1,81
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.client;
 
import static org.neociclo.odetteftp.TransferMode.SENDER_ONLY;
 
import java.io.File;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
 
import org.neociclo.odetteftp.examples.MainSupport;
import org.neociclo.odetteftp.oftplet.OftpletFactory;
import org.neociclo.odetteftp.protocol.DefaultVirtualFile;
import org.neociclo.odetteftp.protocol.OdetteFtpObject;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.security.PasswordCallback;
import org.neociclo.odetteftp.service.TcpClient;
import org.neociclo.odetteftp.support.InOutSharedQueueOftpletFactory;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
import org.neociclo.odetteftp.support.PasswordHandler;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class SendFile {
 
public static void main(String[] args) throws Exception {
 
MainSupport ms = new MainSupport(HandlingSendFileEvents.class, args, "server", "port", "odetteid", "password",
"payload", "destination");
args = ms.args();
 
String host = args[0];
int port = Integer.parseInt(args[1]);
String userCode = args[2];
String userPassword = args[3];
File payload = new File(args[4]);
String destination = args[5];
 
OdetteFtpConfiguration conf = new OdetteFtpConfiguration();
conf.setTransferMode(SENDER_ONLY);
 
MappedCallbackHandler securityCallbacks = new MappedCallbackHandler();
securityCallbacks.addHandler(PasswordCallback.class,
new PasswordHandler(userCode, userPassword));
 
Queue<OdetteFtpObject> filesToSend = new ConcurrentLinkedQueue<OdetteFtpObject>();
 
DefaultVirtualFile vf = new DefaultVirtualFile();
vf.setDatasetName(payload.getName());
vf.setDestination(destination);
vf.setFile(payload);
 
filesToSend.offer(vf);
 
OftpletFactory factory = new InOutSharedQueueOftpletFactory(conf, securityCallbacks, filesToSend, null, null);
TcpClient oftp = new TcpClient(host, port, factory);
 
oftp.connect(true);
 
}
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/client/oftp2/PerformSecureAuthentication.java
New file
0,0 → 1,153
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.client.oftp2;
 
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
 
import javax.net.ssl.SSLEngine;
 
import org.neociclo.odetteftp.OdetteFtpVersion;
import org.neociclo.odetteftp.TransferMode;
import org.neociclo.odetteftp.examples.MainSupport;
import org.neociclo.odetteftp.examples.support.DefaultOftpletFactory;
import org.neociclo.odetteftp.examples.support.SampleOftpSslContextFactory;
import org.neociclo.odetteftp.oftplet.OftpletFactory;
import org.neociclo.odetteftp.protocol.v20.CipherSuite;
import org.neociclo.odetteftp.security.AuthenticationChallengeCallback;
import org.neociclo.odetteftp.security.EncryptAuthenticationChallengeCallback;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.security.OneToOneHandler;
import org.neociclo.odetteftp.security.PasswordCallback;
import org.neociclo.odetteftp.service.TcpClient;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
import org.neociclo.odetteftp.support.PasswordHandler;
import org.neociclo.odetteftp.util.EnvelopingUtil;
import org.neociclo.odetteftp.util.SecurityUtil;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class PerformSecureAuthentication {
 
private static final String USER_KEYSTORE_FILE = "src/main/resources/keystores/client-bogus.p12";
private static final String USER_KEYSTORE_PASSWORD = "neociclo";
 
private static final String PARTNER_CERTIFICATE_FILE = "src/main/resources/certificates/o0055partnera-public.cer";
 
public static void main(String[] args) throws Exception {
 
MainSupport ms = new MainSupport(PerformSecureAuthentication.class, args, "server", "port", "oid", "password");
 
String server = ms.get(0);
int port = Integer.parseInt(ms.get(1));
String userCode = ms.get(2);
String userPassword = ms.get(3);
 
OdetteFtpConfiguration conf = new OdetteFtpConfiguration();
conf.setTransferMode(TransferMode.SENDER_ONLY);
conf.setVersion(OdetteFtpVersion.OFTP_V20); // require OFTP2 connection
 
// setup secure authentication options
conf.setUseSecureAuthentication(true);
final KeyStore userKeystore = SecurityUtil.openKeyStore(new File(USER_KEYSTORE_FILE),
USER_KEYSTORE_PASSWORD.toCharArray());
 
MappedCallbackHandler secureAuthenticationHandler = new MappedCallbackHandler();
 
/*
* Add password authentication.
*/
secureAuthenticationHandler.addHandler(PasswordCallback.class,
new PasswordHandler(userCode, userPassword));
 
/*
* The received authentication challenged is encrypted with user's
* associated public certificate and must be decrypted and sent back.
* It's done using the AuthenticatioChallengeCallback.
*
* For more information, see the Secure Authentication protocol sequence
* (section 4.2.4) in the protocol specification RFC5024.
*/
secureAuthenticationHandler.addHandler(AuthenticationChallengeCallback.class,
new OneToOneHandler<AuthenticationChallengeCallback>() {
public void handle(AuthenticationChallengeCallback cb) throws IOException {
 
try {
// load user's certificate and private key
X509Certificate cert = SecurityUtil.getCertificateEntry(userKeystore);
PrivateKey key = SecurityUtil.getPrivateKey(userKeystore,
USER_KEYSTORE_PASSWORD.toCharArray());
 
// decrypt the authentication challenge
byte[] challengeResponse = EnvelopingUtil.parseEnvelopedData(cb.getEncodedChallenge(),
cert, key);
 
// indicate the challenge response via callback
cb.setChallenge(challengeResponse);
 
} catch (Exception e) {
e.printStackTrace();
}
 
}
});
 
/*
* The secure authentication is completed when the Initiator sends an
* challenge encrypted with the remote peer's public certificate.
*
* For more information, see the Secure Authentication protocol sequence
* (section 4.2.4) in the protocol specification RFC5024.
*/
secureAuthenticationHandler.addHandler(EncryptAuthenticationChallengeCallback.class,
new OneToOneHandler<EncryptAuthenticationChallengeCallback>() {
public void handle(EncryptAuthenticationChallengeCallback cb) throws IOException {
 
try {
X509Certificate cert = SecurityUtil.openCertificate(new File(PARTNER_CERTIFICATE_FILE));
CipherSuite cipherSel = cb.getSession().getCipherSuiteSelection();
byte[] encryptedChallenge = EnvelopingUtil.createEnvelopedData(cb.getChallenge(), cipherSel, cert);
cb.setEncodedChallenge(encryptedChallenge);
} catch (Exception e) {
e.printStackTrace();
}
}
});
 
OftpletFactory factory = new DefaultOftpletFactory(conf, secureAuthenticationHandler);
 
// create the client mode SSL engine
SSLEngine sslEngine = SampleOftpSslContextFactory.getClientContext().createSSLEngine();
sslEngine.setUseClientMode(true);
sslEngine.setEnableSessionCreation(true);
 
TcpClient oftp = new TcpClient(new InetSocketAddress(server, port), sslEngine, factory);
 
oftp.connect(true);
 
}
 
}
Property changes:
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
Added: svn:mime-type
+ text/plain
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/client/oftp2/SendFileSigned.java
New file
0,0 → 1,122
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.client.oftp2;
 
import static org.neociclo.odetteftp.TransferMode.SENDER_ONLY;
import static org.neociclo.odetteftp.util.OdetteFtpSupport.createEnvelopedFile;
import static org.neociclo.odetteftp.util.OftpUtil.getFileSize;
 
import java.io.File;
import java.net.InetSocketAddress;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
 
import javax.net.ssl.SSLEngine;
 
import org.neociclo.odetteftp.OdetteFtpVersion;
import org.neociclo.odetteftp.examples.MainSupport;
import org.neociclo.odetteftp.examples.support.SampleOftpSslContextFactory;
import org.neociclo.odetteftp.oftplet.OftpletFactory;
import org.neociclo.odetteftp.protocol.OdetteFtpObject;
import org.neociclo.odetteftp.protocol.v20.CipherSuite;
import org.neociclo.odetteftp.protocol.v20.DefaultEnvelopedVirtualFile;
import org.neociclo.odetteftp.protocol.v20.FileEnveloping;
import org.neociclo.odetteftp.protocol.v20.SecurityLevel;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.security.PasswordCallback;
import org.neociclo.odetteftp.service.TcpClient;
import org.neociclo.odetteftp.support.InOutSharedQueueOftpletFactory;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
import org.neociclo.odetteftp.support.PasswordHandler;
import org.neociclo.odetteftp.util.SecurityUtil;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class SendFileSigned {
 
private static final String USER_KEYSTORE_FILE = "src/main/resources/keystores/client-bogus.p12";
private static final String USER_KEYSTORE_PASSWORD = "neociclo";
 
public static void main(String[] args) throws Exception {
 
MainSupport ms = new MainSupport(SendFileSigned.class, args, "server", "port", "oid", "password",
"payload");
 
String host = ms.get(0);
int port = Integer.parseInt(ms.get(1));
String userCode = ms.get(2);
String userPassword = ms.get(3);
File payloadFile = new File(ms.get(4));
 
File signedFile = File.createTempFile("signed-", "-" + payloadFile.getName(),
payloadFile.getParentFile());
 
OdetteFtpConfiguration conf = new OdetteFtpConfiguration();
conf.setTransferMode(SENDER_ONLY);
conf.setVersion(OdetteFtpVersion.OFTP_V20); // require OFTP2 connection
 
MappedCallbackHandler securityCallbacks = new MappedCallbackHandler();
securityCallbacks.addHandler(PasswordCallback.class,
new PasswordHandler(userCode, userPassword));
 
Queue<OdetteFtpObject> filesToSend = new ConcurrentLinkedQueue<OdetteFtpObject>();
 
// construct enveloped virtual file object
DefaultEnvelopedVirtualFile vf = new DefaultEnvelopedVirtualFile();
vf.setFile(signedFile);
vf.setEnvelopingFormat(FileEnveloping.CMS);
vf.setSecurityLevel(SecurityLevel.SIGNED);
vf.setCipherSuite(CipherSuite.TRIPLEDES_RSA_SHA1);
 
// adding signature - load the private key and certificate used
final KeyStore userKeystore = SecurityUtil.openKeyStore(new File(USER_KEYSTORE_FILE),
USER_KEYSTORE_PASSWORD.toCharArray());
X509Certificate userCert = SecurityUtil.getCertificateEntry(userKeystore);
PrivateKey userPrivateKey = SecurityUtil.getPrivateKey(userKeystore, USER_KEYSTORE_PASSWORD.toCharArray());
 
// create the signed file
createEnvelopedFile(payloadFile, signedFile, vf, userCert, userPrivateKey, null);
 
// set file size after output were properly created
vf.setOriginalFileSize(getFileSize(payloadFile));
vf.setSize(getFileSize(signedFile));
 
filesToSend.offer(vf);
 
OftpletFactory factory = new InOutSharedQueueOftpletFactory(conf, securityCallbacks, filesToSend, null, null);
 
// create the client mode SSL engine
SSLEngine sslEngine = SampleOftpSslContextFactory.getClientContext().createSSLEngine();
sslEngine.setUseClientMode(true);
sslEngine.setEnableSessionCreation(true);
 
TcpClient oftp = new TcpClient(new InetSocketAddress(host, port), sslEngine, factory);
 
oftp.connect(true);
 
signedFile.delete();
}
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/client/oftp2/ReceiveEnvelopedFiles.java
New file
0,0 → 1,262
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.client.oftp2;
 
import static org.neociclo.odetteftp.TransferMode.RECEIVER_ONLY;
import static org.neociclo.odetteftp.protocol.AnswerReason.DUPLICATE_FILE;
import static org.neociclo.odetteftp.protocol.v20.SecurityLevel.ENCRYPTED;
import static org.neociclo.odetteftp.protocol.v20.SecurityLevel.ENCRYPTED_AND_SIGNED;
import static org.neociclo.odetteftp.protocol.v20.SecurityLevel.SIGNED;
import static org.neociclo.odetteftp.util.OdetteFtpSupport.getReplyDeliveryNotification;
import static org.neociclo.odetteftp.util.OdetteFtpSupport.parseEnvelopedFile;
 
import java.io.File;
import java.io.IOException;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
 
import org.neociclo.odetteftp.OdetteFtpVersion;
import org.neociclo.odetteftp.examples.MainSupport;
import org.neociclo.odetteftp.oftplet.EndFileResponse;
import org.neociclo.odetteftp.oftplet.StartFileResponse;
import org.neociclo.odetteftp.protocol.DefaultEndFileResponse;
import org.neociclo.odetteftp.protocol.DefaultStartFileResponse;
import org.neociclo.odetteftp.protocol.OdetteFtpObject;
import org.neociclo.odetteftp.protocol.VirtualFile;
import org.neociclo.odetteftp.protocol.v20.DefaultSignedDeliveryNotification;
import org.neociclo.odetteftp.protocol.v20.EnvelopedVirtualFile;
import org.neociclo.odetteftp.protocol.v20.FileEnveloping;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.security.PasswordCallback;
import org.neociclo.odetteftp.service.TcpClient;
import org.neociclo.odetteftp.support.InOutSharedQueueOftpletFactory;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
import org.neociclo.odetteftp.support.OftpletEventListenerAdapter;
import org.neociclo.odetteftp.support.PasswordHandler;
import org.neociclo.odetteftp.util.EnvelopingException;
import org.neociclo.odetteftp.util.EnvelopingUtil;
import org.neociclo.odetteftp.util.SecurityUtil;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class ReceiveEnvelopedFiles {
 
private static final String USER_KEYSTORE_FILE = "src/main/resources/keystores/client-bogus.p12";
private static final String USER_KEYSTORE_PASSWORD = "neociclo";
 
private static final String PARTNER_CERTIFICATE_FILE = "src/main/resources/certificates/o0055partnera-public.cer";
 
public static void main(String[] args) throws Exception {
 
MainSupport ms = new MainSupport(ReceiveEnvelopedFiles.class, args, "server", "port", "odetteid", "password",
"directory");
args = ms.args();
 
String server = args[0];
int port = Integer.parseInt(args[1]);
String userCode = args[2];
String userPassword = args[3];
final File directory = new File(args[4]);
 
OdetteFtpConfiguration conf = new OdetteFtpConfiguration();
conf.setTransferMode(RECEIVER_ONLY);
conf.setVersion(OdetteFtpVersion.OFTP_V20); // require OFTP2 connection
 
MappedCallbackHandler securityCallbacks = new MappedCallbackHandler();
securityCallbacks.addHandler(PasswordCallback.class,
new PasswordHandler(userCode, userPassword));
 
// add signature: pre-load user's private key and certificate
KeyStore userKs = SecurityUtil.openKeyStore(new File(USER_KEYSTORE_FILE),
USER_KEYSTORE_PASSWORD.toCharArray());
final X509Certificate userCert = SecurityUtil.getCertificateEntry(userKs);
final PrivateKey userPrivateKey = SecurityUtil.getPrivateKey(userKs, USER_KEYSTORE_PASSWORD.toCharArray());
 
final Queue<OdetteFtpObject> outgoingQueue = new ConcurrentLinkedQueue<OdetteFtpObject>();
 
InOutSharedQueueOftpletFactory factory = new InOutSharedQueueOftpletFactory(conf, securityCallbacks,
outgoingQueue, null, null);
TcpClient oftp = new TcpClient(server, port, factory);
 
// prepare the incoming handler
factory.setEventListener(new OftpletEventListenerAdapter() {
@Override
public StartFileResponse acceptStartFile(VirtualFile incomingFile) {
 
File saveToFile = null;
 
saveToFile = new File(directory, incomingFile.getDatasetName());
 
// handle duplicate file
if (saveToFile.exists()) {
DefaultStartFileResponse duplicateFile = DefaultStartFileResponse.negativeStartFileAnswer(DUPLICATE_FILE,
"File already exist in local system.", true);
return duplicateFile;
}
 
DefaultStartFileResponse acceptedFile = DefaultStartFileResponse.positiveStartFileAnswer(saveToFile);
 
return acceptedFile;
}
 
@Override
public void onReceiveFileStart(VirtualFile virtualFile, long answerCount) {
System.out.println("Begin receiving file: " + virtualFile);
}
 
@Override
public EndFileResponse onReceiveFileEnd(VirtualFile argVirtualFile, long recordCount, long unitCount) {
 
System.out.println("Receive file completed: " + argVirtualFile);
 
EnvelopedVirtualFile vf = (EnvelopedVirtualFile) argVirtualFile;
 
/*
* UN-WRAP the original payload from the received file
* (encrypted, signed and/or compressed)
*/
 
if (vf.getEnvelopingFormat() != FileEnveloping.NO_ENVELOPE) {
 
File originalPayload = null;
 
try {
originalPayload = File.createTempFile(vf.getDatasetName() + "-", ".original", directory);
} catch (IOException e) {
 
// XXX you can handle the unwrapping later if matters
 
System.err.println("Cannot create unenveloped temp file in: " + directory);
System.err.println();
e.printStackTrace();
 
return DefaultEndFileResponse.positiveEndFileAnswer();
}
 
X509Certificate userCert = null;
PrivateKey userPrivateKey = null;
X509Certificate partnerCert = null;
 
boolean isSigned = (vf.getSecurityLevel() == SIGNED || vf.getSecurityLevel() == ENCRYPTED_AND_SIGNED);
boolean isEncrypted = (vf.getSecurityLevel() == ENCRYPTED || vf.getSecurityLevel() == ENCRYPTED_AND_SIGNED);
 
if (isSigned) {
// provide the assigned partner's certificate to verify
// the signature in the received file
try {
partnerCert = SecurityUtil.openCertificate(new File(PARTNER_CERTIFICATE_FILE));
} catch (Exception e) {
 
/*
* caught on FileNotFoundException,
* CertificateException or NoSuchProviderException
*/
System.err.println("Cannot parse enveloped file. Error loading partner certificate: "
+ e.getMessage());
System.err.println();
e.printStackTrace();
 
return DefaultEndFileResponse.positiveEndFileAnswer();
}
}
 
if (isEncrypted) {
// provide the user certificate and private key (loaded)
// to decrypt the received file
try {
 
KeyStore userKeystore = SecurityUtil.openKeyStore(new File(USER_KEYSTORE_FILE),
USER_KEYSTORE_PASSWORD.toCharArray());
userCert = SecurityUtil.getCertificateEntry(userKeystore);
userPrivateKey = SecurityUtil.getPrivateKey(userKeystore, USER_KEYSTORE_PASSWORD.toCharArray());
 
} catch (Exception e) {
 
/*
* caught on KeyStoreException, IOException,
* NoSuchProviderException, CertificateException,
* NoSuchAlgorithmException and
* UnrecoverableKeyException
*/
 
System.err.println("Cannot parse enveloped file. Error loading user private key or certificate: "
+ e.getMessage());
System.err.println();
e.printStackTrace();
 
return DefaultEndFileResponse.positiveEndFileAnswer();
}
}
 
try {
 
// decrypt, decompress and/or check-remove signature to
// the output file (originalPayload)
 
parseEnvelopedFile(vf.getFile(), originalPayload, vf, userCert, userPrivateKey, partnerCert);
 
} catch (EnvelopingException e) {
 
// XXX good place to reply with a Negative End Response (NERP)
 
System.err.println("Cannot parse enveloped file. Enveloping error: " + e.getMessage());
System.err.println();
e.printStackTrace();
 
return DefaultEndFileResponse.positiveEndFileAnswer();
}
}
 
// reply with a successful End-to-End Response (EERP)
DefaultSignedDeliveryNotification notif = (DefaultSignedDeliveryNotification) getReplyDeliveryNotification(vf);
 
// ADD SIGNATURE to the EERP when required
if (vf.isSignedNotificationRequest()) {
try {
EnvelopingUtil.addNotifSignature(notif, vf.getCipherSuite(), userCert, userPrivateKey);
} catch (Exception e) {
System.err.println("Cannot reply with a Signed EERP. Add signature failed: " + vf);
System.err.println();
e.printStackTrace();
}
}
 
outgoingQueue.offer(notif);
 
// to send the EERP back, request change direction (true)
return DefaultEndFileResponse.positiveEndFileAnswer();
}
 
});
 
// instant the connection is performed and then executed all steps above
oftp.connect(true);
 
}
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/client/oftp2/SendFileEncrypted.java
New file
0,0 → 1,118
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.client.oftp2;
 
import static org.neociclo.odetteftp.TransferMode.SENDER_ONLY;
import static org.neociclo.odetteftp.util.OdetteFtpSupport.createEnvelopedFile;
import static org.neociclo.odetteftp.util.OftpUtil.getFileSize;
 
import java.io.File;
import java.net.InetSocketAddress;
import java.security.cert.X509Certificate;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
 
import javax.net.ssl.SSLEngine;
 
import org.neociclo.odetteftp.OdetteFtpVersion;
import org.neociclo.odetteftp.examples.MainSupport;
import org.neociclo.odetteftp.examples.support.SampleOftpSslContextFactory;
import org.neociclo.odetteftp.oftplet.OftpletFactory;
import org.neociclo.odetteftp.protocol.OdetteFtpObject;
import org.neociclo.odetteftp.protocol.v20.CipherSuite;
import org.neociclo.odetteftp.protocol.v20.DefaultEnvelopedVirtualFile;
import org.neociclo.odetteftp.protocol.v20.FileEnveloping;
import org.neociclo.odetteftp.protocol.v20.SecurityLevel;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.security.PasswordCallback;
import org.neociclo.odetteftp.service.TcpClient;
import org.neociclo.odetteftp.support.InOutSharedQueueOftpletFactory;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
import org.neociclo.odetteftp.support.PasswordHandler;
import org.neociclo.odetteftp.util.SecurityUtil;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class SendFileEncrypted {
 
private static final String PARTNER_CERTIFICATE_FILE = "src/main/resources/certificates/o0055partnera-public.cer";
 
public static void main(String[] args) throws Exception {
 
MainSupport ms = new MainSupport(SendFileEncrypted.class, args, "server", "port", "oid", "password",
"payload");
 
String host = ms.get(0);
int port = Integer.parseInt(ms.get(1));
String userCode = ms.get(2);
String userPassword = ms.get(3);
File payloadFile = new File(ms.get(4));
 
File encryptedFile = File.createTempFile("encrypted-", "-" + payloadFile.getName(),
payloadFile.getParentFile());
 
OdetteFtpConfiguration conf = new OdetteFtpConfiguration();
conf.setTransferMode(SENDER_ONLY);
conf.setVersion(OdetteFtpVersion.OFTP_V20); // require OFTP2 connection
 
MappedCallbackHandler securityCallbacks = new MappedCallbackHandler();
securityCallbacks.addHandler(PasswordCallback.class,
new PasswordHandler(userCode, userPassword));
 
Queue<OdetteFtpObject> filesToSend = new ConcurrentLinkedQueue<OdetteFtpObject>();
 
// construct enveloped virtual file object
DefaultEnvelopedVirtualFile vf = new DefaultEnvelopedVirtualFile();
vf.setFile(encryptedFile);
 
// encrypting ONLY virtual file options
vf.setEnvelopingFormat(FileEnveloping.CMS);
vf.setSecurityLevel(SecurityLevel.ENCRYPTED);
vf.setCipherSuite(CipherSuite.TRIPLEDES_RSA_SHA1);
 
// load the partner's certificate used to encrypt the payload
X509Certificate partnerCert = SecurityUtil.openCertificate(new File(PARTNER_CERTIFICATE_FILE));
 
// create the compressed file
createEnvelopedFile(payloadFile, encryptedFile, vf, null, null, partnerCert);
 
// set file size after compression
vf.setOriginalFileSize(getFileSize(payloadFile));
vf.setSize(getFileSize(encryptedFile));
 
filesToSend.offer(vf);
 
OftpletFactory factory = new InOutSharedQueueOftpletFactory(conf, securityCallbacks, filesToSend, null, null);
 
// create the client mode SSL engine
SSLEngine sslEngine = SampleOftpSslContextFactory.getClientContext().createSSLEngine();
sslEngine.setUseClientMode(true);
sslEngine.setEnableSessionCreation(true);
 
TcpClient oftp = new TcpClient(new InetSocketAddress(host, port), sslEngine, factory);
 
oftp.connect(true);
 
encryptedFile.delete();
}
 
}
Property changes:
Added: svn:eol-style
+ native
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/client/oftp2/SendFileCompressed.java
New file
0,0 → 1,107
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.client.oftp2;
 
import static org.neociclo.odetteftp.TransferMode.SENDER_ONLY;
import static org.neociclo.odetteftp.util.OdetteFtpSupport.createEnvelopedFile;
import static org.neociclo.odetteftp.util.OftpUtil.getFileSize;
 
import java.io.File;
import java.net.InetSocketAddress;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
 
import javax.net.ssl.SSLEngine;
 
import org.neociclo.odetteftp.OdetteFtpVersion;
import org.neociclo.odetteftp.examples.MainSupport;
import org.neociclo.odetteftp.examples.support.SampleOftpSslContextFactory;
import org.neociclo.odetteftp.oftplet.OftpletFactory;
import org.neociclo.odetteftp.protocol.OdetteFtpObject;
import org.neociclo.odetteftp.protocol.v20.DefaultEnvelopedVirtualFile;
import org.neociclo.odetteftp.protocol.v20.FileCompression;
import org.neociclo.odetteftp.protocol.v20.FileEnveloping;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.security.PasswordCallback;
import org.neociclo.odetteftp.service.TcpClient;
import org.neociclo.odetteftp.support.InOutSharedQueueOftpletFactory;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
import org.neociclo.odetteftp.support.PasswordHandler;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class SendFileCompressed {
 
public static void main(String[] args) throws Exception {
 
MainSupport ms = new MainSupport(SendFileCompressed.class, args, "server", "port", "oid", "password",
"payload");
 
String host = ms.get(0);
int port = Integer.parseInt(ms.get(1));
String userCode = ms.get(2);
String userPassword = ms.get(3);
File payloadFile = new File(ms.get(4));
 
File compressedFile = File.createTempFile("compressed-", "-" + payloadFile.getName(),
payloadFile.getParentFile());
 
OdetteFtpConfiguration conf = new OdetteFtpConfiguration();
conf.setTransferMode(SENDER_ONLY);
conf.setVersion(OdetteFtpVersion.OFTP_V20); // require OFTP2 connection
 
MappedCallbackHandler securityCallbacks = new MappedCallbackHandler();
securityCallbacks.addHandler(PasswordCallback.class,
new PasswordHandler(userCode, userPassword));
 
Queue<OdetteFtpObject> filesToSend = new ConcurrentLinkedQueue<OdetteFtpObject>();
 
// construct enveloped virtual file object
DefaultEnvelopedVirtualFile vf = new DefaultEnvelopedVirtualFile();
vf.setFile(compressedFile);
vf.setEnvelopingFormat(FileEnveloping.CMS);
vf.setCompressionAlgorithm(FileCompression.ZLIB);
 
// create the compressed file
createEnvelopedFile(payloadFile, compressedFile, vf);
 
// set file size after compression
vf.setOriginalFileSize(getFileSize(payloadFile));
vf.setSize(getFileSize(compressedFile));
 
filesToSend.offer(vf);
 
OftpletFactory factory = new InOutSharedQueueOftpletFactory(conf, securityCallbacks, filesToSend, null, null);
 
// create the client mode SSL engine
SSLEngine sslEngine = SampleOftpSslContextFactory.getClientContext().createSSLEngine();
sslEngine.setUseClientMode(true);
sslEngine.setEnableSessionCreation(true);
 
TcpClient oftp = new TcpClient(new InetSocketAddress(host, port), sslEngine, factory);
 
oftp.connect(true);
 
compressedFile.delete();
}
 
}
Property changes:
Added: svn:eol-style
+ native
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/client/ReceiveAllFiles.java
New file
0,0 → 1,122
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples.client;
 
import static org.neociclo.odetteftp.TransferMode.RECEIVER_ONLY;
import static org.neociclo.odetteftp.protocol.AnswerReason.DUPLICATE_FILE;
import static org.neociclo.odetteftp.util.OdetteFtpSupport.getReplyDeliveryNotification;
 
import java.io.File;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
 
import org.neociclo.odetteftp.examples.MainSupport;
import org.neociclo.odetteftp.oftplet.EndFileResponse;
import org.neociclo.odetteftp.oftplet.StartFileResponse;
import org.neociclo.odetteftp.protocol.DefaultEndFileResponse;
import org.neociclo.odetteftp.protocol.DefaultStartFileResponse;
import org.neociclo.odetteftp.protocol.DeliveryNotification;
import org.neociclo.odetteftp.protocol.OdetteFtpObject;
import org.neociclo.odetteftp.protocol.VirtualFile;
import org.neociclo.odetteftp.security.MappedCallbackHandler;
import org.neociclo.odetteftp.security.PasswordCallback;
import org.neociclo.odetteftp.service.TcpClient;
import org.neociclo.odetteftp.support.InOutSharedQueueOftpletFactory;
import org.neociclo.odetteftp.support.OdetteFtpConfiguration;
import org.neociclo.odetteftp.support.OftpletEventListenerAdapter;
import org.neociclo.odetteftp.support.PasswordHandler;
 
/**
* @author Rafael Marins
* @version $Rev$ $Date$
*/
public class ReceiveAllFiles {
 
public static void main(String[] args) throws Exception {
 
MainSupport ms = new MainSupport(ReceiveAllFiles.class, args, "server", "port", "odetteid", "password",
"directory");
args = ms.args();
 
String server = args[0];
int port = Integer.parseInt(args[1]);
String userCode = args[2];
String userPassword = args[3];
final File directory = new File(args[4]);
 
OdetteFtpConfiguration conf = new OdetteFtpConfiguration();
conf.setTransferMode(RECEIVER_ONLY);
 
MappedCallbackHandler securityCallbacks = new MappedCallbackHandler();
securityCallbacks.addHandler(PasswordCallback.class,
new PasswordHandler(userCode, userPassword));
 
final Queue<OdetteFtpObject> outgoingQueue = new ConcurrentLinkedQueue<OdetteFtpObject>();
 
InOutSharedQueueOftpletFactory factory = new InOutSharedQueueOftpletFactory(conf, securityCallbacks,
outgoingQueue, null, null);
TcpClient oftp = new TcpClient(server, port, factory);
 
// prepare the incoming handler
factory.setEventListener(new OftpletEventListenerAdapter() {
@Override
public StartFileResponse acceptStartFile(VirtualFile incomingFile) {
 
File saveToFile = null;
 
saveToFile = new File(directory, incomingFile.getDatasetName());
 
// handle duplicate file
if (saveToFile.exists()) {
DefaultStartFileResponse duplicateFile = DefaultStartFileResponse.negativeStartFileAnswer(DUPLICATE_FILE,
"File already exist in local system.", true);
return duplicateFile;
}
 
DefaultStartFileResponse acceptedFile = DefaultStartFileResponse.positiveStartFileAnswer(saveToFile);
 
return acceptedFile;
}
 
@Override
public void onReceiveFileStart(VirtualFile virtualFile, long answerCount) {
System.out.println("Begin receiving file: " + virtualFile);
}
 
@Override
public EndFileResponse onReceiveFileEnd(VirtualFile virtualFile, long recordCount, long unitCount) {
 
// reply with EERP (positive delivery notification)
DeliveryNotification notif = getReplyDeliveryNotification(virtualFile);
outgoingQueue.offer(notif);
 
System.out.println("Receive file completed: " + virtualFile);
 
// send the EERP back - request change direction (true)
return DefaultEndFileResponse.positiveEndFileAnswer();
}
 
});
 
oftp.connect(true);
 
}
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/src/main/java/org/neociclo/odetteftp/examples/MainSupport.java
New file
0,0 → 1,127
/**
* Neociclo Accord, Open Source B2B Integration Suite
* Copyright (C) 2005-2010 Neociclo, http://www.neociclo.com
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
package org.neociclo.odetteftp.examples;
 
import static java.lang.System.out;
import static java.lang.System.err;
 
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
 
public class MainSupport {
 
private String[] parameters;
private Map<String, String> mapParameters;
private Properties fileProperties;
private String exampleName;
private String[] indexedArgs;
 
public MainSupport(Class<?> example, String[] args, String... parameters) {
this.parameters = parameters;
this.mapParameters = new HashMap<String, String>();
this.exampleName = example.getSimpleName();
this.indexedArgs = new String[parameters.length];
 
int index = 0;
for (String p : parameters) {
String property = System.getProperty(p, getFileProperty(p));
if (args.length > index && (property == null || property.trim().length() == 0)) {
property = args[index];
}
 
if (property == null) {
break;
}
 
mapParameters.put(p, property);
indexedArgs[index++] = property;
}
 
if (parameters.length != mapParameters.keySet().size()) {
err.println("Incorrect number of arguments.");
printUsage();
System.exit(1);
}
}
 
private String getFileProperty(String p) {
loadFileProperties();
 
return fileProperties.getProperty(p);
}
 
private void loadFileProperties() {
if (fileProperties != null) {
return;
}
 
fileProperties = new Properties();
try {
URL res = MainSupport.class.getResource("/odette.properties");
if (res != null) {
File file = new File(res.toURI());
if (file.exists()) {
fileProperties.load(new FileInputStream(file));
}
}
} catch (IOException e) {
e.printStackTrace();
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
 
public String get(String property) {
return mapParameters.get(property);
}
 
public String get(int index) {
String p = parameters[index];
return get(p);
}
 
private void printUsage() {
out.println();
out.println("Example: " + exampleName);
StringBuilder sb = new StringBuilder();
sb.append("This example must be run with the following properties: \n");
for (String p : parameters) {
sb.append(" - ").append(p).append('\n');
}
 
out.println(sb);
out.print("Make sure these properties exist either by setting on ");
out.println("odette.properties or with -Dparameter=value arguments");
out.println();
out.println("You can also specify ALL parameters as plain arguments.");
System.out.println();
}
 
public String[] args() {
return indexedArgs;
}
 
}
Property changes:
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/pom.xml
New file
0,0 → 1,49
<?xml version="1.0" encoding="UTF-8"?>
<!--
Neociclo Accord, Open Source Managed File Transfer
Copyright (c) 2005-2010 Neociclo, http://www.neociclo.com
This program 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.
 
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 Affero General Public License for more details.
 
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses />.
 
$Id$
 
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
<parent>
<groupId>org.neociclo.accord.odetteftp</groupId>
<artifactId>odetteftp-parent</artifactId>
<version>1.2.0.RC1</version>
</parent>
 
<modelVersion>4.0.0</modelVersion>
<artifactId>oftp-examples</artifactId>
<packaging>jar</packaging>
<name>Accord Odette FTP :: Examples</name>
<description>Code showcase on using the Accord Odette FTP Library.</description>
 
<properties>
<!-- DON'T deploy oftp-examples artifacts. -->
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
 
<dependencies>
<dependency>
<groupId>org.neociclo.accord.odetteftp</groupId>
<artifactId>oftp-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
 
</project>
Property changes:
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Revision Date Author Id
Added: svn:eol-style
+ native
/tags/odetteftp-1.2.0.RC1/examples/LICENSE.txt
New file
0,0 → 1,661
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
 
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
 
Preamble
 
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
 
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
 
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
 
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
 
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
 
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
 
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
 
The precise terms and conditions for copying, distribution and
modification follow.
 
TERMS AND CONDITIONS
 
0. Definitions.
 
"This License" refers to version 3 of the GNU Affero General Public License.
 
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
 
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
 
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
 
A "covered work" means either the unmodified Program or a work based
on the Program.
 
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
 
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
 
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
 
1. Source Code.
 
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
 
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
 
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
 
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
 
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
 
The Corresponding Source for a work in source code form is that
same work.
 
2. Basic Permissions.
 
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
 
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
 
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
 
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
 
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
 
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
 
4. Conveying Verbatim Copies.
 
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
 
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
 
5. Conveying Modified Source Versions.
 
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
 
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
 
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
 
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
 
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
 
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
 
6. Conveying Non-Source Forms.
 
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
 
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
 
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
 
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
 
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
 
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
 
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
 
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
 
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
 
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
 
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
 
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
 
7. Additional Terms.
 
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
 
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
 
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
 
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
 
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
 
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
 
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
 
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
 
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
 
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
 
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
 
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
 
8. Termination.
 
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
 
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
 
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
 
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
 
9. Acceptance Not Required for Having Copies.
 
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
 
10. Automatic Licensing of Downstream Recipients.
 
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
 
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
 
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
 
11. Patents.
 
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
 
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
 
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
 
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
 
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
 
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
 
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
 
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
 
12. No Surrender of Others' Freedom.
 
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
 
13. Remote Network Interaction; Use with the GNU General Public License.
 
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
 
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
 
14. Revised Versions of this License.
 
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
 
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
 
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
 
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
 
15. Disclaimer of Warranty.
 
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
 
16. Limitation of Liability.
 
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
 
17. Interpretation of Sections 15 and 16.
 
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
 
END OF TERMS AND CONDITIONS
 
How to Apply These Terms to Your New Programs
 
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
 
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
 
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
 
This program 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.
 
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 Affero General Public License for more details.
 
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
Also add information on how to contact you by electronic and paper mail.
 
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
 
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.
Property changes:
Added: svn:eol-style
+ native
Added: svn:mime-type
+ text/plain
/tags/odetteftp-1.2.0.RC1/examples
Property changes:
Added: svn:ignore
+ bin
/tags/odetteftp-1.2.0.RC1/site/apt/camel.apt
New file
0,0 → 1,105
------
Overview
------
Bruno Borges
------
2010-09-27
 
Accord Odette FTP Camel Component
 
The Camel OFTP Component is an adaptor for the {{{http://camel.apache.org}Apache Camel}} framework that enables developers to leverage Odette FTP support on scenarios of file transfer between B2B applications. It is well suited for projects that need to have support for OFTP 1.3, 1.4 and OFTP2 on ESBs (Enterprise Service Bus) like {{{http://servicemix.apache.org}Apache ServiceMix}}., JEE-based applications and any route-enabled architectures.
 
Quick Start
 
To enable OFTP2 support on a Camel project, it is required to add a Maven dependency for the Accord Camel OFTP component:
 
+-------------------------------+
<dependency>
<groupId>org.neociclo.accord.odetteftp</groupId>
<artifactId>camel-oftp</artifactId>
<version>1.2-SNAPSHOT</version>
</dependency>
+-------------------------------+
 
We hardly recommend to use {{{http://maven.apache.org}Apache Maven}} to integrate this component within your application. If you are not using Maven, you can download Apache Camel's distribution and then download Accord Odette Camel from Maven repository. We are not planing on releasing
 
Example
 
+-------------------------------+
from("oftp://odetteid:password@10.10.1.1?workpath=odette/work")
.to("file:odette/inbox");
+-------------------------------+
 
You can check more examples on project's unit tests.
 
How it works
 
Each endpoint connects to a remote OFTP server. It is possible to send and receive files, as well delivery notifications (EERPs). To receive anything, one must configure the endpoint as consumer, like in the example above.
 
To send files or Delivery Notifications, the endpoint must be configured as producer. If you want to send and receive files, two routes are needed.
 
The component will use the same OFTP session to both send and receive data if applicable. This means outgoing data sent to an OFTP endpoint will be actually delivered when a connection is estabilished, saving resources. An internal queue is used to store this outgoing data. In the mean time, incoming data will be sent to endpoint's consumer.
 
It is, however, possible to have an endpoint with both consumer and producer, but on specific OFTP transfer modes. This is necessary to be able to send Delivery Notifications on different sessions. For instance, when a file arrives but no EERP is sent back automatically.
 
Reference
 
The Camel OFTP component's URI follows the pattern below:
 
+-------------------------------+
oftp[s]://[oid[:pass]@]hostname[:port]?param=value
+-------------------------------+
 
<<Observation:>>
 
<<<If URI is preffixed with 'oftps' scheme, then SSL will be enabled>>>
 
Following the parameter reference table for Camel OFTP's URI:
 
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<Parameter>> | <<Required>> | <<Default>> | <<Description>> |
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<workpath>> | false | java.io.tmpdir | Indicates where temporary files will be written |
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<bufferSize>> | false | 4096 | The buffer size for this endpoint's OFTP connection OFTP |
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<windowSize>> | false | 64 | The length of each packet window set for this endpoint's OFTP connection |
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<waitForEERP>> | false | false | Must the component lock exchange until EERP is received from remote server after uploading a file |
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<transferMode>> | false | * automatic | This endpoint's transfermode. Look enum values of org.neociclo.odetteftp.TransferMode. If not present, transfer mode will be set automatically based on route definition. For example, if it is consumer-only, will be set to RECEIVE_ONLY. |
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<autoReplyDelivery>> | false | true | Will this endpoint automatically send an EERP after a file is received - before consumed by Camel route. |
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<routeFileRequest>> | false | false | Will this endpoint route an exchange to warn of incoming file and ask for acceptance and File storage location. |
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<autoResume>> | false | true | Will this endpoint automatically resume file transfers if temporary file is found. |
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<copyBeforeSend>> | false | true | Will this endpoint copy an outgoing file to the workpath before sending it to the remote server |
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<queueOfferDelay>>| false | 300 ms | How long (in ms) will this endpoint wait for exchanges before actually connecting to remote server and offer data (send file / EERP) |
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<maxFileSize>> | false | 0 | Maximum file size for transfered files within this endpoint. Zero for no check |
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<override>> | false | true | Will this endpoint override any existing file |
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<delete>> | false | true | Will this endpoint delete any temporary file after exchange is processed |
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<fileRenameBean>> | false | default implementation | How files should be named on disk on arrival. Defaults to HEXDATETIME_ORIGINATOR_DATASETNAME. See org.neociclo.accord.odetteftp.camel.FileRenameBean |
*----------------*--------------*--------------------*-----------------------------------------------------+
 
These parameters are related to <<SSL-enabled>> endpoints (<<oftps://>>)
 
*----------------*--------------*--------------------*-----------------------------------------------------+
| <<Parameter>> | <<Required>> | <<Default>> | <<Description>> |
*----------------*--------------*--------------------*-----------------------------------------------------+
|sslEngineFactory | | DefaultSSLEngineFactory | Bean implementing org.neociclo.accord.odetteftp.camel.SSLEngineFactory |
*----------------*--------------*--------------------*-----------------------------------------------------+
|trustStoreFile | | | File storing trusted keys |
*----------------*--------------*--------------------*-----------------------------------------------------+
|keyStoreFile | | | File storing keys |
*----------------*--------------*--------------------*-----------------------------------------------------+
|securityProvider | | | SSL Security provider |
*----------------*--------------*--------------------*-----------------------------------------------------+
|keyStoreFormat | | | File format for storing keys|
*----------------*--------------*--------------------*-----------------------------------------------------+
/tags/odetteftp-1.2.0.RC1/site/apt/protocol.apt
New file
0,0 → 1,52
-----
Protocol Overview
-----
Bruno Borges
-----
2010-08-18
-----
 
OFTP2 Protocol Overview
 
The Odette File Transfer Protocol was originally designed by the Odette International organization, formed by the automotive industry, aimed to set a standard on EDI exchange between business partners. The first version was specified to support file transfer over X.25 networks and later over ISDN. Now the OFTP2 specification adds, among other features, support for transport over TCP/IP, TLS for session encryption, file encryption and authentication based on digital signature.
 
One might put OFTP side-by-side with FTP or SFTP, but these are pure file transfers, without any business model applied on the file transfer process. What developers accomplish by writting many scripts to achieve file receipt, OFTP has this in its core.
 
The main difference between OFTP and S/FTP is that OFTP leverages the B2B scenario over file transfers. Also, from the OFTP user's perspective, there's no client/server nor folders to access, files to list. A partner basically connects to another and notifies it of a file delivery request or is notified about an incoming file request. The protocol does not specify where files should be put or where they should come from to be sent. The application implementing the protocol is responsible for that.
 
A key benefit of the protocol is that it has file delivery receipt. This is important, again, on the B2B scenario. Today system admins and developers have to define on both sides of a B2B integrated solution a way to inform that transfered files were correctly processed. This is defined as <End to End Response> and is described on {{{./rfc5024.html#section-3.3.5}section 3.3.5}} of the {{{./rfc5024.html}RFC 5024}}.
 
Below you will find diagrams and better explanations that might help you to understand how OFTP works.
 
* The first big picture
 
[oftp-file-transfer-scheme.png] First big picture
 
Here, two partners have estabilished a 2-way connection (explained later), to both receive and send files. Usually, applications implementing OFTP offer a way to specify inbox and outbox folders. These are represented here. The protocol does not access these folders. It is applications' responsibility to pull the outbox folder to send files, and to write incoming data to a file in the inbox. The sender has no control on how or where its sent files will be placed.
 
One important thing: before any transfer, both partners must agree with it. Before a file transfer beggins, one might check the file name and if it is invalid, sends to the other partner a command rejecting the file transfer. This works on both sides, when the partner is receiving a file.
 
* Virtual File
 
[oftp-virtual-file.png] Virtual File Diagram
 
As OFTP does not specify a file system to navigate through remote files, these have to be mapped to <<Virtual Files>>. There's no virtual folder too. On the Core API of the Odette FTP Library, you will find a class with that name to map between <<java.io.File>> and a <<VirtualFile>> object.
The reason OFTP specifies a virtual file is to make it possible to have a different file name. It also has a list of options to set, for example, the partner who will receive that file. This works this way because sometimes the remote partner is not the one who must process it, but he will only forward the file to the destination.
 
* Peer-to-peer Transfers
 
[oftp-peer-to-peer.png] Peer-to-peer
 
The first and obvious scenario is a peer-to-peer, or in better words, partner-to-partner. For any file sent from partner A to partner B, the second must send an {{{./rfc5024.html#section-3.3.5}End-to-End Response}}. If something goes wrong, it will send a {{{./rfc5024.html#section-3.3.6}Nevagite End Response}}. This feature is one of the most important of the Odette FTP. If partner A gets a NERP, it might schedule the file to be send again in a later time.
 
Partner B has the control of which files will accept coming from Partner A. The application must acknowledge incoming files before they are transfered by replying an {{{./rfc5024.html#section-5.3.3}SFID}}.
 
* The Huge Picture
 
[oftp-huge-picture.png] The Huge Picture
 
Now this is the <<huge>> picture. The {{{http://en.wikipedia.org/wiki/Value-added_network}Value-added Network (VAN)}} in the middle is what's more important to note here. In the same session between partner A and the VAN, two or more files can be sent to different partners. This is where the <<Virtual File>> is so important. In it, partner A can set for file Ba that the destination is partner B and do the same thing for Ca. The VAN will look at that information and forward those files correctly to their end destinations. Also, the VAN will forward back to partner A an EERP only when partner B/C send their receipts.
 
* Looking for more?
 
If you have any doubts on the Odette File Transfer Protocol, please contact the Accord project's {{{./mail-lists.html}mailing list}}. Also, feel free to contribute to this webpage.
/tags/odetteftp-1.2.0.RC1/site/apt/index.apt
New file
0,0 → 1,90
------
Overview
------
Bruno Borges
------
2010-08-18
 
Accord Odette FTP
 
The Accord Odette FTP is an open sourced - AGPL - Java library API that implements both {{{./rfc5024.html}RFC 5024}} and {{{http://ietfdocs.potaroo.net/idref/rfc2204}RFC 2204}} giving users and developers support for exchanging files with partners either running with OFTP server version 1.3, 1.4 or the new 2.0 version. This and many other features can be only found in Accord Odette FTP library. It is implemented under Java 5 and based on JBoss Netty.
 
 
[accord-oftp-1.png] Accord Architecture
 
 
* Key Benefits
 
* Support for OFTP 1.3, 1.4 and 2.0
 
* Auto backward compatibility
 
* Support for unique version mode
 
* Support for SSL client authentication
 
* File compression
 
* File restart
 
* Push and pull operations
 
* Support for sending End-to-End response (EERP) also know as file delivery receipt
 
* Digital signatures
 
* Certificates
 
* Support for TCP/IP transport
 
* Support for X.25 transport
 
* Secure transport over SSL
 
* Asynchronized and event-based architecture
 
* Open Sourced through the Affero GPL 3.0
 
* Java Integration
 
Because it is a Java library, it can be easily embedded within any Java software. This gives customers freedom and flexibility on how to build their own B2B solutions.
 
* Java 5
 
* Generified API
 
* Deployed on {{{http://oss.sonatype.org}Sonatype}}'s {{{http://maven.apache.org}Apache Maven}} repository
 
* Designed for developers and software architects
 
* Based on {{{http://www.jboss.org/netty}JBoss Netty}}
 
* Encryption and signatures
 
The Accord Odette FTP library supports the following encryption/hash algorithms, required by the Odette International organization:
 
* AES-256
 
* 3DES
 
* SHA-1
 
Other algorithms might be supported as well, through the {{{http://www.oracle.com/technetwork/java/javase/tech/index-jsp-136007.html}Java Cryptography Extension (JCE) layer}}.
 
* Apache Camel integration
 
If you are already using or considering to use {{{http://camel.apache.org}Apache Camel}} on your project, you can take advantage of the {{{camel.html}Camel OFTP}} component.
 
* Comparison to
 
The {{{http://oftp2.mendelson-e-c.com/}mendelson project}} only offers a Java client with support for OFTP 2.0. Because of that, it cannot be easily embedded to third-party software. Also it does not support older versions of the Odette FTP specification (1.3 and 1.4).
 
* Graphical User Interface for Accord Odette FTP
 
If you are looking for an end-user GUI for your desktop to connect to your b2B partners, go to the {{{../wire/index.html}Accord Wire}} project.
 
* Commercial Support
 
{{{http://www.neociclo.com}Neociclo}} is the company behind the Accord MFT Suite, also developing other projects designed to leverage and simplify the task of managing file transfers.
 
 
/tags/odetteftp-1.2.0.RC1/site/apt/quickstart.apt
New file
0,0 → 1,93
Quick Start
 
Reading the Javadocs won't get you started exchanging files through the OFTP protocol. So follow these instructions on how to start developing your own OFTP-enabled Java program. This is a library that implements the OFTP protocol so from here, you have to develop your own GUI interface, either console or desktop.
 
[[2]] Check-out the Odette FTP library
 
+------------------------------------------+
$ svn co svn checkout svn://svn.forge.objectweb.org/svnroot/accord/odetteftp/trunk odetteftp
+------------------------------------------+
 
[[3]] Build and install the Core API on your local repository
 
+------------------------------------------+
$ cd odetteftp/core
$ mvn install
+------------------------------------------+
 
[[4]] Create a Maven quickstart project
 
+------------------------------------------+
$ cd ~/
$ mvn archetype:generate -B -DarchetypeGroupId=org.apache.maven.archetypes
\ -DarchetypeArtifactId=maven-archetype-quickstart
\ -DgroupId=com.mycompany -DartifactId=myproject
+------------------------------------------+
 
[[5]] Edit the file <<myproject/pom.xml>> and add the following dependency:
 
+------------------------------------------+
<dependency>
<groupId>org.neociclo.accord.odetteftp</groupId>
<artifactId>core-oftp</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
+------------------------------------------+
 
[[6]] Configure the project for your IDE
 
[[a]] Eclipse:
 
+------------------------------------------+
$ cd myproject
$ mvn eclipse:eclipse
+------------------------------------------+
 
[[7]] Import the project to your IDE's workspace
 
[[8]] Edit <<src/main/java/com/mycompany/App.java>> and start coding!
 
Examples
 
These are snippets of examples found on the {{{./examples-oftp/index.html}examples}} module. You may look the source code for more details. Although the Accord OFTP has server feature, these examples were coded to validate the library by sending commands to a remote server running (probably) some other implementation. You must know one OFTP server up and running to run these tests.
 
* Connect and Disconnect
 
This gives you a "Hello Odette!" snippet that connects and then disconnects from the remote OFTP server.
 
+------------------------------------------+
String server = "10.0.0.1";
int port = 33005;
String odetteid = "MYODETTEID";
String password = "MYODETTEPWS";
 
SessionConfig conf = new SessionConfig();
conf.setUserCode(odetteid);
conf.setUserPassword(password);
 
OftpletFactory factory = new DefaultOftpletFactory(conf);
TcpClient oftp = new TcpClient(server, port, factory);
 
oftp.connect(true);
+------------------------------------------+
 
* Sending File
 
Sending a file is the most important task the API must accomplish, right? See how it goes:
 
+------------------------------------------+
conf.setTransferMode(SENDER_ONLY);
 
File payload = new File(args[4]);
DefaultVirtualFile vf = new DefaultVirtualFile();
vf.setFile(payload);
 
Queue<OdetteFtpObject> filesToSend = new ConcurrentLinkedQueue<OdetteFtpObject>();
filesToSend.offer(vf);
 
OftpletFactory factory = new InOutSharedQueueOftpletFactory(conf, filesToSend, null, null);
TcpClient oftp = new TcpClient(host, port, factory);
 
oftp.connect(true);
+------------------------------------------+
 
/tags/odetteftp-1.2.0.RC1/site/resources/accord-oftp-1.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Added: svn:mime-type
+ image/png
/tags/odetteftp-1.2.0.RC1/site/resources/oftp-huge-picture.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Added: svn:mime-type
+ image/png
/tags/odetteftp-1.2.0.RC1/site/resources/oftp-file-transfer-scheme.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Added: svn:mime-type
+ image/png
/tags/odetteftp-1.2.0.RC1/site/resources/oftp-virtual-file.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Added: svn:mime-type
+ image/png
/tags/odetteftp-1.2.0.RC1/site/resources/pdf.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Added: svn:mime-type
+ image/png
/tags/odetteftp-1.2.0.RC1/site/resources/oftp-peer-to-peer.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Added: svn:mime-type
+ image/png
/tags/odetteftp-1.2.0.RC1/site/xhtml/rfc5024.xhtml
New file
0,0 → 1,7585
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="icon" href="http://ietfdocs.potaroo.net/idref/rfc5024/rfc.png" type="image/png" />
<link rel="shortcut icon" href="http://ietfdocs.potaroo.net/idref/rfc5024/rfc.png" type="image/png" />
<title>RFC 5024 OFTP2</title>
<script type="text/javascript" language="JavaScript1.1"><!--
function showAddr(name, dom, text) {
addr = name + "@" + dom;
if (!text) { text = addr; }
document.write('<a href="mail'+'to'+':' + addr+'">'+text+'</a>');
}
//--></script>
</head>
<body style="margin: 8px;">
<h2>RFC 5024 - ODETTE File Transfer Protocol Specification</h2>
<ul><table border="0" cellspacing="0">
<tbody>
<tr>
<td><b>RFC </b>:</td>
<td><a href="http://ietfdocs.potaroo.net/rfc/rfc5024.txt">RFC5024</a></td>
<td><a href="http://ietfdocs.potaroo.net/rfc-pdf/rfc5024.pdf"><img src="pdf.png" border="0" height="15" /></a></td>
</tr>
<tr><td><b>Title</b>:</td><td colspan="2"><b>ODETTE File Transfer Protocol 2.0</b></td></tr>
<tr><td><b>Date</b>:</td><td colspan="2">November 2007</td></tr>
<tr><td><b>Status</b>:</td><td colspan="2"><font color="green">INFORMATIONAL</font></td></tr>
<tr><td><b>Obsoletes</b>:</td><td colspan="2"><a href="http://ietfdocs.potaroo.net/idref/rfc2204">2204</a></td></tr>
</tbody></table></ul>
<hr/><pre><!-- rfcmarkup.cgi version 1.05 -->
<pre>Network Working Group I. Friend
Request for Comments: 5024 ODETTE
Obsoletes: 2204 November 2007
Category: Informational
 
 
ODETTE File Transfer Protocol 2
 
Status of This Memo
 
This memo provides information for the Internet community. It does
not specify an Internet standard of any kind. Distribution of this
memo is unlimited.
 
IESG Note
 
This RFC is not a candidate for any level of Internet Standard. The
IETF disclaims any knowledge of the fitness of this RFC for any
purpose and in particular notes that the decision to publish is not
based on IETF review for such things as security, congestion control,
or inappropriate interaction with deployed protocols. The RFC Editor
has chosen to publish this document at its discretion. Readers of
this document should exercise caution in evaluating its value for
implementation and deployment. See <a href="http://ietfdocs.potaroo.net/idref/rfc3932">RFC 3932</a> for more information.
 
Abstract
 
This memo updates the ODETTE File Transfer Protocol, an established
file transfer protocol facilitating electronic data interchange of
business data between trading partners, to version 2.
 
The protocol now supports secure and authenticated communication over
the Internet using Transport Layer Security, provides file
encryption, signing, and compression using Cryptographic Message
Syntax, and provides signed receipts for the acknowledgement of
received files.
 
The protocol supports both direct peer-to-peer communication and
indirect communication via a Value Added Network and may be used with
TCP/IP, X.25, and ISDN-based networks.
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 1]
<a name="page-2"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Table of Contents
 
<a name="section-1">1</a>. Introduction ....................................................<a href="#page-4">4</a>
1.1. Background .................................................<a href="#page-4">4</a>
1.2. Summary of Features ........................................<a href="#page-5">5</a>
1.3. General Principles .........................................<a href="#page-5">5</a>
1.4. Structure ..................................................<a href="#page-6">6</a>
1.5. Virtual Files ..............................................<a href="#page-6">6</a>
1.6. Service Description ........................................<a href="#page-9">9</a>
1.7. Security ...................................................<a href="#page-9">9</a>
2. Network Service ................................................<a href="#page-11">11</a>
2.1. Introduction ..............................................<a href="#page-11">11</a>
2.2. Service Primitives ........................................<a href="#page-11">11</a>
2.3. Secure ODETTE-FTP Session .................................<a href="#page-12">12</a>
2.4. Port Assignment ...........................................<a href="#page-12">12</a>
3. File Transfer Service ..........................................<a href="#page-13">13</a>
3.1. Model .....................................................<a href="#page-13">13</a>
3.2. Session Setup .............................................<a href="#page-14">14</a>
3.3. File Transfer .............................................<a href="#page-16">16</a>
3.4. Session Take Down .........................................<a href="#page-20">20</a>
3.5. Service State Automata ....................................<a href="#page-23">23</a>
4. Protocol Specification .........................................<a href="#page-28">28</a>
4.1. Overview ..................................................<a href="#page-28">28</a>
4.2. Start Session Phase .......................................<a href="#page-28">28</a>
4.3. Start File Phase ..........................................<a href="#page-30">30</a>
4.4. Data Transfer Phase .......................................<a href="#page-34">34</a>
4.5. End File Phase ............................................<a href="#page-35">35</a>
4.6. End Session Phase .........................................<a href="#page-36">36</a>
4.7. Problem Handling ..........................................<a href="#page-36">36</a>
5. Commands and Formats ...........................................<a href="#page-37">37</a>
5.1. Conventions ...............................................<a href="#page-37">37</a>
5.2. Commands ..................................................<a href="#page-37">37</a>
5.3. Command Formats ...........................................<a href="#page-37">37</a>
5.4. Identification Code .......................................<a href="#page-68">68</a>
6. File Services ..................................................<a href="#page-69">69</a>
6.1. Overview ..................................................<a href="#page-69">69</a>
6.2. File Signing ..............................................<a href="#page-69">69</a>
6.3. File Encryption ...........................................<a href="#page-70">70</a>
6.4. File Compression ..........................................<a href="#page-70">70</a>
6.5. V Format Files - Record Lengths ...........................<a href="#page-70">70</a>
7. ODETTE-FTP Data Exchange Buffer ................................<a href="#page-71">71</a>
7.1. Overview ..................................................<a href="#page-71">71</a>
7.2. Data Exchange Buffer Format ...............................<a href="#page-71">71</a>
7.3. Buffer Filling Rules ......................................<a href="#page-72">72</a>
8. Stream Transmission Buffer .....................................<a href="#page-73">73</a>
8.1. Introduction ..............................................<a href="#page-73">73</a>
8.2. Stream Transmission Header Format .........................<a href="#page-73">73</a>
 
 
 
 
Friend Informational [Page 2]
<a name="page-3"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-9">9</a>. Protocol State Machine .........................................<a href="#page-74">74</a>
9.1. ODETTE-FTP State Machine ..................................<a href="#page-74">74</a>
9.2. Error Handling ............................................<a href="#page-75">75</a>
9.3. States ....................................................<a href="#page-76">76</a>
9.4. Input Events ..............................................<a href="#page-79">79</a>
9.5. Output Events .............................................<a href="#page-79">79</a>
9.6. Local Variables ...........................................<a href="#page-80">80</a>
9.7. Local Constants ...........................................<a href="#page-81">81</a>
9.8. Session Connection State Table ............................<a href="#page-82">82</a>
9.9. Error and Abort State Table ...............................<a href="#page-85">85</a>
9.10. Speaker State Table 1 ....................................<a href="#page-86">86</a>
9.11. Speaker State Table 2 ....................................<a href="#page-91">91</a>
9.12. Listener State Table .....................................<a href="#page-93">93</a>
9.13. Example ..................................................<a href="#page-96">96</a>
10. Miscellaneous .................................................<a href="#page-97">97</a>
10.1. Algorithm Choice .........................................<a href="#page-97">97</a>
10.2. Cryptographic Algorithms .................................<a href="#page-97">97</a>
10.3. Protocol Extensions ......................................<a href="#page-97">97</a>
10.4. Certificate Services .....................................<a href="#page-98">98</a>
11. Security Considerations .......................................<a href="#page-98">98</a>
Appendix A. Virtual File Mapping Example .........................<a href="#page-100">100</a>
Appendix B. ISO 646 Character Subset .............................<a href="#page-103">103</a>
Appendix C. X.25 Specific Information ............................<a href="#page-104">104</a>
C.1. X.25 Addressing Restrictions .............................<a href="#page-104">104</a>
C.2. Special Logic ............................................<a href="#page-105">105</a>
C.3. PAD Parameter Profile ....................................<a href="#page-116">116</a>
Appendix D. OFTP X.25 Over ISDN Recommendation ...................<a href="#page-118">118</a>
D.1. ODETTE ISDN Recommendation ...............................<a href="#page-119">119</a>
D.2. Introduction to ISDN .....................................<a href="#page-120">120</a>
D.3. Equipment Types ..........................................<a href="#page-123">123</a>
D.4. Implementation ...........................................<a href="#page-124">124</a>
Acknowledgements .................................................<a href="#page-132">132</a>
Normative References .............................................<a href="#page-132">132</a>
Informative References ...........................................<a href="#page-133">133</a>
ODETTE Address ...................................................<a href="#page-134">134</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 3]
<a name="page-4"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-1">1</a>. Introduction
 
<a name="section-1.1">1.1</a>. Background
 
The ODETTE File Transfer Protocol (ODETTE-FTP) was defined in 1986 by
working group four of the Organisation for Data Exchange by Tele
Transmission in Europe (ODETTE) to address the electronic data
interchange (EDI) requirements of the European automotive industry.
 
ODETTE-FTP allows business applications to exchange files on a peer-
to-peer basis in a standardised, purely automatic manner and provides
a defined acknowledgement process on successful receipt of a file.
 
ODETTE-FTP is not to be confused as a variant of, or similar to, the
Internet FTP [<a href="#ref-FTP">FTP</a>], which provides an interactive means for
individuals to share files and which does not have any sort of
acknowledgement process. By virtue of its interactive nature, lack
of file acknowledgements, and client/server design, FTP does not
easily lend itself to mission-critical environments for the exchange
of business data.
 
Over the last ten years, ODETTE-FTP has been widely deployed on
systems of all sizes from personal computers to large mainframes
while the Internet has emerged as the dominant international network,
providing high-speed communication at low cost. To match the demand
for EDI over the Internet, ODETTE has decided to extend the scope of
its file transfer protocol to incorporate security functions and
advanced compression techniques to ensure that it remains at the
forefront of information exchange technology.
 
The protocol now supports secure and authenticated communication over
the Internet using Transport Layer Security, provides file
encryption, signing, and compression using Cryptographic Message
Syntax, and provides signed receipts for the acknowledgement of
received files.
 
The protocol supports both direct peer-to-peer communication and
indirect communication via a Value Added Network and may be used with
TCP/IP, X.25 and ISDN based networks.
 
ODETTE-FTP has been defined by the ODETTE Security Working Group
which consists of a number of ODETTE member organisations. All
members have significant operational experience working with and
developing OFTP and EDI solutions.
 
 
 
 
 
 
 
Friend Informational [Page 4]
<a name="page-5"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-1.2">1.2</a>. Summary of Features
 
This memo is a development of version 1.4 of ODETTE-FTP [<a href="#ref-OFTP">OFTP</a>] with
these changes/additions:
 
Session level encryption
File level encryption
Secure authentication
File compression
Signed End to End Response (EERP)
Signed Negative End Response (NERP)
Maximum permitted file size increased to 9 PB (petabytes)
Virtual file description added
Extended error codes
 
Version 1.4 of ODETTE-FTP included these changes and additions to
version 1.3:
 
Negative End Response (NERP)
Extended Date and Time stamp
New reason code 14 (File direction refused)
 
<a name="section-1.3">1.3</a>. General Principles
 
The aim of ODETTE-FTP is to facilitate the transmission of a file
between one or more locations in a way that is independent of the
data communication network, system hardware, and software
environment.
 
In designing and specifying the protocol, the following factors were
considered.
 
<a name="section-1">1</a>. The possible differences of size and sophistication of file
storage and small and large systems.
 
<a name="section-2">2</a>. The necessity to work with existing systems (reduce changes to
existing products and allow easy implementation).
 
<a name="section-3">3</a>. Systems of different ages.
 
<a name="section-4">4</a>. Systems of different manufactures.
 
<a name="section-5">5</a>. The potential for growth in sophistication (limit impact and avoid
changes at other locations).
 
 
 
 
 
 
 
Friend Informational [Page 5]
<a name="page-6"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-1.4">1.4</a>. Structure
 
ODETTE-FTP is modelled on the OSI reference model. It is designed to
use the Network Service provided by level 3 of the model and provide
a File Service to the users. Thus, the protocol spans levels 4 to 7
of the model.
 
The description of ODETTE-FTP contained in this memo is closely
related to the original 'X.25' specification of the protocol and in
the spirit of the OSI model describes:
 
<a name="section-1">1</a>. A File Service provided to a User Monitor.
 
<a name="section-2">2</a>. A protocol for the exchange of information between peer
ODETTE-FTP entities.
 
<a name="section-1.5">1.5</a>. Virtual Files
 
Information is always exchanged between ODETTE-FTP entities in a
standard representation called a Virtual File. This allows data
transfer without regard for the nature of the communicating systems.
 
The mapping of a file between a local and virtual representation will
vary from system to system and is not defined here.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 6]
<a name="page-7"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
o---------o
Site | Local |
A | File A |
o---------o
|
o----------------------- Mapping A ------------------------o
| | |
| o---------o |
| | Virtual | |
| | File | |
| o---------o |
| o------------------------------------------------o |
| | | |
| | ODETTE-FTP | |
| | | |
| o------------------------------------------------o |
| o---------o o---------o |
| | Virtual | | Virtual | |
| | File | | File | |
| o---------o o----+----o |
| | | |
o------ Mapping B ------------------------ Mapping C ------o
| |
o---------o o----+----o
| Local | Site Site | Local |
| File B | B C | File C |
o---------o o---------o
 
A Virtual File is described by a set of attributes identifying and
defining the data to be transferred. The main attributes are
detailed in Sections 1.5.1 to 1.5.4.
 
<a name="section-1.5.1">1.5.1</a>. Organisation
 
Sequential
 
Logical records are presented one after another. ODETTE-FTP must
be aware of the record boundaries.
 
<a name="section-1.5.2">1.5.2</a>. Identification
 
Dataset Name
 
Dataset name of the Virtual File being transferred, assigned by
bilateral agreement.
 
 
 
 
 
 
Friend Informational [Page 7]
<a name="page-8"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Time stamp (HHMMSScccc)
 
A file qualifier indicating the time the Virtual File was made
available for transmission. The counter (cccc=0001-9999) gives
higher resolution.
 
Date stamp (CCYYMMDD)
 
A file qualifier indicating the date the Virtual File was made
available for transmission.
 
The Dataset Name, Date, and Time attributes are assigned by the
Virtual File's originator and are used to uniquely identify a file.
They are all mandatory and must not be changed by intermediate
locations.
 
The User Monitor may use the Virtual File Date and Time attributes in
local processes involving date comparisons and calculations. Any
such use falls outside the scope of this protocol.
 
<a name="section-1.5.3">1.5.3</a>. Record Format
 
Four record formats are defined:
 
Fixed (F)
 
Each record in the file has the same length.
 
Variable (V)
 
The records in the file can have different lengths.
 
Unstructured (U)
 
The file contains a stream of data. No structure is defined.
 
Text File (T)
 
A Text File is defined as a sequence of ASCII characters,
containing no control characters except CR-LF that delimit
lines. A line will not have more than 2048 characters.
 
<a name="section-1.5.4">1.5.4</a>. Restart
 
ODETTE-FTP can negotiate the restart of an interrupted Virtual File
transmission. Fixed and Variable format files are restarted on
record boundaries. For Unstructured and Text files, the restart
position is expressed as a file offset in 1K (1024 octet) blocks.
 
 
 
Friend Informational [Page 8]
<a name="page-9"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
The restart position is always calculated relative to the start of
the Virtual File.
 
<a name="section-1.6">1.6</a>. Service Description
 
ODETTE-FTP provides a file transfer service to a User Monitor and in
turn uses the Internet transport layer stream service to communicate
between peers.
 
These services are specified in this memo using service primitives
grouped into four classes as follows:
 
Request (RQ) An entity asks the service to do some work.
Indication (IND) A service informs an entity of an event.
Response (RS) An entity responds to an event.
Confirm (CF) A service informs an entity of the response.
 
Services may be confirmed, using the request, indication, response,
and confirm primitives, or unconfirmed using just the request and
indication primitives.
 
<a name="section-1.7">1.7</a>. Security
 
ODETTE-FTP provides a number of security services to protect a
Virtual File transmission across a hostile network.
 
These security services are as follows:
 
Confidentiality
Integrity
Non-repudiation of receipt
Non-repudiation of origin
Secure authentication
 
Security services in this specification are implemented as follows:
 
Session level encryption
File level encryption
Signed files
Signed receipts
Session level authentication
ODETTE-FTP Authentication
 
Session level encryption provides data confidentiality by encryption
of all the protocol commands and data exchanged between two parties,
preventing a third party from extracting any useful information from
the transmission.
 
 
 
 
Friend Informational [Page 9]
<a name="page-10"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
This session level encryption is achieved by layering ODETTE-FTP over
Transport Layer Security [<a href="#ref-TLS">TLS</a>], distinguishing between secure and
unsecure TCP/IP traffic using different port numbers.
 
File encryption provides complementary data confidentiality by
encryption of the files in their entirety. Generally, this
encryption occurs prior to transmission, but it is also possible to
encrypt and send files while in session. File encryption has the
additional benefit of allowing a file to remain encrypted outside of
the communications session in which it was sent. The file can be
received and forwarded by multiple intermediaries, yet only the final
destination will be able to decrypt the file. File encryption does
not encrypt the actual protocol commands, so trading partner EDI
codes and Virtual File names are still viewable.
 
Secure authentication is implemented through the session level
authentication features available in [<a href="#ref-TLS">TLS</a>] and proves the identity of
the parties wishing to communicate.
 
ODETTE-FTP Authentication also provides an authentication mechanism,
but one that is integral to ODETTE-FTP and is available on all
network infrastructures over which ODETTE-FTP is operated (this is in
contrast to [<a href="#ref-TLS">TLS</a>] which is generally only available over TCP/IP-based
networks). Both parties are required to possess certificates when
ODETTE-FTP Authentication is used.
 
The security features in ODETTE-FTP 2 are centred around the use of
[<a href="#ref-X.509">X.509</a>] certificates. To take advantage of the complete range of
security services offered in both directions, each party is required
to possess an [<a href="#ref-X.509">X.509</a>] certificate. If the confidentiality of data
between two parties is the only concern, then [<a href="#ref-TLS">TLS</a>] alone can be
used, which allows the party accepting an incoming connection (the
Responder) to be the only partner required to possess a certificate.
 
For businesses, this means that session level encryption between a
hub and its trading partners can be achieved without requiring all
the trading partners to obtain a certificate, assuming that trading
partners always connect to the hub.
 
With the exception of [<a href="#ref-TLS">TLS</a>], all the security services work with X.25
and ISDN as transport media. Although nothing technically precludes
[<a href="#ref-TLS">TLS</a>] from working with X.25 or ISDN, implementations are rare.
 
 
 
 
 
 
 
 
 
Friend Informational [Page 10]
<a name="page-11"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-2">2</a>. Network Service
 
<a name="section-2.1">2.1</a>. Introduction
 
ODETTE-FTP peer entities communicate with each other via the OSI
Network Service or the Transmission Control Protocol Transport
Service [<a href="#ref-RFC793">RFC793</a>]. This is described by service primitives
representing request, indication, response, and confirmation actions.
 
For the Internet environment, the service primitives mentioned below
for the Network Service have to be mapped to the respective Transport
Service primitives. This section describes the Network Service
primitives used by ODETTE-FTP and their relationship to the TCP
interface. In practice, the local transport service application
programming interface will be used to access the TCP service.
 
<a name="section-2.2">2.2</a>. Service Primitives
 
All network primitives can be directly mapped to the respective
Transport primitives when using TCP.
 
<a name="section-2.2.1">2.2.1</a>. Network Connection
 
N_CON_RQ ------&gt; N_CON_IND
N_CON_CF &lt;------ N_CON_RS
 
This describes the setup of a connection. The requesting ODETTE-FTP
peer uses the N_CON_RQ primitive to request an active OPEN of a
connection to a peer ODETTE-FTP, the Responder, which has previously
requested a passive OPEN. The Responder is notified of the incoming
connection via N_CON_IND and accepts it with N_CON_RS. The requester
is notified of the completion of its OPEN request upon receipt of
N_CON_CF.
 
Parameters
 
Request Indication Response Confirmation
---------------------------------------------------------------------
Dest addr ------&gt; same same same
 
<a name="section-2.2.2">2.2.2</a>. Network Data
 
N_DATA_RQ ------&gt; N_DATA_IND
 
Data exchange is an unconfirmed service. The requester passes data
for transmission to the Network Service via the N_DATA_RQ primitive.
The Responder is notified of the availability of data via N_DATA_IND.
 
 
 
 
Friend Informational [Page 11]
<a name="page-12"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
In practice, the notification and receipt of data may be combined,
such as by the return from a blocking read from the network socket.
 
Parameters
 
Request Indication
---------------------------------------------------------------------
Data ------------------&gt; same
 
<a name="section-2.2.3">2.2.3</a>. Network Disconnection
 
N_DISC_RQ ------&gt; N_DISC_IND
 
An ODETTE-FTP requests the termination of a connection with the
N_DISC_RQ service primitive. Its peer is notified of the CLOSE by a
N_DISC_IND event. It is recognised that each peer must issue a
N_DISC_RQ primitive to complete the TCP symmetric close procedure.
 
<a name="section-2.2.4">2.2.4</a>. Network Reset
 
------&gt; N_RST_IND
 
An ODETTE-FTP entity is notified of a network error by a N_RST_IND
event. It should be noted that N_RST_IND would also be generated by
a peer RESETTING the connection, but this is ignored here as N_RST_RQ
is never sent to the Network Service by ODETTE-FTP.
 
<a name="section-2.3">2.3</a>. Secure ODETTE-FTP Session
 
[<a name="ref-TLS">TLS</a>] provides a mechanism for securing an ODETTE-FTP session over
the Internet or a TCP network. ODETTE-FTP is layered over [<a href="#ref-TLS">TLS</a>],
distinguishing between secure and unsecure traffic by using different
server ports.
 
The implementation is very simple. Layer ODETTE-FTP over [<a href="#ref-TLS">TLS</a>] in
the same way as layering ODETTE-FTP over TCP/IP. [<a href="#ref-TLS">TLS</a>] provides both
session encryption and authentication, both of which may be used by
the connecting parties. A party acts as a [<a href="#ref-TLS">TLS</a>] server when
receiving calls and acts as a [<a href="#ref-TLS">TLS</a>] client when making calls. When
the [<a href="#ref-TLS">TLS</a>] handshake has completed, the responding ODETTE-FTP may
start the ODETTE-FTP session by sending the Ready Message.
 
<a name="section-2.4">2.4</a>. Port Assignment
 
An ODETTE-FTP requester will select a suitable local port.
 
The responding ODETTE-FTP will listen for connections on Registered
Port 3305; the service name is 'odette-ftp'.
 
 
 
Friend Informational [Page 12]
<a name="page-13"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
The responding ODETTE-FTP will listen for secure TLS connections on
Registered Port 6619; the service name is 'odette-ftps'.
 
<a name="section-3">3</a>. File Transfer Service
 
The File Transfer Service describes the services offered by an
ODETTE-FTP entity to its User Monitor (generally an application).
 
NOTE: The implementation of the service primitives is an application
issue.
 
<a name="section-3.1">3.1</a>. Model
 
o-------------------o o-------------------o
| | | |
| USER MONITOR | | USER MONITOR |
| | | |
o-------------------o o-------------------o
| A | A
| | | |
F_XXX_RQ/RS | | F_XXX_IND/CF F_XXX_RQ/RS | | F_XXX_IND/CF
V | V |
o-------------------o o-------------------o
| |- - - - - - &gt;| |
| ODETTE-FTP Entity | E-Buffer | ODETTE-FTP Entity |
| |&lt; - - - - - -| |
o-------------------o o-------------------o
| A | A
N_XXX_RQ/RS | | N_XXX_IND/CF N_XXX_RQ/RS | | N_XXX_IND/CF
| | | |
V | V |
o---------------------------------------------------------o
| |
| N E T W O R K |
| |
o---------------------------------------------------------o
 
Key: E-Buffer - Exchange Buffer
F_ - File Transfer Service Primitive
N_ - Network Service Primitive
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 13]
<a name="page-14"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-3.2">3.2</a>. Session Setup
 
<a name="section-3.2.1">3.2.1</a>. Session Connection Service
 
These diagrams represent the interactions between two communicating
ODETTE-FTP entities and their respective User Agents.
 
The vertical lines represent the ODETTE-FTP entities. The User
Agents are not shown.
 
| |
F_CONNECT_RQ ----&gt;|------------|----&gt; F_CONNECT_IND
| |
F_CONNECT_CF &lt;----|------------|&lt;---- F_CONNECT_RS
| |
 
Parameters
 
Request Indication Response Confirm
---------------------------------------------------------------------
called-address -&gt; same --- ----
calling-address-&gt; same --- ----
ID1 ------------&gt; same ID2 ------------&gt; same
PSW1------------&gt; same PSW2 -----------&gt; same
mode1 ----------&gt; mode2 ----------&gt; mode3 ----------&gt; same
restart1 -------&gt; same -----------&gt; restart2 -------&gt; same
authentication1-&gt; same -----------&gt; authentication2-&gt; same
---------------------------------------------------------------------
 
Mode
 
Specifies the file transfer capabilities of the entity sending or
receiving a F_CONNECT primitive for the duration of the session.
 
Value:
Sender-only The entity can only send files.
Receiver-only The entity can only receive files.
Both The entity can both send and receive files.
 
Negotiation:
Sender-only Not negotiable.
Receiver-only Not negotiable.
Both Can be negotiated down to Sender-only or
Receiver-only by the User Monitor or the
ODETTE-FTP entity.
 
 
 
 
 
 
Friend Informational [Page 14]
<a name="page-15"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Request Indication Response Confirm
---------------------------------------------------------------------
Sender-only ----&gt; Receiver-only --&gt; Receiver-only --&gt; Sender-only
 
Receiver-only --&gt; Sender-only ----&gt; Sender-only ----&gt; Receiver-only
 
Both -----+-----&gt; Both ----+------&gt; Both -----------&gt; Both
| or +------&gt; Receiver-only --&gt; Sender-only
| or +------&gt; Sender-only ----&gt; Receiver-only
|
or +-----&gt; Receiver-only --&gt; Receiver-only --&gt; Sender-only
or +-----&gt; Sender-only ----&gt; Sender-only ----&gt; Receiver-only
---------------------------------------------------------------------
 
Restart
 
Specifies the file transfer restart capabilities of the User
Monitor.
 
Value:
Y The entity can restart file transfers.
N The entity cannot restart file transfers.
 
Negotiation:
 
Request Indication Response Confirm
---------------------------------------------------------------------
restart = Y ----&gt; restart = Y --+-&gt; restart = Y ----&gt; restart = Y
or +-&gt; restart = N ----&gt; restart = N
 
restart = N ----&gt; restart = N ----&gt; restart = N ----&gt; restart = N
---------------------------------------------------------------------
 
Authentication
 
Specifies the authentication requirement of the User Monitor.
 
Value:
Y Authentication required.
N Authentication not required.
 
Negotiation: Not negotiable.
 
 
 
 
 
 
 
 
 
Friend Informational [Page 15]
<a name="page-16"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Request Indication Response Confirm
---------------------------------------------------------------------
auth = Y ----&gt; auth = Y ----&gt; auth = Y ----&gt; auth = Y
 
auth = N ----&gt; auth = N ----&gt; auth = N ----&gt; auth = N
---------------------------------------------------------------------
 
<a name="section-3.3">3.3</a>. File Transfer
 
<a name="section-3.3.1">3.3.1</a>. File Opening
 
| |
F_START_FILE_RQ ----&gt;|------------|----&gt; F_START_FILE_IND
| |
F_START_FILE_CF(+|-) &lt;----|------------|&lt;---- F_START_FILE_RS(+|-)
| |
 
Parameters
 
Request Ind. RS(+) CF(+) RS(-) CF(-)
------------------------------------------------------------------
filename-------&gt; same ---- ---- ---- ----
date-time------&gt; same ---- ---- ---- ----
destination----&gt; same ---- ---- ---- ----
originator-----&gt; same ---- ---- ---- ----
rec-format-----&gt; same ---- ---- ---- ----
rec-size ------&gt; same ---- ---- ---- ----
file-size------&gt; same ---- ---- ---- ----
org-file-size--&gt; same ---- ---- ---- ----
signed-eerp----&gt; same ---- ---- ---- ----
cipher---------&gt; same ---- ---- ---- ----
sec-services---&gt; same ---- ---- ---- ----
compression----&gt; same ---- ---- ---- ----
envelope-format&gt; same ---- ---- ---- ----
description----&gt; same ---- ---- ---- ----
restart-pos1---&gt; same-&gt; restart-pos2-&gt; same ---- ----
---- ---- ---- ---- cause ------&gt; same
---- ---- ---- ---- retry-later-&gt; same
------------------------------------------------------------------
 
Notes:
 
<a name="section-1">1</a>. Retry-later has values "Y" or "N".
2. Cause is the reason for refusing the transfer (1,..,13,99).
3. Restart-pos1 not equal 0 is only valid if restart has been
agreed during initial negotiation.
4. Restart-pos2 is less than or equal to restart-pos1.
 
 
 
 
Friend Informational [Page 16]
<a name="page-17"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-3.3.2">3.3.2</a>. Data Regime
 
| |
F_DATA_RQ ----&gt;|------------|----&gt; F_DATA_IND
| |
F_DATA_CF &lt;----|(---CDT----)|
| |
 
Note: Unlike other commands, where the F_XXX_CF signal is a result of
a corresponding F_XXX_RS command, in this case, the local entity
layer issues this signal when it is ready for the next data
request. This decision is based on the current credit count and
the reception of CDT (Set Credit) from the receiver.
 
<a name="section-3.3.3">3.3.3</a>. File Closing
 
| |
F_CLOSE_FILE_RQ ---&gt;|------------|----&gt; F_CLOSE_FILE_IND
| |
F_CLOSE_FILE_CF(+|-) &lt;---|------------|&lt;---- F_CLOSE_FILE_RS(+|-)
| |
 
Parameters
 
Request Ind RS(+) CF(+) RS(-) CF(-)
---------------------------------------------------------------------
rec-count ---&gt; same ---- ---- ---- ----
unit-count --&gt; same ---- ---- ---- ----
---- ---- Speaker=Y ---&gt; Speaker=N ---- ----
---- ---- Speaker=N ---&gt; Speaker=Y ---- ----
---- ---- ---- ---- cause ---&gt; same
---------------------------------------------------------------------
 
In a positive Close File response (F_CLOSE_FILE_RS(+)) the current
Listener may either:
 
<a name="section-1">1</a>. Set Speaker to "Yes" and become the Speaker or
2. Set Speaker to "No" and remain the Listener.
 
The File Transfer service will ensure that the setting of the speaker
parameter is consistent with the capabilities of the peer user.
 
The turn is never exchanged in the case of a negative response or
confirmation.
 
Only the Speaker is allowed to issue F_XXX_FILE_RQ primitives.
 
 
 
 
 
Friend Informational [Page 17]
<a name="page-18"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-3.3.4">3.3.4</a>. Exchanging the Turn
 
<a name="section-3.3.4.1">3.3.4.1</a>. Initial Turn (First Speaker)
 
The Initiator becomes the first Speaker at the end of the Session
Setup (F_CONNECT_CF received by Initiator and F_CONNECT_RS sent by
Responder).
 
<a name="section-3.3.4.2">3.3.4.2</a>. Following Turns
 
Rules:
 
<a name="section-1">1</a>. At each unsuccessful End of File, the turn is not exchanged.
 
<a name="section-2">2</a>. At each successful End of File, the turn is exchanged if requested
by the Listener:
 
- The current Listener receives F_CLOSE_FILE_IND (Speaker =
choice).
 
- If the Listener answers F_CLOSE_FILE_RS(Speaker = YES), it
becomes the Speaker, the Speaker receives F_CLOSE_FILE_CF
(Speaker = NO) and becomes the Listener.
 
- If the Listener answers F_CLOSE_FILE_RS(Speaker = NO), it
remains as the Listener, and the Speaker receives
F_CLOSE_FILE_CF (Speaker = YES) and remains as the Speaker.
 
<a name="section-3">3</a>. The Speaker can issue a Change Direction request (F_CD_RQ) to
become the Listener. The Listener receives a Change Direction
indication (F_CD_IND) and becomes the Speaker.
 
<a name="section-4">4</a>. In order to prevent loops of F_CD_RQ/IND, the Speaker may not send
an F_CD_RQ after receiving an unsolicited F_CD_IND. If the
Listener receives a solicited F_CD_IND as a result of sending
EFPA(Speaker=Yes), it is acceptable to immediately relinquish the
right to speak by sending an F_CD_RQ.
 
<a name="section-3.3.5">3.3.5</a>. End to End Response
 
This service is initiated by the current Speaker (if there is no file
transfer in progress) to send an End to End Response from the final
destination to the originator of a file.
 
 
 
 
 
 
 
 
Friend Informational [Page 18]
<a name="page-19"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
| |
F_EERP_RQ ----&gt;|------------|----&gt; F_EERP_IND
| |
F_RTR_CF &lt;----|------------|&lt;---- F_RTR_RS
| |
 
Parameters
 
Request Indication
------------------------------------
filename -----------&gt; same
date ---------------&gt; same
time ---------------&gt; same
destination --------&gt; same
originator ---------&gt; same
hash ---------------&gt; same
signature ----------&gt; same
------------------------------------
 
Relationship with Turn:
 
- Only the Speaker may send an End to End Response request.
 
- Invoking the EERP service does not change the turn.
 
- If an F_CD_IND has been received just before F_EERP_RQ is issued,
this results in leaving the special condition created by the
reception of F_CD_IND; i.e., while it was possible to issue
F_RELEASE_RQ and not possible to issue F_CD_RQ just after the
reception of F_CD_IND, after having issued F_EERP_RQ the normal
Speaker status is entered again (F_CD_RQ valid, but F_RELEASE_RQ
not valid).
 
Notes:
 
<a name="section-1">1</a>. The F_EERP_RQ (and also F_NERP_RQ) is confirmed with an F_RTR_CF
signal. The F_RTR_CF signal is common to both F_EERP_RQ and
F_NERP_RQ. There should be no ambiguity, since there can only be
one such request pending at any one time.
 
<a name="section-2">2</a>. The signature is optional and is requested when sending the
F_START_FILE_RQ.
 
<a name="section-3">3</a>. If it is not possible to sign the EERP, then an unsigned EERP
should still be sent.
 
 
 
 
 
 
Friend Informational [Page 19]
<a name="page-20"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-4">4</a>. It is an application implementation issue to validate the contents
of the EERP and its signature and to decide what action to take on
receipt of an EERP that fails validation or is not signed when a
signed EERP was requested.
 
<a name="section-3.3.6">3.3.6</a>. Negative End Response
 
This service is initiated by the current speaker (if there is no file
transfer in progress) to send a Negative End Response when a file
could not be transmitted to the next destination. It is sent only if
the problem is of a non-temporary kind.
 
This service may also be initiated by the final destination instead
of sending an End to End Response when a file could not be processed,
after having successfully received the file.
 
| |
F_NERP_RQ ----&gt;|------------|----&gt; F_NERP_IND
| |
F_RTR_CF &lt;----|------------|----- F_RTR_RS
| |
 
Parameters
 
Request Indication
---------------------------------------------------
filename ----------------------&gt; same
date --------------------------&gt; same
time --------------------------&gt; same
destination -------------------&gt; same
originator --------------------&gt; same
creator of negative response --&gt; same
reason ------------------------&gt; same
reason text -------------------&gt; same
hash --------------------------&gt; same
signature ---------------------&gt; same
---------------------------------------------------
 
Relationship with Turn:
 
The same as for the End-To-End response (see <a href="#section-3.3.5">Section 3.3.5</a>).
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 20]
<a name="page-21"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-3.4">3.4</a>. Session Take Down
 
<a name="section-3.4.1">3.4.1</a>. Normal Close
 
| |
F_RELEASE_RQ ----&gt;|------------|----&gt; F_RELEASE_IND
| |
 
Parameters
 
Request Indication
---------------------------------------------------------------------
reason = normal -------&gt; ----
---------------------------------------------------------------------
 
The Release service can only be initiated by the Speaker.
 
The Speaker can only issue a Release request (F_RELEASE_RQ) just
after receiving an unsolicited Change Direction indication
(F_CD_IND). This ensures that the other partner doesn't want to send
any more files in this session.
 
Peer ODETTE-FTP entities action a normal session release by
specifying Reason = Normal in an End Session (ESID) command.
 
<a name="section-3.4.2">3.4.2</a>. Abnormal Close
 
| |
F_RELEASE_RQ ----&gt;|------------|----&gt; F_ABORT_IND
| |
 
Parameters
 
Request Indication
---------------------------------------------------------------------
reason = error value --&gt; same (or equivalent)
AO (Abort Origin) = (L)ocal or (D)istant
---------------------------------------------------------------------
 
Abnormal session release can be initiated by either the Speaker or
the Listener and also by the user or provider.
 
Abnormal session release can occur at any time within the session.
 
Peer ODETTE-FTP entities action an abnormal session release by
specifying Reason = Error-value in an End Session (ESID) command.
 
 
 
 
 
Friend Informational [Page 21]
<a name="page-22"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
The abnormal session release deals with the following types of error:
 
<a name="section-1">1</a>. The service provider will initiate an abnormal release in the
following cases:
 
<a name="section-1">1</a>. Protocol error.
2. Failure of the Start Session (SSID) negotiation.
3. Command not recognised.
4. Data Exchange Buffer size error.
5. Resources not available.
6. Other unspecified abort code (with Reason = unspecified).
 
<a name="section-2">2</a>. The User Monitor will initiate an abnormal release in the
following cases:
 
<a name="section-1">1</a>. Local site emergency close down.
2. Resources not available.
3. Other unspecified abort code (with Reason = unspecified).
 
Other error types may be handled by an abort of the connection.
 
<a name="section-3.4.3">3.4.3</a>. Abort
 
| |
F_ABORT_RQ ----&gt;|------------|----&gt; F_ABORT_IND
| |
User-Initiated Abort
 
| |
F_ABORT_IND &lt;----|------------|----&gt; F_ABORT_IND
| |
Provider-Initiated Abort
 
Parameters
 
Request Indication
---------------------------------------------------------------------
-- R (Reason): specified or unspecified
-- AO (Abort Origin): (L)ocal or (D)istant
---------------------------------------------------------------------
 
The Abort service may be invoked by either entity at any time.
 
The service provider may initiate an abort in case of error
detection.
 
 
 
 
 
 
Friend Informational [Page 22]
<a name="page-23"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-3.4.4">3.4.4</a>. Explanation of Session Take Down Services
 
User | OFTP | Network | OFTP | User
---------------|------|----------------------|------|---------------
| | | |
 
<a name="section-1">1</a>. Normal Release
 
F_RELEASE_RQ | | ESID(R=normal) | | F_RELEASE_IND
*--------------|-&gt; ==|======================|=&gt; --|--------------&gt;
(R=normal) | | | |
 
<a name="section-2">2</a>. User-Initiated Abnormal Release
 
F_RELEASE_RQ | | ESID(R=error) | | F_ABORT_IND
*--------------|-&gt; ==|======================|=&gt; -|--------------&gt;
(R=error value)| | | | (R=error,AO=D)
 
<a name="section-3">3</a>. Provider-Initiated Abnormal Release
 
F_ABORT_IND | | ESID(R=error) | | F_ABORT_IND
&lt;--------------|-* *=|======================|=&gt; --|--------------&gt;
| | | |
 
<a name="section-4">4</a>. User-Initiated Connection Abort
 
F_ABORT_RQ | | N_DISC_RQ | | F_ABORT_IND
*--------------|-&gt; --|---------&gt;..----------|-&gt; --|--------------&gt;
| | N_DISC_IND | | (R=unsp.,AO=D)
 
<a name="section-5">5</a>. Provider-Initiated Connection Abort
 
F_ABORT_IND | | N_DISC_RQ | | F_ABORT_IND
&lt;--------------|-* *-|---------&gt;..----------|-&gt; --|--------------&gt;
(R=error,AO=L) | | N_DISC_IND | | (R=unsp.,AO=D)
 
 
Key: * Origin of command flow
F_ ---&gt; File Transfer Service primitive
N_ ---&gt; Network Service primitive
===&gt; ODETTE-FTP (OFTP) protocol message
 
<a name="section-3.5">3.5</a>. Service State Automata
 
These state automata define the service as viewed by the User
Monitor. Events causing a state transition are shown in lower case
and the resulting action in upper case where appropriate.
 
 
 
 
Friend Informational [Page 23]
<a name="page-24"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-3.5.1">3.5.1</a>. Idle State Diagram
 
o------------o
decision | | f_connect_ind
+-----------------| IDLE |-----------------+
| F_CONNECT_RQ | (0) | F_CONNECT_RS |
| o------------o |
V |
o-----------------o |
| | |
| I_WF_FCONNECTCF | |
| | |
o--------+--------o |
| |
| F_CONNECT_CF |
V V
o-----------------o o-----------------o
| | | |
| IDLE SPEAKER | | IDLE LISTENER |
| (1) | | (2) |
| See Speaker | | See Listener |
| State Diagram | | State Diagram |
| | | |
o-----------------o o-----------------o
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 24]
<a name="page-25"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-3.5.2">3.5.2</a>. Speaker State Diagram
 
o-----------------o o-----------------o
| IDLE LISTENER | | IDLE |
| CD_RQ just sent | | see (0) |
| see (3), Listen | | Idle |
| State Diagram | | State Diagram |
o-----------------o o-----------------o
A A
| |
decision decision
F_CD_RQ F_RELEASE_RQ
| |
o================o decision o----------o decision o---------------o
| |----------&gt;| WAIT FOR |&lt;----------| |
| | F_EERP_RQ | | F_EERP_RQ | |
| IDLE | | EERP/ | | IDLE |
| SPEAKER | decision | NERP | decision | SPEAKER |
| (1) |----------&gt;| CONFIRM. |&lt;----------| (4) |
| | F_NERP_RQ | | F_NERP_RQ | |
| | | | | |
| | | | | CD_IND |
| | f_rtr_cf | | | just received |
| |&lt;----------| | | |
| | o----------o | |
| | | |
| | | |
o================o o---------------o
A A | |
| | | decision and P2 decision and P2 |
| | +-----------------+ +---------------------+
| | F_START_FILE_RQ | | F_START_FILE_RQ
| | V V
| | o---------------o
| | f_file_start_cf(-) | |
| +----------------------| OPENING |
| | |
| o---------------o
| |
f_file_close_cf(-) or f_start_file_cf(+)
f_file_close_cf(+) and not P1 |
| V
 
 
 
 
 
 
 
 
 
Friend Informational [Page 25]
<a name="page-26"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
o---------------o o---------------o record to send o---------o
| | | |------------------&gt;| |
| CLOSING | | DATA TRANSFER | F_DATA_RQ | NEXT |
| | | | | RECORD |
| | | | f_data_cf | |
| | | |&lt;------------------| |
o---------------o o---------------o o---------o
| A |
| | end of file |
| +-------------------+
| F_CLOSE_FILE_RQ
| o-----------------o
| f_file_close_cf(+) and P1 | IDLE LISTENER |
+---------------------------------------------&gt;| see (2), Listen |
| State Diagram |
Predicates: o-----------------o
P1: Positive confirmation and Speaker = YES
P2: Mode = Both or (Mode = Sender-only)
 
<a name="section-3.5.3">3.5.3</a> Listener State Diagram
 
o-----------------o o-----------------o
| IDLE SPEAKER | | IDLE |
| CD_IND just | | |
| received see(4) | | see (0) |
| Speaker State | | Idle |
| Diagram | | State Diagram |
o-----------------o o-----------------o
A A
| |
decision f_eerp_ind decision
F_CD_IND +--------------+ F_RELEASE_IND
| | F_RTR_RS | |
o=================o | o-----------------o
| |&lt;-----------+ | |
| | | |
| | f_nerp_ind | |
| |------------+ | |
| | F_RTR_RS | | |
| | | | |
| |&lt;-----------+ | |
| IDLE LISTENER | f_eerp_ind | IDLE LISTENER |
| (2) |&lt;-----------------------------| (3) |
| | F_RTR_RS | CD_RQ |
| | | just sent |
| | f_nerp_ind | |
| |&lt;-----------------------------| |
 
 
 
 
Friend Informational [Page 26]
<a name="page-27"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
| | F_RTR_RS | |
| | | |
| | f_start_file_ind | |
| | and not P1 | |
| |---------------------+ | |
o=================o F_START_FILE_RS(-) | o-----------------o
A A | A A | | |
| | | | +-----------------------+ | |
| | | | | |
| | | | f_start_file_ind and not P1 | |
| | | +--------------------------------------+ |
| | | F_START_FILE_RS(-) |
| | | |
| | | f_start_file_ind f_start_file_ind |
| | | and P1 and P1 |
| | +----------------------------+ +------------------+
| | F_START_FILE_RS(+) | | F_START_FILE_RS(+)
| | V V
| | o---------------o
| |f_close_file_ind and not P3 | |
| +----------------------------| |
| F_CLOSE_FILE_RS(+,N) | |
| | DATA |
| | TRANSFER |
| f_close_file_ind and not P2 | |-------------+
+------------------------------| | |
F_CLOSE_FILE_RS(-) | |&lt;------------+
o---------------o F_DATA_IND
o---------------o |
| IDLESPEAKER | f_close_file_ind and P3 |
| see (1), Spkr |&lt;--------------------------+
| State Diagram | F_CLOSE_FILE_RS(+,Y)
o---------------o
 
Predicates:
P1: Decision to send F_START_FILE_RS(+)
P2: Decision to send F_CLOSE_FILE_RS(+)
P3: Decision to become Speaker
 
 
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 27]
<a name="page-28"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-4">4</a>. Protocol Specification
 
<a name="section-4.1">4.1</a>. Overview
 
ODETTE-FTP is divided into five operating phases.
 
Start Session
Start File
Data Transfer
End File
End Session
 
After the End File phase, an ODETTE-FTP entity may enter a new Start
File phase or terminate the session via the End Session phase.
 
ODETTE-FTP peers communicate by sending and receiving messages in
Exchange Buffers via the Network Service. Each Exchange Buffer
contains one of the following commands.
 
SSRM Start Session Ready Message
SSID Start Session
SECD Security Change Direction
AUCH Authentication Challenge
AURP Authentication Response
SFID Start File
SFPA Start File Positive Answer
SFNA Start File Negative Answer
DATA Data
CDT Set Credit
EFID End File
EFPA End File Positive Answer
EFNA End File Negative Answer
ESID End Session
CD Change Direction
EERP End to End Response
NERP Negative End Response
RTR Ready To Receive
 
The remainder of this section describes the protocol flows. Section
five details the command formats.
 
<a name="section-4.2">4.2</a>. Start Session Phase
 
The Start Session phase is entered immediately after the network
connection has been established.
 
 
 
 
 
 
Friend Informational [Page 28]
<a name="page-29"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-4.2.1">4.2.1</a>. Entity Definition
 
The ODETTE-FTP entity that took the initiative to establish the
network connection becomes the Initiator. Its peer becomes the
Responder.
 
<a name="section-4.2.2">4.2.2</a>. Protocol Sequence
 
The first message must be sent by the Responder.
 
<a name="section-1">1</a>. Initiator &lt;-------------SSRM -- Responder Ready Message
-- SSID ------------&gt; Identification
&lt;------------ SSID -- Identification
 
<a name="section-4.2.3">4.2.3</a>. Secure Authentication
 
Having exchanged SSIDs, the Initiator may optionally begin an
authentication phase, in which each party proves its identity to the
other.
 
<a name="section-4.2.4">4.2.4</a>. Protocol Sequence
 
The first authentication message must be sent by the Initiator.
 
<a name="section-1">1</a>. Initiator -- SECD ------------&gt; Responder Change Direction
&lt;------------ AUCH -- Challenge
-- AURP ------------&gt; Response
&lt;------------ SECD -- Change Direction
-- AUCH ------------&gt; Challenge
&lt;------------ AURP -- Response
 
The Initiator sends a Security Change Direction (SECD) to which the
Responder replies with an Authentication Challenge (AUCH).
 
The Responder looks up the public certificate that is linked to the
purported identity of the Initiator (located in the SSID). If the
Responder is unable to locate a suitable certificate then
authentication fails. The Responder uses the public key contained in
the certificate to encrypt a random challenge, unique for each
session, for the Initiator. This encrypted challenge is sent as a
[<a href="#ref-CMS">CMS</a>] envelope to the Initiator as part of the AUCH.
 
The Initiator decrypts the challenge using their private key and
sends the decrypted challenge back to the Responder in the
Authentication Response (AURP).
 
The Responder checks that the data received in the AURP matches the
random challenge that was sent to the Initiator.
 
 
 
Friend Informational [Page 29]
<a name="page-30"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
If the data matches, then the Initiator has authenticated
successfully and the Responder replies with a Security Change
Direction (SECD) beginning the complementary process of verifying the
Responder to the Initiator. If the data does not match, then the
Initiator fails authentication.
 
<a name="section-4.3">4.3</a>. Start File Phase
 
<a name="section-4.3.1">4.3.1</a>. Entity Definition
 
The Initiator from the Start Session phase is designated the Speaker
while the Responder becomes the Listener. The roles are reversed by
the Speaker sending a Change Direction command to the Listener.
 
<a name="section-4.3.2">4.3.2</a>. Protocol Sequence
 
<a name="section-1">1</a>. Speaker -- SFID ------------&gt; Listener Start File
&lt;------------ SFPA -- Answer YES
 
<a name="section-2">2</a>. Speaker -- SFID ------------&gt; Listener Start File
&lt;------------ SFNA -- Answer NO
Go To 1
 
Note: The User Monitor should take steps to prevent a loop
situation occurring.
 
<a name="section-2">2</a>. Speaker -- CD --------------&gt; Listener Change Direction
Listener &lt;------------ EERP -- Speaker End to End Response
-- RTR -------------&gt; Ready to Receive
&lt;------------ NERP -- Negative End Response
-- RTR -------------&gt; Ready to Receive
&lt;------------ SFID -- Start File
 
<a name="section-4.3.3">4.3.3</a>. Restart Facilities
 
The Start File command includes a count allowing the restart of an
interrupted transmission to be negotiated. If restart facilities are
not available, the restart count must be set to zero. The sender
will start with the lowest record count + 1.
 
<a name="section-4.3.4">4.3.4</a>. Broadcast Facilities
 
The destination in a Start File command can be specified as follows.
 
<a name="section-1">1</a>. An explicitly defined destination.
 
<a name="section-2">2</a>. A group destination that allows an intermediate location to
broadcast the Virtual File to multiple destinations.
 
 
 
Friend Informational [Page 30]
<a name="page-31"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
The Listener will send a negative answer to the Speaker when the
destination is not known.
 
<a name="section-4.3.5">4.3.5</a>. Priority
 
The prioritisation of files for transmission is left to the local
implementation. To allow some flexibility, a change direction
mechanism is available in the End File phase.
 
<a name="section-4.3.6">4.3.6</a>. End to End Response (EERP)
 
The End to End Response (EERP) command notifies the originator of a
Virtual File that the Virtual File has been successfully delivered to
its final destination. This allows the originator to perform house
keeping tasks such as deleting copies of the delivered data.
 
If the originator of the Virtual File requested a signed EERP in the
SFID, the EERP must be signed. Signing allows the originator of the
file to prove that the EERP was generated by the final destination.
If the final destination is unable to sign the EERP, it may send back
an unsigned EERP. It is an implementation issue to allow the
acceptance of an unsigned EERP if a signed EERP is requested.
 
A Response Command must be sent from the location performing the
final processing or distribution of the data to the originator. The
Response is mandatory and may be sent in the same or in any
subsequent session.
 
When an intermediate location broadcasts or distributes a Virtual
File, it must receive a Response command from all the locations to
which it forwarded the data before sending its own Response. This
ensures that the Response received by the Virtual File's originator
accounts for all the destination locations. An intermediate location
therefore needs to track the status of files it processes over time.
 
The requesting of a signed EERP is incompatible with the use of
broadcast facilities because an EERP can be signed by only one
destination. If this scenario occurs, the intermediate broadcast
location may continue and ignore the request for a signed EERP or
send back a NERP.
 
Example: Point to Point
 
Location A sends file Ba to location B, which will send an EERP to
location A after it successfully receives the file.
 
 
 
 
 
 
Friend Informational [Page 31]
<a name="page-32"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
o----------o o-----------o
| Loc. A |----------- S1 ----------&gt;| Loc. B |
| | | |
| [<a href="#ref-Ba">Ba</a>] |&lt;---------- R2 -----------| [<a href="#ref-Ba">Ba</a>] |
+----------o o-----------o
 
Key: S - File Transfer
R - Response EERP
[<a href="#ref-Ba">Ba</a>] - File for B from A
 
Example: Data distribution
 
Location A sends a Virtual File containing data for distribution
to locations B and C via clearing centres E1 and E2. Clearing
centre E1 must wait for a response from E2 (for file Ba) and
location C before it sends its response, R8, to location A.
Clearing centre E2 can only send response R7 to E1 when location B
acknowledges file Ba with response R6.
 
o---------o o---------o o---------o o---------o
| Loc. A |-- S1 -&gt;| Loc. E1 |-- S2 -&gt;| Loc. E2 |-- S5 -&gt;| Loc. B |
| | | | | | | |
| [Ba,Ca] |&lt;- R8 --| [Ba,Ca] |&lt;- R7 --| [<a href="#ref-Ba">Ba</a>] |&lt;- R6 --| [<a href="#ref-Ba">Ba</a>] |
o---------o o---------o o---------o o---------o
A |
| | o---------o
| +----- S3 -&gt;| Loc. C |
| | |
+--------- R4 --| [<a href="#ref-Ca">Ca</a>] |
o---------o
 
Example: Data collection
 
Locations A and B send files Ca and Cb to clearing centre E1,
which forwards both files to location C in a single Virtual File.
When it receives response R4 from C, clearing centre E1 sends
response R5 to location A and R6 to location B.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 32]
<a name="page-33"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
o---------o o---------o o---------o
| Loc. A |-- S1 -&gt;| Loc. E1 |-- S3 -&gt;| Loc. C |
| | | | | |
| [<a href="#ref-Ca">Ca</a>] |&lt;- R5 --| [Ca,Cb] |&lt;- R4 --| [Ca,Cb] |
o---------o o---------o o---------o
A |
o---------o | |
| Loc. B |-- S2 -----+ |
| | |
| [<a href="#ref-Cb">Cb</a>] |&lt;- R6 ---------+
o---------o
 
<a name="section-4.3.7">4.3.7</a>. Negative End Response (NERP)
 
In addition to the EERP, which allows control over successful
transmission of a file, a Negative End Response signals that a file
could not be delivered to the final destination or that the final
destination could not process the received file.
 
It may be created by an intermediate node that could not transmit the
file any further because the next node refuses to accept the file.
The cause of the refusal has to be non-temporary, otherwise the
intermediate node has to try the transmission again.
 
It may also be created by the final node that is unable to process
the file because of non-recoverable syntax or semantic errors in the
file, or because of the failure of any other processing performed on
the file.
 
The NERP will be sent back to the originator of the file.
 
The parameters are equal to the ones of the EERP, but with additional
information about the creator of the NERP and the abort reason.
Where the NERP is created due to a failure to transmit, the abort
reason is taken from the refusal reason that was sent by the node
refusing the file. Because of the NERP, it is possible for the
intermediate node to stop trying to send the non-deliverable file and
to delete the file.
 
The NERP allows the originator of the file to react to the
unsuccessful transmission or processing, depending on the reason code
and the creator of the NERP.
 
If the originator of the Virtual File requested a signed EERP in the
SFID, the NERP must be signed. Signing allows the originator of the
file to prove by whom the NERP was generated. If the location
 
 
 
 
 
Friend Informational [Page 33]
<a name="page-34"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
generating the NERP is unable to sign the NERP, it may send back an
unsigned NERP. It is an implementation issue to allow the acceptance
of an unsigned EERP if a signed NERP is requested.
 
<a name="section-4.3.8">4.3.8</a>. Ready To Receive Command (RTR)
 
In order to avoid congestion between two adjacent nodes caused by a
continuous flow of EERPs and NERPs, a Ready To Receive (RTR) command
is provided. The RTR acts as an EERP/NERP acknowledgement for flow
control but has no end-to-end significance.
 
Speaker -- EERP ------------&gt; Listener End to End Response
&lt;------------- RTR -- Ready to Receive
-- EERP ------------&gt; End to End Response
&lt;------------- RTR -- Ready to Receive
-- NERP ------------&gt; Negative End Response
&lt;------------- RTR -- Ready to Receive
-- SFID ------------&gt; Start File
or
-- CD --------------&gt; Exchange the turn
 
After sending an EERP or NERP, the Speaker must wait for an RTR
before sending any other commands. The only acceptable commands to
follow are:
 
EERP
NERP
SFID or CD (if there are no more EERPs or NERPs to be sent)
 
<a name="section-4.4">4.4</a>. Data Transfer Phase
 
Virtual File data flows from the Speaker to the Listener during the
Data Transfer phase, which is entered after the Start File phase.
 
<a name="section-4.4.1">4.4.1</a>. Protocol Sequence
 
To avoid congestion at the protocol level, a flow control mechanism
is provided via the Set Credit (CDT) command.
 
A Credit limit is negotiated in the Start Session phase; this
represents the number of Data Exchange Buffers that the Speaker may
send before it is obliged to wait for a Credit command from the
Listener.
 
The available credit is initially set to the negotiated value by the
Start File positive answer, which acts as an implicit Credit command.
The Speaker decreases the available credit count by one for each data
buffer sent to the Listener.
 
 
 
Friend Informational [Page 34]
<a name="page-35"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
When the available credit is exhausted, the Speaker must wait for a
Credit command from the Listener; otherwise, a protocol error will
occur and the session will be aborted.
 
The Listener should endeavour to send the Credit command without
delay to prevent the Speaker blocking.
 
<a name="section-1">1</a>. Speaker -- SFID ------------&gt; Listener Start File
&lt;------------ SFPA -- Answer YES
 
<a name="section-2">2</a>. If the credit value is set to 2
 
Speaker -- Data ------------&gt; Listener Start File
-- Data ------------&gt;
&lt;------------- CDT -- Set Credit
-- Data ------------&gt;
-- EFID ------------&gt; End File
 
<a name="section-4.5">4.5</a>. End File Phase
 
<a name="section-4.5.1">4.5.1</a>. Protocol Sequence
 
The Speaker notifies the Listener that it has finished sending a
Virtual File by sending an End File (EFID) command. The Listener
replies with a positive or negative End File command and has the
option to request a Change Direction command from the Speaker.
 
<a name="section-1">1</a>. Speaker -- EFID ------------&gt; Listener End File
&lt;------------ EFPA -- Answer YES
 
<a name="section-2">2</a>. Speaker -- EFID ------------&gt; Listener End File
&lt;------------ EFPA -- Answer YES + CD
-- CD --------------&gt; Change Direction
Listener &lt;------------ EERP -- Speaker End to End Response
-------------- RTR -&gt; Ready to Receive
Listener &lt;------------ NERP -- Speaker Negative End Response
-------------- RTR -&gt; Ready to Receive
Go to Start File Phase
 
<a name="section-3">3</a>. Speaker -- EFID ------------&gt; Listener End File
&lt;------------ EFNA -- Answer NO
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 35]
<a name="page-36"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-4.6">4.6</a>. End Session Phase
 
<a name="section-4.6.1">4.6.1</a>. Protocol Sequence
 
The Speaker terminates the session by sending an End Session (ESID)
command. The Speaker may only do this if the Listener has just
relinquished its role as speaker.
 
<a name="section-1">1</a>. Speaker -- EFID ------------&gt; Listener End File
&lt;------------ EFPA -- Answer YES
-- CD --------------&gt; Change Direction
Listener &lt;------------ ESID -- Speaker End Session
 
<a name="section-4.7">4.7</a>. Problem Handling
 
Error detection and handling should be done as close as possible to
the problem. This aids problem determination and correction. Each
layer of the reference model is responsible for its own error
handling.
 
ODETTE-FTP can detect protocol errors by virtue of its state machine
and uses activity timers to detect session hang conditions. These
mechanisms are separate from the End to End controls.
 
<a name="section-4.7.1">4.7.1</a>. Protocol Errors
 
If a protocol error occurs, the session will be terminated and
application activity aborted. Both locations enter the IDLE state.
 
<a name="section-4.7.2">4.7.2</a>. Timers
 
To protect against application and network hang conditions, ODETTE-
FTP uses activity timers for all situations where a response is
required. The timers and actions to be taken if they expire are
described in <a href="#section-9">Section 9</a>, "Protocol State Machine".
 
<a name="section-4.7.3">4.7.3</a>. Clearing Centres
 
The use of clearing centres introduces the possibility of errors
occurring as a result of data processing activities within the
centre. Such errors are not directly related to ODETTE-FTP or the
communication network and are therefore outside the scope of this
specification.
 
 
 
 
 
 
 
 
Friend Informational [Page 36]
<a name="page-37"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-5">5</a>. Commands and Formats
 
ODETTE-FTP entities communicate via Exchange Buffers. The Command
Exchange Buffers are described below. Virtual File data is carried
in Data Exchange Buffers, which are described in <a href="#section-7">Section 7</a>.
 
<a name="section-5.1">5.1</a>. Conventions
 
<a name="section-5.1.1">5.1.1</a>. Representation Unit
 
The basic unit of information is an octet, containing 8 bits.
 
<a name="section-5.1.2">5.1.2</a>. Values and Characters
 
The ISO 646 IRV 7-bit coded character set [<a href="#ref-ISO-646">ISO-646</a>], according to
Appendix B, is used to encode constants and strings within Command
Exchange Buffers except where [<a href="#ref-UTF-8">UTF-8</a>] is explicitly indicated against
a field.
 
<a name="section-5.2">5.2</a>. Commands
 
A Command Exchange Buffer contains a single command starting at the
beginning of the buffer. Commands and data are never mixed within an
Exchange Buffer. Commands cannot be compressed. Variable-length
parameters may be omitted entirely if not required and the associated
length indicator field set to zero.
 
Components:
 
<a name="section-1">1</a>. Command identifier:
 
The first octet of an Exchange Buffer is the Command Identifier
and defines the format of the buffer.
 
<a name="section-2">2</a>. Parameter(s):
 
Command parameters are stored in fields within a Command Exchange
Buffer. Where variable-length fields are used, they are preceded
with a header field indicating the length. All values are
required except where explicitly indicated.
 
<a name="section-5.3">5.3</a>. Command Formats
 
The ODETTE-FTP commands are described below using the following
definitions.
 
 
 
 
 
 
Friend Informational [Page 37]
<a name="page-38"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Position (Pos)
 
Field offset within the Command Exchange Buffer, relative to a
zero origin.
 
Field
 
The name of the field.
 
Description
 
A description of the field.
 
Format
 
F - A field containing fixed values. All allowable values for
the field are enumerated in the command definition.
 
V - A field with variable values within a defined range. For
example, the SFIDLRECL field may contain any integer value
between 00000 and 99999.
 
X(n) - An alphanumeric field of length n octets.
 
A String contains alphanumeric characters from the following
set:
 
The numerals: 0 to 9
The upper case letters: A to Z
The following special set: / - . &amp; ( ) space.
 
Space is not allowed as an embedded character.
 
9(n) - A numeric field of length n octets.
 
U(n) - A binary field of length n octets.
 
Numbers encoded as binary are always unsigned and in
network byte order.
 
T(n) - An field of length n octets, encoded using [<a href="#ref-UTF-8">UTF-8</a>].
 
String and alphanumeric fields are always left justified and right
padded with spaces where needed.
 
Numeric fields are always right justified and left padded with
zeros where needed.
 
 
 
 
Friend Informational [Page 38]
<a name="page-39"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Reserved fields should be padded with spaces.
 
<a name="section-5.3.1">5.3.1</a>. SSRM - Start Session Ready Message
 
o-------------------------------------------------------------------o
| SSRM Start Session Ready Message |
| |
| Start Session Phase Initiator &lt;---- Responder |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | SSRMCMD | SSRM Command, 'I' | F X(1) |
| 1 | SSRMMSG | Ready Message, 'ODETTE FTP READY ' | F X(17) |
| 18 | SSRMCR | Carriage Return | F X(1) |
o-------------------------------------------------------------------o
 
SSRMCMD Command Code Character
 
Value: 'I' SSRM Command identifier.
 
SSRMMSG Ready Message String(17)
 
Value: 'ODETTE FTP READY '
 
SSRMCR Carriage Return Character
 
Value: Character with hex value '0D' or '8D'.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 39]
<a name="page-40"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-5.3.2">5.3.2</a>. SSID - Start Session
 
o-------------------------------------------------------------------o
| SSID Start Session |
| |
| Start Session Phase Initiator &lt;---&gt; Responder |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | SSIDCMD | SSID Command 'X' | F X(1) |
| 1 | SSIDLEV | Protocol Release Level | F 9(1) |
| 2 | SSIDCODE | Initiator's Identification Code | V X(25) |
| 27 | SSIDPSWD | Initiator's Password | V X(8) |
| 35 | SSIDSDEB | Data Exchange Buffer Size | V 9(5) |
| 40 | SSIDSR | Send / Receive Capabilities (S/R/B) | F X(1) |
| 41 | SSIDCMPR | Buffer Compression Indicator (Y/N) | F X(1) |
| 42 | SSIDREST | Restart Indicator (Y/N) | F X(1) |
| 43 | SSIDSPEC | Special Logic Indicator (Y/N) | F X(1) |
| 44 | SSIDCRED | Credit | V 9(3) |
| 47 | SSIDAUTH | Secure Authentication (Y/N) | F X(1) |
| 48 | SSIDRSV1 | Reserved | F X(4) |
| 52 | SSIDUSER | User Data | V X(8) |
| 60 | SSIDCR | Carriage Return | F X(1) |
o-------------------------------------------------------------------o
 
SSIDCMD Command Code
Character
 
Value: 'X' SSID Command identifier.
 
SSIDLEV Protocol Release Level Numeric(1)
 
Used to specify the level of the ODETTE-FTP protocol
 
Value: '1' for Revision 1.2
'2' for Revision 1.3
'4' for Revision 1.4
'5' for Revision 2.0
 
Future release levels will have higher numbers. The
protocol release level is negotiable, with the lowest level
being selected.
 
Note: ODETTE File Transfer Protocol 1.3 (<a href="http://ietfdocs.potaroo.net/idref/rfc2204">RFC 2204</a>)
specifies '1' for the release level, despite adhering
to revision 1.3.
 
 
 
 
 
Friend Informational [Page 40]
<a name="page-41"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
SSIDCODE Initiator's Identification Code String(25)
 
Format: See Identification Code (<a href="#section-5.4">Section 5.4</a>)
 
Uniquely identifies the Initiator (sender) participating in
the ODETTE-FTP session.
 
It is an application implementation issue to link the
expected [<a href="#ref-X.509">X.509</a>] certificate to the SSIDCODE provided.
 
SSIDPSWD Initiator's Password String(8)
 
Key to authenticate the sender. Assigned by bilateral
agreement.
 
SSIDSDEB Data Exchange Buffer Size Numeric(5)
 
Minimum: 128
Maximum: 99999
 
The length, in octets, of the largest Data Exchange Buffer
that can be accepted by the location. The length includes
the command octet but does not include the Stream
Transmission Header.
 
After negotiation, the smallest size will be selected.
 
SSIDSR Send / Receive Capabilities Character
 
Value: 'S' Location can only send files.
'R' Location can only receive files.
'B' Location can both send and receive files.
 
Sending and receiving will be serialised during the
session, so parallel transmissions will not take place in
the same session.
 
An error occurs if adjacent locations both specify the send
or receive capability.
 
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 41]
<a name="page-42"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
SSIDCMPR Buffer Compression Indicator Character
 
Value: 'Y' The location can handle OFTP data buffer compression
'N' The location cannot handle OFTP buffer compression
 
Compression is only used if supported by both locations.
 
The compression mechanism referred to here applies to each
individual OFTP data buffer. This is different from the
file compression mechanism in OFTP, which involves the
compression of whole files.
 
SSIDREST Restart Indicator Character
 
Value: 'Y' The location can handle the restart of a partially
transmitted file.
'N' The location cannot restart a file.
 
SSIDSPEC Special Logic Indicator Character
 
Value: 'Y' Location can handle Special Logic
'N' Location cannot handle Special Logic
 
Special Logic is only used if supported by both locations.
 
The Special Logic extensions are only useful to access an
X.25 network via an asynchronous entry and are not
supported for TCP/IP connections.
 
SSIDCRED Credit Numeric(3)
 
Maximum: 999
 
The number of consecutive Data Exchange Buffers sent by the
Speaker before it must wait for a Credit (CDT) command from
the Listener.
 
The credit value is only applied to Data flow in the Data
Transfer phase.
 
The Speaker's available credit is initialised to SSIDCRED
when it receives a Start File Positive Answer (SFPA)
command from the Listener. It is zeroed by the End File
(EFID) command.
 
After negotiation, the smallest size must be selected in
the answer of the Responder, otherwise a protocol error
will abort the session.
 
 
 
Friend Informational [Page 42]
<a name="page-43"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Negotiation of the "credit-window-size" parameter.
 
Window Size m -- SSID ------------&gt;
&lt;------------ SSID -- Window Size n
(n less than or
equal to m)
Note: negotiated value will be "n".
 
SSIDAUTH Secure Authentication Character
 
Value: 'Y' The location requires secure authentication. 'N' The
location does not require secure authentication.
 
Secure authentication is only used if agreed by both
locations.
 
If the answer of the Responder does not match with the
authentication requirements of the Initiator, then the
Initiator must abort the session.
 
No negotiation of authentication is allowed.
 
authentication p -- SSID ------------&gt;
&lt;------------ SSID -- authentication q
 
p == q -&gt; continue.
p != q -&gt; abort.
 
SSIDRSV1 Reserved String(4)
 
This field is reserved for future use.
 
SSIDUSER User Data String(8)
 
May be used by ODETTE-FTP in any way. If unused, it should
be initialised to spaces. It is expected that a bilateral
agreement exists as to the meaning of the data.
 
SSIDCR Carriage Return Character
 
Value: Character with hex value '0D' or '8D'.
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 43]
<a name="page-44"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-5.3.3">5.3.3</a>. SFID - Start File
 
o-------------------------------------------------------------------o
| SFID Start File |
| |
| Start File Phase Speaker ----&gt; Listener |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | SFIDCMD | SFID Command, 'H' | F X(1) |
| 1 | SFIDDSN | Virtual File Dataset Name | V X(26) |
| 27 | SFIDRSV1 | Reserved | F X(3) |
| 30 | SFIDDATE | Virtual File Date stamp, (CCYYMMDD) | V 9(8) |
| 38 | SFIDTIME | Virtual File Time stamp, (HHMMSScccc) | V 9(10) |
| 48 | SFIDUSER | User Data | V X(8) |
| 56 | SFIDDEST | Destination | V X(25) |
| 81 | SFIDORIG | Originator | V X(25) |
| 106 | SFIDFMT | File Format (F/V/U/T) | F X(1) |
| 107 | SFIDLRECL | Maximum Record Size | V 9(5) |
| 112 | SFIDFSIZ | File Size, 1K blocks | V 9(13) |
| 125 | SFIDOSIZ | Original File Size, 1K blocks | V 9(13) |
| 138 | SFIDREST | Restart Position | V 9(17) |
| 155 | SFIDSEC | Security Level | F 9(2) |
| 157 | SFIDCIPH | Cipher suite selection | F 9(2) |
| 159 | SFIDCOMP | File compression algorithm | F 9(1) |
| 160 | SFIDENV | File enveloping format | F 9(1) |
| 161 | SFIDSIGN | Signed EERP request | F X(1) |
| 162 | SFIDDESCL | Virtual File Description length | V 9(3) |
| 165 | SFIDDESC | Virtual File Description | V T(n) |
o-------------------------------------------------------------------o
 
SFIDCMD Command Code Character
 
Value: 'H' SFID Command identifier.
 
SFIDDSN Virtual File Dataset Name String(26)
 
Dataset name of the Virtual File being transferred,
assigned by bilateral agreement.
 
No general structure is defined for this attribute.
 
See Virtual Files - Identification (<a href="#section-1.5.2">Section 1.5.2</a>)
 
SFIDRSV1 Reserved String(3)
 
This field is reserved for future use.
 
 
 
 
Friend Informational [Page 44]
<a name="page-45"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
SFIDDATE Virtual File Date stamp Numeric(8)
 
Format: 'CCYYMMDD' 8 decimal digits representing the century,
year, month, and day.
 
Date stamp assigned by the Virtual File's Originator
indicating when the file was made available for
transmission.
 
See Virtual Files - Identification (<a href="#section-1.5.2">Section 1.5.2</a>)
 
SFIDTIME Virtual File Time stamp Numeric(10)
 
Format: 'HHMMSScccc' 10 decimal digits representing hours,
minutes, seconds, and a counter (0001-9999), which gives
higher resolution.
 
Time stamp assigned by the Virtual File's Originator
indicating when the file was made available for
transmission.
 
See Virtual Files - Identification (<a href="#section-1.5.2">Section 1.5.2</a>)
 
SFIDUSER User Data String(8)
 
May be used by ODETTE-FTP in any way. If unused, it should
be initialised to spaces. It is expected that a bilateral
agreement exists as to the meaning of the data.
 
SFIDDEST Destination String(25)
 
Format: See Identification Code (<a href="#section-5.4">Section 5.4</a>)
 
The Final Recipient of the Virtual File.
 
This is the location that will look into the Virtual File
content and perform mapping functions. It is also the
location that creates the End to End Response (EERP)
command for the received file.
 
SFIDORIG Originator String(25)
 
Format: See Identification Code (<a href="#section-5.4">Section 5.4</a>)
 
Originator of the Virtual File.
 
It is the location that created (mapped) the data for
transmission.
 
 
 
Friend Informational [Page 45]
<a name="page-46"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
SFIDFMT File Format Character
 
Value: 'F' Fixed format binary file
'V' Variable format binary file
'U' Unstructured binary file
'T' Text
 
Virtual File format. Used to calculate the restart
position (<a href="#section-1.5.4">Section 1.5.4</a>).
 
Once a file has been signed, compressed, and/or encrypted,
in file format terms it becomes unstructured, format U.
The record boundaries are no longer discernable until the
file is decrypted, decompressed, and/or verified. SFID
File Format Field in this scenario indicates the format of
the original file, and the transmitted file must be treated
as U format.
 
SFIDLRECL Maximum Record Size Numeric(5)
 
Maximum: 99999
 
Length in octets of the longest logical record that may be
transferred to a location. Only user data is included.
 
If SFIDFMT is 'T' or 'U', then this attribute must be set
to '00000'.
 
If SFIDFMT is 'V' and the file is compressed, encrypted, or
signed, then the maximum value of SFIDRECL is '65536'.
 
SFIDFSIZ Transmitted File Size Numeric(13)
 
Maximum: 9999999999999
 
Space in 1K (1024 octet) blocks required at the Originator
location to store the actual Virtual File that is to be
transmitted.
 
For example, if a file is compressed before sending, then
this is the space required to store the compressed file.
 
This parameter is intended to provide only a good estimate
of the Virtual File size.
 
Using 13 digits allows for a maximum file size of
approximately 9.3 PB (petabytes) to be transmitted.
 
 
 
 
Friend Informational [Page 46]
<a name="page-47"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
SFIDOSIZ Original File Size Numeric(13)
 
Maximum: 9999999999999
 
Space in 1K (1024 octet) blocks required at the Originator
location to store the original before it was signed,
compressed, and/or encrypted.
 
If no security or compression services have been used,
SFIDOSIZ should contain the same value as SFIDFSIZ.
 
If the original file size is not known, the value zero
should be used.
 
This parameter is intended to provide only a good estimate
of the original file size.
 
The sequence of events in file exchange are:
 
(a) raw data file ready to be sent
SFIDOSIZ = Original File Size
 
(b) signing/compression/encryption
 
(c) transmission
SFIDFSIZ = Transmitted File Size
 
(d) decryption/decompression/verification
 
(e) received raw data file for in-house applications
SFIDOSIZ = Original File Size
 
The Transmitted File Size at (c) indicates to the receiver
how much storage space is needed to receive the file.
 
The Original File Size at (e) indicates to the in-house
application how much storage space is needed to process the
file.
 
 
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 47]
<a name="page-48"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
SFIDREST Restart Position Numeric(17)
 
Maximum: 99999999999999999
 
Virtual File restart position.
 
The count represents the:
- Record Number if SSIDFMT is 'F' or 'V'.
- File offset in 1K (1024 octet) blocks if SFIDFMT is
'U' or 'T'.
 
The count will express the transmitted user data (i.e.,
before ODETTE-FTP buffer compression, header not included).
 
After negotiation between adjacent locations,
retransmission will start at the lowest value.
 
Once a file has been signed, compressed, and/or encrypted,
in file format terms, it has become unstructured, like
format U. The file should be treated as format U for the
purposes of restart, regardless of the actual value in
SFIDFMT.
 
SFIDSEC Security Level Numeric(2)
 
Value: '00' No security services
'01' Encrypted
'02' Signed
'03' Encrypted and signed
 
Indicates whether the file has been signed and/or encrypted
before transmission. (See <a href="#section-6.2">Section 6.2</a>.)
 
SFIDCIPH Cipher suite selection Numeric(2)
 
Value: '00' No security services
'01' See <a href="#section-10.2">Section 10.2</a>
 
Indicates the cipher suite used to sign and/or encrypt the
file and also to indicate the cipher suite that should be
used when a signed EERP or NERP is requested.
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 48]
<a name="page-49"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
SFIDCOMP File compression algorithm Numeric(1)
 
Value: '0' No compression
'1' Compressed with [<a href="#ref-ZLIB">ZLIB</a>] algorithm
 
Indicates the algorithm used to compress the file.
(See <a href="#section-6.4">Section 6.4</a>.)
 
SFIDENV File enveloping format Numeric(1)
 
Value: '0' No envelope
'1' File is enveloped using [<a href="#ref-CMS">CMS</a>]
 
Indicates the enveloping format used in the file.
 
If the file is encrypted/signed/compressed or is an
enveloped file for the exchange and revocation of
certificates, this field must be set accordingly.
 
SFIDSIGN Signed EERP request Character
 
Value: 'Y' The EERP returned in acknowledgement of the file
must be signed
'N' The EERP must not be signed
 
Requests whether the EERP returned for the file must be
signed.
 
SFIDDESCL Virtual File Description length Numeric(3)
 
Length in octets of the field SFIDDESC.
 
A value of 0 indicates that no description is present.
 
SFIDDESC Virtual File Description [<a href="#ref-UTF-8">UTF-8</a>](n)
 
May be used by ODETTE-FTP in any way. If not used,
SFIDDESCL should be set to zero.
 
No general structure is defined for this attribute, but it
is expected that a bilateral agreement exists as to the
meaning of the data.
 
It is encoded using [<a href="#ref-UTF-8">UTF-8</a>] to support a range of national
languages.
 
Maximum length of the encoded value is 999 octets.
 
 
 
 
Friend Informational [Page 49]
<a name="page-50"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-5.3.4">5.3.4</a>. SFPA - Start File Positive Answer
 
o-------------------------------------------------------------------o
| SFPA Start File Positive Answer |
| |
| Start File Phase Speaker &lt;---- Listener |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | SFPACMD | SFPA Command, '2' | F X(1) |
| 1 | SFPAACNT | Answer Count | V 9(17) |
o-------------------------------------------------------------------o
 
SFPACMD Command Code Character
 
Value: '2' SFPA Command identifier.
 
SFPAACNT Answer Count Numeric(17)
 
The Listener must enter a count lower than or equal to the
restart count specified by the Speaker in the Start File
(SFID) command. The count expresses the received user
data. If restart facilities are not available, a count of
zero must be specified.
 
<a name="section-5.3.5">5.3.5</a>. SFNA - Start File Negative Answer
 
o-------------------------------------------------------------------o
| SFNA Start File Negative Answer |
| |
| Start File Phase Speaker &lt;---- Listener |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | SFNACMD | SFNA Command, '3' | F X(1) |
| 1 | SFNAREAS | Answer Reason | F 9(2) |
| 3 | SFNARRTR | Retry Indicator, (Y/N) | F X(1) |
| 4 | SFNAREASL | Answer Reason Text Length | V 9(3) |
| 7 | SFNAREAST | Answer Reason Text | V T(n) |
o-------------------------------------------------------------------o
 
SFNACMD Command Code Character
 
Value: '3' SFNA Command identifier.
 
 
 
 
 
 
 
Friend Informational [Page 50]
<a name="page-51"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
SFNAREAS Answer Reason Numeric(2)
 
Value: '01' Invalid filename.
'02' Invalid destination.
'03' Invalid origin.
'04' Storage record format not supported.
'05' Maximum record length not supported.
'06' File size is too big.
'10' Invalid record count.
'11' Invalid byte count.
'12' Access method failure.
'13' Duplicate file.
'14' File direction refused.
'15' Cipher suite not supported.
'16' Encrypted file not allowed.
'17' Unencrypted file not allowed.
'18' Compression not allowed.
'19' Signed file not allowed.
'20' Unsigned file not allowed.
'99' Unspecified reason.
 
Reason why transmission cannot proceed.
 
SFNARRTR Retry Indicator Character
 
Value: 'N' Transmission should not be retried.
'Y' The transmission may be retried later.
 
This parameter is used to advise the Speaker if it should
retry at a later time due to a temporary condition at the
Listener site, such as a lack of storage space. It should
be used in conjunction with the Answer Reason code
(SFNAREAS).
 
An invalid file name error code may be the consequence of a
problem in the mapping of the Virtual File on to a real
file. Such problems cannot always be resolved immediately.
It is therefore recommended that when an SFNA with Retry =
Y is received the User Monitor attempts to retransmit the
relevant file in a subsequent session.
 
SFNAREASL Answer Reason Text Length Numeric(3)
 
Length in octets of the field SFNAREAST.
 
<a name="section-0">0</a> indicates that no SFNAREAST field follows.
 
 
 
 
 
Friend Informational [Page 51]
<a name="page-52"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
SFNAREAST Answer Reason Text [<a href="#ref-UTF-8">UTF-8</a>](n)
 
Reason why transmission cannot proceed in plain text.
 
It is encoded using [<a href="#ref-UTF-8">UTF-8</a>].
 
Maximum length of the encoded reason is 999 octets.
 
No general structure is defined for this attribute.
 
<a name="section-5.3.6">5.3.6</a>. DATA - Data Exchange Buffer
 
o-------------------------------------------------------------------o
| DATA Data Exchange Buffer |
| |
| Data Transfer Phase Speaker ----&gt; Listener |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | DATACMD | DATA Command, 'D' | F X(1) |
| 1 | DATABUF | Data Exchange Buffer payload | V U(n) |
o-------------------------------------------------------------------o
 
DATACMD Command Code Character
 
Value: 'D' DATA Command identifier.
 
DATABUF Data Exchange Buffer payload Binary(n)
 
Variable-length buffer containing the data payload. The
Data Exchange Buffer is described in <a href="#section-7">Section 7</a>.
 
<a name="section-5.3.7">5.3.7</a>. CDT - Set Credit
 
o-------------------------------------------------------------------o
| CDT Set Credit |
| |
| Data Transfer Phase Speaker &lt;---- Listener |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | CDTCMD | CDT Command, 'C' | F X(1) |
| 1 | CDTRSV1 | Reserved | F X(2) |
o-------------------------------------------------------------------o
 
CDTCMD Command Code Character
 
Value: 'C' CDT Command identifier.
 
 
 
Friend Informational [Page 52]
<a name="page-53"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
CDTRSV1 Reserved String(2)
 
This field is reserved for future use.
 
<a name="section-5.3.8">5.3.8</a>. EFID - End File
 
o-------------------------------------------------------------------o
| EFID End File |
| |
| End File Phase Speaker ----&gt; Listener |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | EFIDCMD | EFID Command, 'T' | F X(1) |
| 1 | EFIDRCNT | Record Count | V 9(17) |
| 18 | EFIDUCNT | Unit Count | V 9(17) |
o-------------------------------------------------------------------o
 
EFIDCMD Command Code Character
 
Value: 'T' EFID Command identifier.
 
EFIDRCNT Record Count Numeric(17)
 
Maximum: 99999999999999999
 
For SSIDFMT 'F' or 'V', the exact record count.
For SSIDFMT 'U' or 'T', zeros.
 
The count will express the real size of the file (before
buffer compression, header not included). The total count
is always used, even during restart processing.
 
EFIDUCNT Unit Count Numeric(17)
 
Maximum: 99999999999999999
 
Exact number of units (octets) transmitted.
 
The count will express the real size of the file. The
total count is always used, even during restart processing.
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 53]
<a name="page-54"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-5.3.9">5.3.9</a>. EFPA - End File Positive Answer
 
o-------------------------------------------------------------------o
| EFPA End File Positive Answer |
| |
| End File Phase Speaker &lt;---- Listener |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | EFPACMD | EFPA Command, '4' | F X(1) |
| 1 | EFPACD | Change Direction Indicator, (Y/N) | F X(1) |
o-------------------------------------------------------------------o
 
EFPACMD Command Code Character
 
Value: '4' EFPA Command identifier.
 
EFPACD Change Direction Indicator Character
 
Value: 'N' Change direction not requested.
'Y' Change direction requested.
 
This parameter allows the Listener to request a Change
Direction (CD) command from the Speaker.
 
<a name="section-5.3.10">5.3.10</a>. EFNA - End File Negative Answer
 
o-------------------------------------------------------------------o
| EFNA End File Negative Answer |
| |
| End File Phase Speaker &lt;---- Listener |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | EFNACMD | EFNA Command, '5' | F X(1) |
| 1 | EFNAREAS | Answer Reason | F 9(2) |
| 3 | EFNAREASL | Answer Reason Text Length | V 9(3) |
| 6 | EFNAREAST | Answer Reason Text | V T(n) |
o-------------------------------------------------------------------o
 
EFNACMD Command Code Character
 
Value: '5' EFNA Command identifier.
 
 
 
 
 
 
 
 
Friend Informational [Page 54]
<a name="page-55"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
EFNAREAS Answer Reason Numeric(2)
 
Value: '01' Invalid filename.
'02' Invalid destination.
'03' Invalid origin.
'04' Storage record format not supported.
'05' Maximum record length not supported.
'06' File size is too big.
'10' Invalid record count.
'11' Invalid byte count.
'12' Access method failure.
'13' Duplicate file.
'14' File direction refused.
'15' Cipher suite not supported.
'16' Encrypted file not allowed.
'17' Unencrypted file not allowed.
'18' Compression not allowed.
'19' Signed file not allowed.
'20' Unsigned file not allowed.
'21' Invalid file signature.
'22' File decryption failure.
'23' File decompression failure.
'99' Unspecified reason.
 
Reason why transmission failed.
 
EFNAREASL Answer Reason Text Length Numeric(3)
 
Length in octets of the field EFNAREAST.
 
<a name="section-0">0</a> indicates that no EFNAREAST field follows.
 
EFNAREAST Answer Reason Text [<a href="#ref-UTF-8">UTF-8</a>](n)
 
Reason why transmission failed in plain text.
 
It is encoded using [<a href="#ref-UTF-8">UTF-8</a>].
 
Maximum length of the encoded reason is 999 octets.
 
No general structure is defined for this attribute.
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 55]
<a name="page-56"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-5.3.11">5.3.11</a>. ESID - End Session
 
o-------------------------------------------------------------------o
| ESID End Session |
| |
| End Session Phase Speaker ----&gt; Listener |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | ESIDCMD | ESID Command, 'F' | F X(1) |
| 1 | ESIDREAS | Reason Code | F 9(2) |
| 3 | ESIDREASL | Reason Text Length | V 9(3) |
| 6 | ESIDREAST | Reason Text | V T(n) |
| | ESIDCR | Carriage Return | F X(1) |
o-------------------------------------------------------------------o
 
ESIDCMD Command Code Character
 
Value: 'F' ESID Command identifier.
 
ESIDREAS Reason Code Numeric(2)
 
Value: '00' Normal session termination
 
'01' Command not recognised
 
An Exchange Buffer contains an invalid command code
(1st octet of the buffer).
 
'02' Protocol violation
 
An Exchange Buffer contains an invalid command for
the current state of the receiver.
 
'03' User code not known
 
A Start Session (SSID) command contains an unknown or
invalid Identification Code.
 
'04' Invalid password
 
A Start Session (SSID) command contained an invalid
password.
 
'05' Local site emergency close down
 
The local site has entered an emergency close down
mode. Communications are being forcibly terminated.
 
 
 
Friend Informational [Page 56]
<a name="page-57"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
'06' Command contained invalid data
 
A field within a Command Exchange Buffer contains
invalid data.
 
'07' Exchange Buffer size error
 
The length of the Exchange Buffer as determined by
the Stream Transmission Header differs from the
length implied by the Command Code.
 
'08' Resources not available
 
The request for connection has been denied due to a
resource shortage. The connection attempt should be
retried later.
 
'09' Time out
 
'10' Mode or capabilities incompatible
 
'11' Invalid challenge response
 
'12' Secure authentication requirements incompatible
 
'99' Unspecified Abort code
 
An error was detected for which no specific code is
defined.
 
ESIDREASL Reason Text Length Numeric(3)
 
Length in octets of the field ESIDREAST.
 
<a name="section-0">0</a> indicates that no ESIDREAST field is present.
 
ESIDREAST Reason Text [<a href="#ref-UTF-8">UTF-8</a>](n)
 
Reason why session ended in plain text.
 
It is encoded using [<a href="#ref-UTF-8">UTF-8</a>].
 
Maximum length of the encoded reason is 999 octets.
 
No general structure is defined for this attribute.
 
 
 
 
 
 
Friend Informational [Page 57]
<a name="page-58"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
ESIDCR Carriage Return Character
 
Value: Character with hex value '0D' or '8D'.
 
<a name="section-5.3.12">5.3.12</a>. CD - Change Direction
 
o-------------------------------------------------------------------o
| CD Change Direction |
| |
| Start File Phase Speaker ----&gt; Listener |
| End File Phase Speaker ----&gt; Listener |
| End Session Phase Initiator &lt;---&gt; Responder |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | CDCMD | CD Command, 'R' | F X(1) |
o-------------------------------------------------------------------o
 
CDCMD Command Code Character
 
Value: 'R' CD Command identifier.
 
<a name="section-5.3.13">5.3.13</a>. EERP - End to End Response
 
o-------------------------------------------------------------------o
| EERP End to End Response |
| |
| Start File Phase Speaker ----&gt; Listener |
| End File Phase Speaker ----&gt; Listener |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | EERPCMD | EERP Command, 'E' | F X(1) |
| 1 | EERPDSN | Virtual File Dataset Name | V X(26) |
| 27 | EERPRSV1 | Reserved | F X(3) |
| 30 | EERPDATE | Virtual File Date stamp, (CCYYMMDD) | V 9(8) |
| 38 | EERPTIME | Virtual File Time stamp, (HHMMSScccc) | V 9(10) |
| 48 | EERPUSER | User Data | V X(8) |
| 56 | EERPDEST | Destination | V X(25) |
| 81 | EERPORIG | Originator | V X(25) |
| 106 | EERPHSHL | Virtual File hash length | V U(2) |
| 108 | EERPHSH | Virtual File hash | V U(n) |
| | EERPSIGL | EERP signature length | V U(2) |
| | EERPSIG | EERP signature | V U(n) |
o-------------------------------------------------------------------o
 
 
 
 
 
 
Friend Informational [Page 58]
<a name="page-59"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
EERPCMD Command Code Character
 
Value: 'E' EERP Command identifier.
 
EERPDSN Virtual File Dataset Name String(26)
 
Dataset name of the Virtual File being transferred,
assigned by bilateral agreement.
 
No general structure is defined for this attribute.
 
See Virtual Files - Identification (<a href="#section-1.5.2">Section 1.5.2</a>)
 
EERPRSV1 Reserved String(3)
 
This field is reserved for future use.
 
EERPDATE Virtual File Date stamp Numeric(8)
 
Format: 'CCYYMMDD' 8 decimal digits representing the century,
year, month, and day, respectively.
 
Date stamp assigned by the Virtual File's Originator
indicating when the file was made available for
transmission.
 
See Virtual Files - Identification (<a href="#section-1.5.2">Section 1.5.2</a>)
 
EERPTIME Virtual File Time stamp Numeric(10)
 
Format: 'HHMMSScccc' 10 decimal digits representing hours,
minutes, seconds, and a counter (0001-9999), which gives
higher resolution.
 
Time stamp assigned by the Virtual File's Originator
indicating when the file was made available for
transmission.
 
See Virtual Files - Identification (<a href="#section-1.5.2">Section 1.5.2</a>)
 
EERPUSER User Data String(8)
 
May be used by ODETTE-FTP in any way. If unused, it should
be initialised to spaces. It is expected that a bilateral
agreement exists as to the meaning of the data.
 
 
 
 
 
 
Friend Informational [Page 59]
<a name="page-60"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
EERPDEST Destination String(25)
 
Format: See Identification Code (<a href="#section-5.4">Section 5.4</a>)
 
Originator of the Virtual File.
 
This is the location that created the data for
transmission.
 
EERPORIG Originator String(25)
 
Format: See Identification Code (<a href="#section-5.4">Section 5.4</a>)
 
Final Recipient of the Virtual File.
 
This is the location that will look into the Virtual File
content and process it accordingly. It is also the
location that creates the EERP for the received file.
 
EERPHSHL Virtual File hash length Binary(2)
 
Length in octets of the field EERPHSH.
 
A binary value of 0 indicates that no hash is present.
This is always the case if the EERP is not signed.
 
EERPHSH Virtual File hash Binary(n)
 
Hash of the transmitted Virtual File, i.e., not the hash of
the original file.
 
The algorithm used is determined by the bilaterally agreed
cipher suite specified in the SFIDCIPH.
 
It is an application implementation issue to validate the
EERPHSH to ensure that the EERP is acknowledging the exact
same file as was originally transmitted.
 
EERPSIGL EERP signature length Binary(2)
 
<a name="section-0">0</a> indicates that this EERP has not been signed.
 
Any other value indicates the length of EERPSIG in octets
and indicates that this EERP has been signed.
 
 
 
 
 
 
 
Friend Informational [Page 60]
<a name="page-61"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
EERPSIG EERP signature Binary(n)
 
Contains the [<a href="#ref-CMS">CMS</a>] enveloped signature of the EERP.
 
Signature = Sign{EERPDSN
EERPDATE
EERPTIME
EERPDEST
EERPORIG
EERPHSH}
 
Each field is taken in its entirety, including any padding.
The envelope must contain the original data, not just the
signature.
 
The [<a href="#ref-CMS">CMS</a>] content type used is SignedData.
 
The encapsulated content type used is id-data.
 
It is an application issue to validate the signature with
the contents of the EERP.
 
<a name="section-5.3.14">5.3.14</a>. NERP - Negative End Response
 
o-------------------------------------------------------------------o
| NERP Negative End Response |
| |
| Start File Phase Speaker ----&gt; Listener |
| End File Phase Speaker ----&gt; Listener |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | NERPCMD | NERP Command, 'N' | F X(1) |
| 1 | NERPDSN | Virtual File Dataset Name | V X(26) |
| 27 | NERPRSV1 | Reserved | F X(6) |
| 33 | NERPDATE | Virtual File Date stamp, (CCYYMMDD) | V 9(8) |
| 41 | NERPTIME | Virtual File Time stamp, (HHMMSScccc) | V 9(10) |
| 51 | NERPDEST | Destination | V X(25) |
| 76 | NERPORIG | Originator | V X(25) |
| 101 | NERPCREA | Creator of NERP | V X(25) |
| 126 | NERPREAS | Reason code | F 9(2) |
| 128 | NERPREASL | Reason text length | V 9(3) |
| 131 | NERPREAST | Reason text | V T(n) |
| | NERPHSHL | Virtual File hash length | V U(2) |
| | NERPHSH | Virtual File hash | V U(n) |
| | NERPSIGL | NERP signature length | V U(2) |
| | NERPSIG | NERP signature | V U(n) |
o-------------------------------------------------------------------o
 
 
 
Friend Informational [Page 61]
<a name="page-62"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
NERPCMD Command Code Character
 
Value: 'N' NERP Command identifier.
 
NERPDSN Virtual File Dataset Name String(26)
 
Dataset name of the Virtual File being transferred,
assigned by bilateral agreement.
 
No general structure is defined for this attribute.
 
See Virtual Files - Identification (<a href="#section-1.5.2">Section 1.5.2</a>)
 
NERPRSV1 Reserved String(6)
 
This field is reserved for future use.
 
NERPDATE Virtual File Date stamp Numeric(8)
 
Format: 'CCYYMMDD' 8 decimal digits representing the century,
year, month, and day, respectively.
 
Date stamp assigned by the Virtual File's Originator
indicating when the file was made available for
transmission.
 
See Virtual Files - Identification (<a href="#section-1.5.2">Section 1.5.2</a>)
 
NERPTIME Virtual File Time stamp Numeric(10)
 
Format: 'HHMMSScccc' 10 decimal digits representing hours,
minutes, seconds, and a counter (0001-9999), which gives
higher resolution.
 
Time stamp assigned by the Virtual File's Originator
indicating when the file was made available for
transmission.
 
See Virtual Files - Identification (<a href="#section-1.5.2">Section 1.5.2</a>)
 
NERPDEST Destination String(25)
 
Format: See Identification Code (<a href="#section-5.4">Section 5.4</a>)
 
Originator of the Virtual File.
 
This is the location that created the data for
transmission.
 
 
 
Friend Informational [Page 62]
<a name="page-63"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
NERPORIG Originator String(25)
 
Format: See Identification Code (<a href="#section-5.4">Section 5.4</a>)
 
The Final Recipient of the Virtual File.
 
This is the location that will look into the Virtual File
content and perform mapping functions.
 
NERPCREA Creator of the NERP String(25)
 
Format: See Identification Code (<a href="#section-5.4">Section 5.4</a>)
 
It is the location that created the NERP.
 
NERPREAS Reason code Numeric(2)
 
This attribute will specify why transmission cannot proceed
or why processing of the file failed.
 
"SFNA(RETRY=N)" below should be interpreted as "EFNA or
SFNA(RETRY=N)" where appropriate.
 
Value '03' ESID received with reason code '03'
(user code not known)
'04' ESID received with reason code '04'
(invalid password)
'09' ESID received with reason code '99'
(unspecified reason)
'11' SFNA(RETRY=N) received with reason code '01'
(invalid file name)
'12' SFNA(RETRY=N) received with reason code '02'
(invalid destination)
'13' SFNA(RETRY=N) received with reason code '03'
(invalid origin)
'14' SFNA(RETRY=N) received with reason code '04'
(invalid storage record format)
'15' SFNA(RETRY=N) received with reason code '05'
(maximum record length not supported)
'16' SFNA(RETRY=N) received with reason code '06'
(file size too big)
'20' SFNA(RETRY=N) received with reason code '10'
(invalid record count)
'21' SFNA(RETRY=N) received with reason code '11'
(invalid byte count)
'22' SFNA(RETRY=N) received with reason code '12'
(access method failure)
 
 
 
 
Friend Informational [Page 63]
<a name="page-64"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
'23' SFNA(RETRY=N) received with reason code '13'
(duplicate file)
'24' SFNA(RETRY=N) received with reason code '14'
(file direction refused)
'25' SFNA(RETRY=N) received with reason code '15'
(cipher suite not supported)
'26' SFNA(RETRY=N) received with reason code '16'
(encrypted file not allowed)
'27' SFNA(RETRY=N) received with reason code '17'
(unencrypted file not allowed)
'28' SFNA(RETRY=N) received with reason code '18'
(compression not allowed)
'29' SFNA(RETRY=N) received with reason code '19'
(signed file not allowed)
'30' SFNA(RETRY=N) received with reason code '20'
(unsigned file not allowed)
'31' File signature not valid.
'32' File decompression failed.
'33' File decryption failed.
'34' File processing failed.
'35' Not delivered to recipient.
'36' Not acknowledged by recipient.
'50' Transmission stopped by the operator.
'90' File size incompatible with recipient's
protocol version.
'99' Unspecified reason.
 
NERPREASL Reason Text Length Numeric(3)
 
Length in octets of the field NERPREAST.
 
<a name="section-0">0</a> indicates that no NERPREAST field follows.
 
NERPREAST Reason Text [<a href="#ref-UTF-8">UTF-8</a>](n)
 
Reason why transmission cannot proceed in plain text.
 
It is encoded using [<a href="#ref-UTF-8">UTF-8</a>].
 
Maximum length of the encoded reason is 999 octets.
 
No general structure is defined for this attribute.
 
 
 
 
 
 
 
 
 
Friend Informational [Page 64]
<a name="page-65"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
NERPHSHL Virtual File hash length Binary(2)
 
Length in octets of the field NERPHSH.
 
A binary value of 0 indicates that no hash is present.
This is always the case if the NERP is not signed.
 
NERPHSH Virtual File hash Binary(n)
 
Hash of the Virtual File being transmitted.
 
The algorithm used is determined by the bilaterally agreed
cipher suite specified in the SFIDCIPH.
 
NERPSIGL NERP Signature length Binary(2)
 
<a name="section-0">0</a> indicates that this NERP has not been signed.
 
Any other value indicates the length of NERPSIG in octets
and indicates that this NERP has been signed.
 
NERPSIG NERP Signature Binary(n)
 
Contains the [<a href="#ref-CMS">CMS</a>] enveloped signature of the NERP.
 
Signature = Sign{NERPDSN
NERPDATE
NERPTIME
NERPDEST
NERPORIG
NERPCREA
NERPHSH}
 
Each field is taken in its entirety, including any padding.
The envelope must contain the original data, not just the
signature.
 
The [<a href="#ref-CMS">CMS</a>] content type used is SignedData.
 
The encapsulated content type used is id-data.
 
It is an application issue to validate the signature with
the contents of the NERP.
 
 
 
 
 
 
 
 
Friend Informational [Page 65]
<a name="page-66"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-5.3.15">5.3.15</a>. RTR - Ready To Receive
 
o-------------------------------------------------------------------o
| RTR Ready To Receive |
| |
| Start File Phase Initiator &lt;---- Responder |
| End File Phase Initiator &lt;---- Responder |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | RTRCMD | RTR Command, 'P' | F X(1) |
o-------------------------------------------------------------------o
 
RTRCMD Command Code Character
 
Value: 'P' RTR Command identifier.
 
<a name="section-5.3.16">5.3.16</a>. SECD - Security Change Direction
 
o-------------------------------------------------------------------o
| SECD Security Change Direction |
| |
| Start Session Phase Initiator &lt;---&gt; Responder |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | SECDCMD | SECD Command, 'J' | F X(1) |
o-------------------------------------------------------------------o
 
SECDCMD Command Code Character
 
Value: 'J' SECD Command identifier.
 
<a name="section-5.3.17">5.3.17</a>. AUCH - Authentication Challenge
 
o-------------------------------------------------------------------o
| AUCH Authentication Challenge |
| |
| Start Session Phase Initiator &lt;---&gt; Responder |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | AUCHCMD | AUCH Command, 'A' | F X(1) |
| 1 | AUCHCHLL | Challenge Length | V U(2) |
| 3 | AUCHCHAL | Challenge | V U(n) |
o-------------------------------------------------------------------o
 
 
 
 
 
Friend Informational [Page 66]
<a name="page-67"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
AUCHCMD Command Code Character
 
Value: 'A' AUCH Command identifier.
 
AUCHCHLL Challenge length Binary(2)
 
Indicates the length of AUCHCHAL in octets.
 
The length is expressed as an unsigned binary number using
network byte order.
 
AUCHCHAL Challenge Binary(n)
 
A [<a href="#ref-CMS">CMS</a>] encrypted 20-byte random number uniquely generated
each time an AUCH is sent.
 
NOTE:
 
Any encryption algorithm that is available through a defined cipher
suite (<a href="#section-10.2">Section 10.2</a>) may be used. See <a href="#section-10.1">Section 10.1</a> regarding the
choice of a cipher suite.
 
<a name="section-5.3.18">5.3.18</a>. AURP - Authentication Response
 
o-------------------------------------------------------------------o
| AURP Authentication Response |
| |
| Start Session Phase Initiator &lt;---&gt; Responder |
|-------------------------------------------------------------------|
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | AURPCMD | AURP Command, 'S' | F X(1) |
| 1 | AURPRSP | Response | V U(20) |
o-------------------------------------------------------------------o
 
AURPCMD Command Code Character
 
Value: 'S' AURP Command identifier.
 
AURPRSP Response Binary(20)
 
Contains the decrypted challenge (AUCHCHAL).
 
 
 
 
 
 
 
 
 
Friend Informational [Page 67]
<a name="page-68"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
IMPORTANT:
 
It is an application implementation issue to validate a received AURP
to ensure that the response matches the challenge. This validation
is extremely important to ensure that a party is correctly
authenticated.
 
<a name="section-5.4">5.4</a>. Identification Code
 
The Initiator (sender) and Responder (receiver) participating in an
ODETTE-FTP session are uniquely identified by an Identification Code
based on [<a href="#ref-ISO-6523">ISO-6523</a>], Structure for the Identification of
Organisations (SIO). The locations are considered to be adjacent for
the duration of the transmission.
 
The SIO has the following format.
 
o-------------------------------------------------------------------o
| Pos | Field | Description | Format |
|-----+-----------+---------------------------------------+---------|
| 0 | SIOOID | ODETTE Identifier | F X(1) |
| 1 | SIOICD | International Code Designator | V 9(4) |
| 5 | SIOORG | Organisation Code | V X(14) |
| 19 | SIOCSA | Computer Subaddress | V X(6) |
o-------------------------------------------------------------------o
 
SIOOID ODETTE Identifier Character
 
Value: 'O' Indicates ODETTE assigned Organisation Identifier.
Other values may be used for non-ODETTE codes.
 
SIOICD International Code Designator String(4)
 
A code forming part of the Organisation Identifier.
 
SIOORG Organisation Code String(14)
 
A code forming part of the Organisation Identifier. This
field may contain the letters A to Z, the digits 0 to 9,
and space and hyphen characters.
 
SIOCSA Computer Subaddress String(6)
 
A locally assigned address that uniquely identifies a
system within an organisation (defined by an Organisation
Identifier).
 
 
 
 
 
Friend Informational [Page 68]
<a name="page-69"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-6">6</a>. File Services
 
<a name="section-6.1">6.1</a>. Overview
 
ODETTE-FTP provides services for compressing, encrypting, and signing
files. These services should generally be performed off line,
outside of the ODETTE-FTP communications session for performance
reasons, although this is not a strict requirement.
 
ODETTE-FTP requires that the following steps must be performed in
this exact sequence, although any of steps 2, 3, or 4 may be omitted.
Step 1 is required only if any of steps 2, 3, or 4 are performed:
 
<a name="section-1">1</a>. Insert record length indicators (V format files only; see Section
6.5)
2. Sign
3. Compress
4. Encrypt
 
The cipher suite for the encryption and signing algorithms is
assigned by bilateral agreement.
 
Secured and/or compressed files must be enveloped. The envelope
contains additional information about the service used that is
necessary for a receiving party to fully process the file.
 
The [<a href="#ref-CMS">CMS</a>] content types used are:
 
EnvelopedData - Indicates encrypted data
CompressedData - Indicates compressed data
SignedData - Indicates signed content
Data - Indicates unstructured data
 
For signed or encrypted data, the encapsulated content type
(eContentType field) is id-data.
 
<a name="section-6.2">6.2</a>. File Signing
 
Files that are to be signed are enveloped according to the file
enveloping format (SFIDENV). Generally, this will be as a [<a href="#ref-CMS">CMS</a>]
package.
 
A file may be signed more than once to ease the changeover between
old and new certificates.
 
 
 
 
 
 
 
Friend Informational [Page 69]
<a name="page-70"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
It is recommended that the envelope does not contain the public
certificate of the signer. Where files are sent to the same
recipient continuously, it would serve no benefit to repeatedly send
the same certificate. Both the original file data and signature are
stored within the [<a href="#ref-CMS">CMS</a>] package.
 
<a name="section-6.3">6.3</a>. File Encryption
 
Files that are to be encrypted are enveloped according to the file
enveloping format (SFIDENV). Generally, this will be as a [<a href="#ref-CMS">CMS</a>]
package.
 
It is recommended that encryption should be performed before the
ODETTE-FTP session starts because a large file takes a long time to
encrypt and could cause session time outs, even on high-performance
machines.
 
Likewise, decryption of the file should occur outside of the session.
However, an application may choose to allow in-session encryption and
decryption for very small files.
 
<a name="section-6.4">6.4</a>. File Compression
 
Files that are to be compressed are enveloped according to the file
enveloping format (SFIDENV). Generally, this will be as a [<a href="#ref-CMS">CMS</a>]
package using the [<a href="#ref-CMS-Compression">CMS-Compression</a>] data type, which uses the [<a href="#ref-ZLIB">ZLIB</a>]
compression algorithm by default.
 
Unlike the buffer compression method, this method operates on a whole
file. Because of the increased levels of compression, file level
compression essentially deprecates the older buffer compression
inside ODETTE-FTP. The buffer compression is kept for backwards
compatibility.
 
<a name="section-6.5">6.5</a>. V Format Files - Record Lengths
 
A file that has been signed, compressed, and/or encrypted will have
lost its record structure, so ODETTE-FTP will not be able to insert
the End of Record Flag in subrecord headers in Data Exchange Buffers.
To preserve the record structure, V format files must have record
headers inserted into them prior to signing, compression, or
encryption. These 2-byte binary numbers, in network byte order,
indicate the length of each record, allowing the receiving system,
where appropriate, to recreate the files complete with the original
variable-length records. Note that the header bytes hold the number
of data bytes in the record and don't include themselves.
 
 
 
 
 
Friend Informational [Page 70]
<a name="page-71"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
This is only applicable to V format files, which themselves are
typically only of concern for mainframes.
 
<a name="section-7">7</a>. ODETTE-FTP Data Exchange Buffer
 
<a name="section-7.1">7.1</a>. Overview
 
Virtual Files are transmitted by mapping the Virtual File records
into Data Exchange Buffers, the maximum length of which was
negotiated between the ODETTE-FTP entities via the Start Session
(SSID) commands exchanged during the Start Session phase of the
protocol.
 
Virtual File records may be of arbitrary length. A simple
compression scheme is defined for strings of repeated characters.
 
An example of the use of the Data Exchange Buffer can be found in
Appendix A.
 
<a name="section-7.2">7.2</a>. Data Exchange Buffer Format
 
For transmission of Virtual File records, data is divided into
subrecords, each of which is preceded by a 1-octet Subrecord Header.
 
The Data Exchange Buffer is made up of the initial Command Character
followed by pairs of Subrecord Headers and subrecords, as follows.
 
o--------------------------------------------------------
| C | H | | H | | H | | /
| M | D | SUBRECORD | D | SUBRECORD | D | SUBRECORD | /_
| D | R | | R | | R | | /
o-------------------------------------------------------
 
CMD
 
The Data Exchange Buffer Command Character, 'D'.
 
HDR
 
A 1-octet Subrecord Header defined as follows:
 
<a name="section-0">0</a> 1 2 3 4 5 6 7
o-------------------------------o
| E | C | |
| o | F | C O U N T |
| R | | |
o-------------------------------o
 
 
 
 
Friend Informational [Page 71]
<a name="page-72"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Bits
 
<a name="section-0">0</a> End of Record Flag
 
Set to indicate that the next subrecord is the last
subrecord of the current record.
 
Unstructured files are transmitted as a single record; in
this case, the flag acts as an end-of-file marker.
 
<a name="section-1">1</a> Compression Flag
 
Set to indicate that the next subrecord is compressed.
 
2-7 Subrecord Count
 
The number of octets in the Virtual File represented by the
next subrecord expressed as a binary value.
 
For uncompressed data, this is simply the length of the
subrecord.
 
For compressed data, this is the number of times that the
single octet in the following subrecord must be inserted in
the Virtual File.
 
As 6 bits are available, the next subrecord may represent
between 0 and 63 octets of the Virtual File.
 
<a name="section-7.3">7.3</a>. Buffer Filling Rules
 
A Data Exchange Buffer may be any length up to the value negotiated
in the Start Session exchange.
 
Virtual File records may be concatenated within one Data Exchange
Buffer or split across a number of buffers.
 
A subrecord is never split between two Exchange Buffers. If the
remaining space in the current Exchange Buffer is insufficient to
contain the next 'complete' subrecord, one of the following
strategies should be used:
 
<a name="section-1">1</a>. Truncate the Exchange Buffer, and put the complete subrecord
(preceded by its header octet) in a new Exchange Buffer.
 
<a name="section-2">2</a>. Split the subrecord into two, filling the remainder of the
Exchange Buffer with the first new subrecord and starting a new
Exchange Buffer with the second.
 
 
 
Friend Informational [Page 72]
<a name="page-73"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
A record of length zero may appear anywhere in the Exchange Buffer.
 
A subrecord of length zero may appear anywhere in the record and/or
the Exchange Buffer.
 
<a name="section-8">8</a>. Stream Transmission Buffer
 
<a name="section-8.1">8.1</a>. Introduction
 
To utilise the TCP stream, a Stream Transmission Buffer (STB) is
created by adding a Stream Transmission Header (STH) to the start of
all Command and Data Exchange Buffers before they are passed to the
TCP transport service. This allows the receiving ODETTE-FTP to
recover the original Exchange Buffers.
 
Note: The Stream Transmission Buffer is not used when using ODETTE-
FTP over an X.25 network.
 
This is because ODETTE-FTP can rely on the fact that the Network
Service will preserve the sequence and boundaries of data units
transmitted through the network and that the Network Service will
pass the length of the data unit to the receiving ODETTE-FTP. TCP
offers a stream-based connection that does not provide these
functions.
 
The Stream Transmission Buffer is composed of an STH and an OEB.
 
o-----+-----------------+-----+--------------------+-----+------
| STH | OEB | STH | OEB | STH | OEB/
o-----+-----------------+-----+--------------------+-----+----
 
STH - Stream Transmission Header
OEB - ODETTE-FTP Exchange Buffer
 
<a name="section-8.2">8.2</a>. Stream Transmission Header Format
 
The Stream Transmission Header is shown below. The fields are
transmitted from left to right.
 
<a name="section-0">0</a> 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Version| Flags | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 
 
 
 
 
 
 
Friend Informational [Page 73]
<a name="page-74"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Version
 
Value: 0001 (binary)
 
Stream Transmission Header version number.
 
Flags
 
Value: 0000 (binary)
 
Reserved for future use.
 
Length
 
Range: 5 - 100003 (decimal)
 
The length of the Stream Transmission Buffer (STH+OEB).
 
The smallest STB is 5 octets consisting of a 4-octet header
followed by a 1-octet Exchange Buffer such as a Change Direction
(CD) command.
 
The maximum Exchange Buffer length that can be negotiated is 99999
octets (<a href="#section-5.3.2">Section 5.3.2</a>) giving an STB length of 100003.
 
The length is expressed as a binary number in network byte order.
 
It is expected that implementations of this protocol will follow the
Internet robustness principle of being conservative in what is sent
and liberal in what is accepted.
 
<a name="section-9">9</a>. Protocol State Machine
 
<a name="section-9.1">9.1</a>. ODETTE-FTP State Machine
 
The operation of an ODETTE-FTP entity is formally defined by the
State Machine presented below. There are five State and Transition
tables, and for each table additional information is given in the
associated Predicate and Action lists.
 
The response of an ODETTE-FTP entity to the receipt of an event is
defined by a Transition table entry indexed by the Event/State
intersection within the appropriate state table.
 
Each Transition table entry defines the actions taken, events
generated, and new state entered. Predicates may be used within a
table entry to select the correct response on the basis of local
information held by the entity.
 
 
 
Friend Informational [Page 74]
<a name="page-75"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
A Transition table contains the following fields:
 
Index (I) State transition index.
 
Predicate A list of predicates used to select between different
possible transitions. The predicates are defined in
the Predicate and Action lists.
 
Actions A list of actions taken by the entity. The actions are
defined in the Predicate and Action lists.
 
Events Output events generated by the entity.
 
Next State The new state of the entity.
 
<a name="section-9.2">9.2</a>. Error Handling
 
The receipt of an event in a given state may be invalid for three
reasons.
 
<a name="section-1">1</a>. The case is impossible by design of the state automata, denoted
'X' in the state tables. For example, a timer that has not been
set cannot run out.
 
<a name="section-2">2</a>. The event is the result of an error in the Network Service
implementation, also denoted 'X' in the state tables. The
Network Service implementation is considered to be correct.
 
<a name="section-3">3</a>. For all other cases, the event is considered to be a User Error,
denoted "U" in the state tables.
 
The state tables define the conditions under which a User event is
valid, thus preventing the generation of a protocol error by the
ODETTE-FTP entity as a result of a User Monitor error. The reaction
of the entity to such errors is undefined and regarded as a local
implementation issue.
 
The state tables also allow protocol errors due to the receipt of
invalid Exchange Buffers, to be detected. In such cases, the
reaction of the entity to the error is defined.
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 75]
<a name="page-76"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-9.3">9.3</a>. States
 
The Command Mode is strictly a half-duplex flip-flop mode.
 
A_NC_ONLY Responder, Network Connection opened
 
The Responder has sent its Ready Message (SSRM) and is
waiting for Start Session (SSID) from the Initiator.
 
A_WF_CONRS Responder Waiting for F_CONNECT_RS
 
The Responder has received the Initiator's Start Session
(SSID) and is waiting for a response (F_CONNECT_RS) from
its User Monitor.
 
CDSTWFCD CD_RQ stored in WF_CD state
 
Since the User Monitor doesn't see the WF_CD state, it
may send a Change Direction request (F_CD_RQ) before the
ODETTE-FTP receives a Change Direction (CD) command.
 
CLIP Close Input Pending
 
The Listener has received an End File (EFID) command and
is waiting for the Close File response (F_CLOSE_FILE_RS)
from its User Monitor.
 
CLOP Close Out Pending
 
The Speaker has sent an End File (EFID) command and is
waiting for an End File Answer (EFPA or EFNA).
 
ERSTWFCD End to End Response stored in WF_CD state
 
Since the User Monitor doesn't see the WF_CD state, it
may send F_EERP_RQ, before ODETTE-FTP receives a Change
Direction (CD) command.
 
IDLE Connection IDLE
 
IDLELI Idle Listener
 
IDLELICD Idle Listener, F_CD_RQ Received
 
The ODETTE-FTP entity has become the Listener after
receiving a Change Direction request (F_CD_RQ) from the
User Monitor. The receipt of an End Session (ESID) is
valid in this state.
 
 
 
Friend Informational [Page 76]
<a name="page-77"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
IDLESP Idle Speaker
 
IDLESPCD Idle Speaker, F_CD_IND Sent
 
The ODETTE-FTP entity has sent a Change Direction
indication (F_CD_IND) to the User Monitor. A Change
Direction request (F_CD_RQ) is invalid in this state.
 
I_WF_NC Initiator Waiting for Network Connection
 
The Initiator has requested a new network connection and
is waiting for a Connection confirmation (N_CON_CF) from
the Network Service.
 
I_WF_RM Initiator Waiting for Ready Message
 
Before sending Start Session (SSID), the Initiator must
wait for a Ready Message (SSRM) from the Responder.
 
I_WF_SSID Initiator Waiting for SSID
 
The Initiator has sent a Start Session (SSID) command and
is waiting for Start Session from the Responder.
 
NRSTWFCD Negative End Response stored in WF_CD state
 
Since the User Monitor doesn't see the WF_CD state, it
may send F_NERP_RQ, before ODETTE-FTP receives a Change
Direction (CD) command.
 
OPI Open Input (Data Transfer Phase)
 
The Listener is waiting for the Speaker to send a Data
Exchange Buffer.
 
OPIP Open Input Pending
 
The Listener has received a Start File (SFID) command and
is waiting for the Start File response (F_START_FILE_RS)
from its User Monitor.
 
OPO Open Out (Data Transfer Phase)
 
The Speaker has received a Start File Positive Answer
(SFPA) and is waiting for a Data (F_DATA_RQ) or Close
File (F_CLOSE_FILE) request from its User Monitor.
 
 
 
 
 
Friend Informational [Page 77]
<a name="page-78"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
OPOP Open Out Pending
 
The Speaker has sent a Start File (SFID) command and is
waiting for a Start File Answer (SFPA or SFNA).
 
OPOWFC Open Out Wait for Credit
 
The Speaker is waiting for a Set Credit (CDT) command
before sending further Data Exchange buffers.
 
RTRP Ready to Receive (RTR) Pending
 
The Listener has received an EERP or a NERP and is
waiting for the Ready to Receive response (F_RTR_RS) from
its User Monitor.
 
SFSTWFCD Start File Request stored in WF_CD state.
 
Since the User Monitor doesn't see the WF_CD state, it
may send a Start File request (F_START_FILE_RQ) before
the ODETTE-FTP receives a Change Direction (CD) command.
 
WF_CD Wait for Change Direction
 
The Listener wishes to become the Speaker and is waiting
for a Change Direction (CD) command after sending an End
File Positive Answer (EFPA) requesting change direction.
 
WF_RTR Wait for Ready To Receive
 
The Speaker has sent an End to End Response (EERP) or a
Negative End Response (NERP) command and must wait for
Ready To Receive (RTR) from the Listener.
 
WF_NDISC Wait for N_DISC_IND
 
ODETTE-FTP has sent an End Session (ESID) command and is
waiting for a Disconnection indication (N_DISC_IND) from
the Network Service.
 
WF_SECD Wait for Security Change Direction
 
The Speaker is expecting a Security Change Direction
(SECD) from the Listener.
 
 
 
 
 
 
 
Friend Informational [Page 78]
<a name="page-79"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
WF_AUCH Wait for Authentication Challenge
 
The Speaker has sent a Security Change Direction (SECD)
command and must wait for Authentication Challenge (AUCH)
from the Listener.
 
WF_AURP Wait for Authentication Response
 
The Speaker has sent an Authentication Challenge (AUCH)
command and must wait for Authentication Response (AURP)
from the Listener.
 
<a name="section-9.4">9.4</a>. Input Events
 
User Monitor Input Events (<a href="#section-3">Section 3</a>)
 
F_DATA_RQ F_CONNECT_RQ F_START_FILE_RQ F_CLOSE_FILE_RQ
F_EERP_RQ F_CONNECT_RS F_START_FILE_RS(+) F_CLOSE_FILE_RS(+)
F_NERP_RQ F_ABORT_RQ F_START_FILE_RS(-) F_CLOSE_FILE_RS(-)
F_CD_RQ F_RELEASE_RQ F_RTR_RS
 
Network Input Events (<a href="#section-2.2">Section 2.2</a>)
 
N_CON_IND N_CON_CF N_DATA_IND N_DISC_IND N_RST_IND
 
Peer ODETTE-FTP Input Events (<a href="#section-4">Section 4</a>)
 
SSID SFID SFPA SFNA EFID EFPA EFNA
DATA ESID EERP RTR CD CDT SSRM
NERP SECD AUCH AURP
 
Internal Input Events
 
TIME-OUT - Internal ODETTE-FTP timer expires.
 
Input event parameters are denoted I.Event-name.Parameter-name within
the state table action and predicate lists. Their value can be
examined but not changed by the ODETTE-FTP entity.
 
<a name="section-9.5">9.5</a>. Output Events
 
User Monitor Output Events (<a href="#section-3">Section 3</a>)
 
F_DATA_IND F_CONNECT_IND F_START_FILE_IND F_CLOSE_FILE_IND
F_EERP_IND F_CONNECT_CF F_START_FILE_CF(+) F_CLOSE_FILE_CF(+)
F_CD_IND F_ABORT_IND F_START_FILE_CF(-) F_CLOSE_FILE_CF(-)
F_NERP_IND F_RELEASE_IND F_DATA_CF F_RTR_CF
 
 
 
 
Friend Informational [Page 79]
<a name="page-80"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Network Output Events (<a href="#section-2.2">Section 2.2</a>)
 
N_CON_RQ N_CON_RS N_DATA_RQ N_DISC_RQ
 
Peer ODETTE-FTP Output Events (<a href="#section-4">Section 4</a>)
 
SSID SFID SFPA SFNA EFID EFPA EFNA
DATA ESID EERP RTR CD CDT SSRM
NERP SECD AUCH AURP
 
Output event parameters are denoted O.Event-name.Parameter-name
within the state table action and predicate lists. Their values can
be examined and changed by the ODETTE-FTP entity.
 
<a name="section-9.6">9.6</a>. Local Variables
 
The following variables are maintained by the ODETTE-FTP entity to
assist the operation of the protocol. They are denoted V.Variable-
name within the state table action and predicate lists. Their value
can be examined and changed by the ODETTE-FTP entity. The initial
value of each variable is undefined.
 
Variable Type Comments
---------------------------------------------------------------------
Buf-size Integer Negotiated Data Exchange Buffer size.
Called-addr Address Used to build O.F_CONNECT_IND.Called-addr
Calling-addr Address To build O.F_CONNECT_IND.Calling-addr
Compression Yes/No Compression in use as agreed.
Credit_L Integer Listener's credit counter.
Credit_S Integer Speaker's credit counter.
Id String Used to build O.SSID.Id
Mode Sender-only, Receiver-only, Both.
Pswd String Password, used to build O.SSID.Pswd
Req-buf Primitive Input event (F_XXX_RQ) stored in WF_CD
state.
Restart Yes/No Restart in used as agreed.
Restart-pos Integer Used only during file opening.
Window Integer The credit value negotiated for the
session.
Caller Yes/No This entity initiated the ODETTE-FTP
session.
Authentication Yes/No Secure authentication in use as agreed
Challenge Binary Random challenge
---------------------------------------------------------------------
 
 
 
 
 
 
 
Friend Informational [Page 80]
<a name="page-81"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-9.7">9.7</a>. Local Constants
 
The following constants define the capabilities of a given ODETTE-FTP
entity. They are denoted C.Constant-name within the state table
action and predicate lists. Their value can be examined but not
changed by the ODETTE-FTP entity.
 
Constant Value Comments
---------------------------------------------------------------------
Cap-compression Yes/No Compression supported?
Cap-init Initiator Must be Initiator.
Responder Must be Responder.
Both Can be Initiator or Responder.
Cap-mode Sender-only Must be sender.
Receiver-only Must be receiver.
Both Can be sender or receiver.
Max-buf-size 127 &lt; Int &lt; 100000 Maximum Data Exchange Buffer
size supported.
Max-window 0 &lt; Int &lt; 1000 Local maximum credit value.
Cap-restart Yes/No Restart supported?
Cap-logic 0, 1, 2 0 = does not support special
logic
1 = supports special logic
2 = needs special logic
---------------------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 81]
<a name="page-82"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-9.8">9.8</a>. Session Connection State Table
 
<a name="section-9.8.1">9.8.1</a>. State Table
 
o----------------------------------------------------------o
| | Other States |
| |--------------------------------------------------o |
| | WF_SECD | |
| |----------------------------------------------o | |
| | WF_AURP | | |
| |------------------------------------------o | | |
| | WF_AUCH | | | |
| |--------------------------------------o | | | |
| S | A_WF_CONRS | | | | |
| |----------------------------------o | | | | |
| T | A_NC_ONLY | | | | | |
| |------------------------------o | | | | | |
| A | I_WF_SSID | | | | | | |
| |--------------------------o | | | | | | |
| T | I_WF_RM | | | | | | | |
| |----------------------o | | | | | | | |
| E | I_WF_NC | | | | | | | | |
| |------------------o | | | | | | | | |
| | IDLE | | | | | | | | | |
|==================o---+---+---+---+---+---+---+---+---+---|
| | F_CONNECT_RQ | A | X | X | X | X | X | X | X | X | X |
| |--------------+---+---+---+---+---+---+---+---+---+---|
| E | N_CON_CF | X | C | X | X | X | X | X | X | X | X |
| |--------------+---+---+---+---+---+---+---+---+---+---|
| V | SSRM | X | X | H | X | X | X | L | L | L | X |
| |--------------+---+---+---+---+---+---+---+---+---+---|
| E | SSID | X | X | X | D | E | F | L | L | L | F |
| |--------------+---+---+---+---+---+---+---+---+---+---|
| N | N_CON_IND | B | X | X | X | X | X | X | X | X | X |
| |--------------+---+---+---+---+---+---+---+---+---+---|
| T | F_CONNECT_RS | X | U | U | U | U | G | X | X | X | U |
| |--------------+---+---+---+---+---+---+---+---+---+---|
| | ESID | X | X | X | F | X | X | F | F | F | X |
| |--------------+---+---+---+---+---+---+---+---+---+---|
| | AUCH | X | X | U | U | X | X | I | L | L | U |
| |--------------+---+---+---+---+---+---+---+---+---+---|
| | AURP | X | X | U | U | X | X | L | K | L | U |
| |--------------+---+---+---+---+---+---+---+---+---+---|
| | SECD | X | X | U | U | X | X | L | L | J | U |
o----------------------------------------------------------o
 
 
 
 
 
 
Friend Informational [Page 82]
<a name="page-83"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-9.8.2">9.8.2</a>. Transition Table
 
I | Predicate Actions Output Events Next State
===o=============================================================
A | P1: F_ABORT_IND IDLE
| !P1: 1,2 N_CON_RQ I_WF_NC
---+-------------------------------------------------------------
B | P3: N_DISC_RQ IDLE
| !P3: 2 N_CON_RS
| SSRM A_NC_ONLY
---+-------------------------------------------------------------
C | 4,2 I_WF_RM
---+-------------------------------------------------------------
D | P2 &amp; P8 &amp; P11: 4,2,5 SECD WF_AUCH
| P2 &amp; P8 &amp; !P11: 4,2,5 F_CONNECT_CF IDLESP
| P2 &amp; !P8: 4,2 ESID(R=12)
| F_ABORT_IND(R,AO=L) WF_NDISC
| else: 4,2 ESID(R=10)
| F_ABORT_IND(R,AO=L) WF_NDISC
---+-------------------------------------------------------------
E | P4: 4 N_DISC_RQ IDLE
| !P4: 4,2 F_CONNECT_IND A_WF_CONRS
---+-------------------------------------------------------------
F | 4 F_ABORT_IND
| N_DISC_RQ IDLE
---+-------------------------------------------------------------
G | P2 &amp; P9 &amp; P10: 4,2,5 SSID WF_SECD
| P2 &amp; !P9 &amp; P10: 4,2,5 SSID IDLELI
| !P10: 4,2 ESID(R=12)
| F_ABORT_IND(R,AO=L) WF_NDISC
| else: 4,2 ESID(R=10)
| F_ABORT_IND(R,AO=L) WF_NDISC
---+-------------------------------------------------------------
H | 4,2,3 SSID I_WF_SSID
---+-------------------------------------------------------------
I | P5: 4,2 AURP WF_SECD
| !P5: 4,2 AURP IDLELI
---+-------------------------------------------------------------
J | 4,2 AUCH WF_AURP
---+-------------------------------------------------------------
K | P6: 4,2 F_CONNECT_CF IDLESP
| P7: 4,2 SECD WF_AUCH
| else: 4,2 ESID(R=11)
| F_ABORT_IND(R,AO=L) WF_NDISC
---+-------------------------------------------------------------
L | 4,2 ESID(R=02)
| F_ABORT_IND(R,AO=L) WF_NDISC
---+-------------------------------------------------------------
 
 
 
Friend Informational [Page 83]
<a name="page-84"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-9.8.3">9.8.3</a>. Predicates and Actions
 
Predicate P1: (No resources available) OR
(C.Cap-init = Responder) OR
(C.Cap-mode = Sender-only AND
I.F_CONNECT_RQ.Mode = Receiver-only) OR
(C.Cap-mode = Receiver-only AND
I.F_CONNECT_RQ.Mode = Sender-only)
 
Predicate P2: SSID negotiation is successful
(for these, Buf-size, Restart, Compression, Mode,
Special logic, and Window, compare the inbound SSID
with the local constants to set the local variables.
Any incompatibilities result in failure of the
negotiation.)
 
Predicate P3: C.Cap-init = Initiator
 
Predicate P4: Mode in SSID incompatible with C.Cap-mode
 
Predicate P5: V.Caller = Yes
 
Predicate P6: (V.Caller = Yes) AND (AURP.Signature verifies with
V.Challenge)
 
Predicate P7: (V.Caller = No) AND (AURP.Signature verifies with
V.Challenge)
 
Predicate P8: V.Authentication = I.SSID.Authentication
 
Predicate P9: I.F_CONNECT_RS.Authentication = Yes
 
Predicate P10: O.F_CONNECT_IND.Authentication =
I.F_CONNECT_RS.Authentication
 
Predicate P11: V.Authentication = Yes
 
Action 1: Set V.Mode from (C.Cap-mode, I.F_CONNECT_RQ.Mode)
Set V.Pswd, V.Id, V.Restart, and
V.Authentication from I.F_CONNECT_RQ
Set V.Buf-size = C.Max-buf-size
Set V.Compression = C.Cap-compression
Set V.Caller = Yes
Build O.N_CON_RQ
 
Action 2: Start inactivity timer
 
Action 3: Set parameters in O.SSID = from local variables
 
 
 
Friend Informational [Page 84]
<a name="page-85"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Action 4: Stop timer
 
Action 5: Set V.Mode, V.Restart, V.Compression, V.Buf-size,
V.Window, V.Authentication = from SSID
 
Action 6: Set V.Challenge = A random number unique to the
session
 
<a name="section-9.9">9.9</a>. Error and Abort State Table
 
<a name="section-9.9.1">9.9.1</a>. State Table
 
o--------------------------------------o
| | Other States |
| S |------------------------------o |
| T | WF_NDISC | |
| A |--------------------------o | |
| T | I_WF_NC | | |
| E |----------------------o | | |
| | IDLE | | | |
|======================o---+---+---+---|
| | TIME-OUT | X | X | A | B |
| |------------------+---+---+---+---|
| E | F_ABORT_RQ | X | A | X | C |
| V |------------------+---+---+---+---|
| E | N_RST_IND | X | X | A | D |
| N |------------------+---+---+---+---|
| T | N_DISC_IND | X | E | F | G |
| |------------------+---+---+---+---|
| | Invalid Buffer | X | X | H | I |
o--------------------------------------o
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 85]
<a name="page-86"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-9.9.2">9.9.2</a>. Transition Table
 
I | Predicate Actions Output Events Next State
===o=================================================================
A | N_DISC_RQ IDLE
---+-----------------------------------------------------------------
B | F_ABORT_IND
| N_DISC_RQ IDLE
---+-----------------------------------------------------------------
C | 1 N_DISC_RQ IDLE
---+-----------------------------------------------------------------
D | 1 N_DISC_RQ
| F_ABORT_IND IDLE
---+-----------------------------------------------------------------
E | F_ABORT_IND IDLE
---+-----------------------------------------------------------------
F | 1 IDLE
---+-----------------------------------------------------------------
G | 1 F_ABORT_IND IDLE
---+-----------------------------------------------------------------
H | WF_NDISC
---+-----------------------------------------------------------------
I | 1,2 ESID(R=01)
| F_ABORT_IND(R,AO=L) WF_NDISC
---------------------------------------------------------------------
 
<a name="section-9.9.3">9.9.3</a>. Predicates and Actions
 
Action 1: Stop inactivity timer
 
Action 2: Start inactivity timer
 
<a name="section-9.10">9.10</a>. Speaker State Table 1
 
<a name="section-9.10.1">9.10.1</a>. State Table
 
The following abbreviations are used in the Speaker state table.
 
F_REL_RQ(Ok) - F_RELEASE_RQ Reason = Normal
F_REL_RQ(Err) - F_RELEASE_RQ Reason = Error
 
o--------------------------------------------------------------------o
| | Other States |
| |--------------------------------------------------------------o |
| | WF_NDISC | |
| |----------------------------------------------------------o | |
| | OPOWFC | | |
 
 
 
 
Friend Informational [Page 86]
<a name="page-87"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
| |------------------------------------------------------o | | |
| | OPO | | | |
|S|--------------------------------------------------o | | | |
| | OPOP | | | | |
|T|----------------------------------------------o | | | | |
| | CDSTWFCD | | | | | |
|A|------------------------------------------o | | | | | |
| | SFSTWFCD | | | | | | |
|T|--------------------------------------o | | | | | | |
| | NRSTWFCD | | | | | | | |
|E|----------------------------------o | | | | | | | |
| | ERSTWFCD | | | | | | | | |
| |------------------------------o | | | | | | | | |
| | WF_CD | | | | | | | | | |
| |--------------------------o | | | | | | | | | |
| | WF_RTR | | | | | | | | | | |
| |----------------------o | | | | | | | | | | |
| | IDLESPCD | | | | | | | | | | | |
| |------------------o | | | | | | | | | | | |
| | IDLESP | | | | | | | | | | | | |
|=+==============o---+---+---+---+---+---+---+---+---+---+---+---+---|
| | F_EERP_RQ | A | A | W | F | W | W | U | U | U | U | U | U | U |
| |--------------+---+---+---+---+---+---+---+---+---+---+---+---+---|
| | F_NERP_RQ | Y | Y | W | Z | W | W | U | U | U | U | U | U | U |
| |--------------+---+---+---+---+---+---+---+---+---+---+---+---+---|
| | F_START_ | B | B | W | G | W | W | U | U | U | U | U | X | U |
| | FILE_RQ | | | | | | | | | | | | | |
| |--------------+---+---+---+---+---+---+---+---+---+---+---+---+---|
| | SFPA | C | C | C | C | C | C | C | C | K | C | C | S | C |
| |--------------+---+---+---+---+---+---+---+---+---+---+---+---+---|
|E| SFNA | C | C | C | C | C | C | C | C | L | C | C | S | C |
| |--------------+---+---+---+---+---+---+---+---+---+---+---+---+---|
|V| CD | C | C | C | H | R | Z1| I | J | C | C | C | S | C |
| |--------------+---+---+---+---+---+---+---+---+---+---+---+---+---|
|E| F_DATA_RQ | U | U | U | U | U | U | U | U | U | M | U | S | U |
| |--------------+---+---+---+---+---+---+---+---+---+---+---+---+---|
|N| CDT | C | C | C | C | C | C | C | C | C | P | O | S | C |
| |--------------+---+---+---+---+---+---+---+---+---+---+---+---+---|
|T| F_CD_RQ | D | U | W | T | W | W | U | U | U | U | U | X | U |
| |--------------+---+---+---+---+---+---+---+---+---+---+---+---+---|
| | F_REL_RQ(Ok) | U | E | U | U | U | U | U | U | U | U | U | X | U |
| |--------------+---+---+---+---+---+---+---+---+---+---+---+---+---|
| | F_REL_RQ(Err)| Q | Q | Q | Q | Q | Q | Q | Q | Q | Q | Q | S | Q |
| |--------------+---+---+---+---+---+---+---+---+---+---+---+---+---|
| | RTR | C | C | N | C | C | C | C | C | C | C | C | S | C |
o--------------------------------------------------------------------o
 
 
 
 
 
Friend Informational [Page 87]
<a name="page-88"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-9.10.2">9.10.2</a>. Transition Table
 
I | Predicate Actions Output Events Next State
===o=================================================================
A | P5: 1,2,3,18 EERP WF_RTR
| !P5: 1,2,3 EERP WF_RTR
---+-----------------------------------------------------------------
B | P1: UE
| !P1: 1,2,5 SFID OPOP
---+-----------------------------------------------------------------
C | 1,2 ESID(R=02)
| F_ABORT_IND(R,AO=L) WF_NDISC
---+-----------------------------------------------------------------
D | 1,2 CD IDLELICD
---+-----------------------------------------------------------------
E | 1,2 ESID(R=00) WF_NDISC
---+-----------------------------------------------------------------
F | 4 ERSTWFCD
---+-----------------------------------------------------------------
G | P1: UE
| !P1: 6 SFSTWFCD
---+-----------------------------------------------------------------
H | 1,2 IDLESP
---+-----------------------------------------------------------------
I | 1,2,10 SFID OPOP
---+-----------------------------------------------------------------
J | 1,2 CD IDLELICD
---+-----------------------------------------------------------------
K | P2: 1,2 ESID(R=02)
| F_ABORT_IND(R,AO=L) WF_NDISC
| !P2: 1,2,7,12 F_START_FILE_CF(+) OPO
---+-----------------------------------------------------------------
L | 1,2,8 F_START_FILE_CF(-) IDLESP
---+-----------------------------------------------------------------
M | P3: 1,2,11,13 DATA OPOWFC
| !P3: 1,2,11,13 DATA
| F_DATA_CF OPO
---+-----------------------------------------------------------------
N | F_RTR_CF IDLESP
---+-----------------------------------------------------------------
O | 12 F_DATA_CF OPO
---+-----------------------------------------------------------------
P | Protocol 1,2 ESID(R=02)
| Error F_ABORT_IND(R,AO=L) WF_NDISC
---+-----------------------------------------------------------------
Q | 1,2 ESID(R) WF_NDISC
---+-----------------------------------------------------------------
Continued --&gt;
 
 
 
Friend Informational [Page 88]
<a name="page-89"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
I | Predicate Actions Output Events Next State
===o=================================================================
R | 1,2,9 EERP WF_RTR
---+-----------------------------------------------------------------
S | WF_NDISC
---+-----------------------------------------------------------------
T | CDSTWFCD
---+-----------------------------------------------------------------
U | User Error UE
---+-----------------------------------------------------------------
W | User Error - Note 1 UE
---+-----------------------------------------------------------------
X | Error
---+-----------------------------------------------------------------
Y | P4 &amp; P5: 1,2,15,18 NERP WF_RTR
| !P4 &amp; !P5: 1,2,15,14 NERP WF_RTR
| P4 &amp; !P5: 1,2,15 NERP WF_RTR
| !P4 &amp; P5: 1,2,15,14,18 NERP WF_RTR
---+-----------------------------------------------------------------
Z | 16 NRSTWFCD
---------------------------------------------------------------------
Z1| P4: 1,2,17 NERP WF_RTR
| !P4: 1,2,17,14 NERP WF_RTR
---------------------------------------------------------------------
 
<a name="section-9.10.3">9.10.3</a>. Predicates and Actions
 
Predicate P1: (I.F_START_FILE_RQ.Restart-pos &gt; 0 AND V.Restart = No)
OR (V.Mode = Receiver-only)
 
Note: Restart requested and not supported for this session.
 
Predicate P2: I.SFPA.Restart-pos &gt; V.Restart-pos
 
Note: Protocol error due to the restart position in the SFPA
acknowledgement being greater than the position
requested in the SFID request.
 
Predicate P3: V.Credit_S - 1 = 0
 
Note: Speaker's Credit is exhausted.
 
Predicate P4: No special logic is in use
 
Predicate P5: Signed EERP/NERP requested
 
Action 1: Stop inactivity timer
 
 
 
 
Friend Informational [Page 89]
<a name="page-90"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Action 2: Start inactivity timer
 
Action 3: Build an EERP from F_EERP_RQ
 
Action 4: Store F_EERP_RQ in V.Req-buf
 
Action 5: Build SFID from F_START_FILE_RQ
V.Restart-pos = I.F_START_FILE_RQ.Restart-pos
 
Action 6: Store F_START_FILE_RQ in V.Req-buf
 
Action 7: Build F_START_FILE_CF(+) from I.SFPA
 
Action 8: Build F_START_FILE_CF(-) from I.SFNA
 
Action 9: Build EERP from F_EERP_RQ stored in V.Req-buf
 
Action 10: Build SFID from F_START_FILE_RQ stored in V.Req-buf
Set V.Restart-pos
 
Action 11: Build Exchange Buffer
 
Action 12: V.Credit_S = V.Window
 
Action 13: V.Credit_S = V.Credit_S - 1
 
Action 14: Activate CRC-calculus function. Wrap Exchange buffer
in special logic
 
Action 15: Build a NERP from F_NERP_RQ
 
Action 16: Store F_NERP_RQ in V.Req-buf
 
Action 17: Build NERP from F_NERP_RQ stored in V.Req-buf
 
Action 18: Sign the contents of NERP/EERP
 
Note 1: Whether to accept this "Request/Event" while in this
state is a matter of local implementation. The ODETTE
state tables are based on the assumption that this
event cannot occur in this state and is considered to
be a user error (UE).
 
 
 
 
 
 
 
 
 
Friend Informational [Page 90]
<a name="page-91"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-9.11">9.11</a>. Speaker State Table 2
 
<a name="section-9.11.1">9.11.1</a>. State Table
 
o---------------------------------o
| S | CLOP |
| T |-------------------------o |
| A | OPOWFC | |
| T |---------------------o | |
| E | OPO | | |
|=====================o---+---+---|
| E | F_CLOSE_FILE_RQ | A | E | U |
| V |-----------------+---+---+---|
| E | EFPA | B | B | C |
| N |-----------------+---+---+---|
| T | EFNA | B | B | D |
o---------------------------------o
 
<a name="section-9.11.2">9.11.2</a>. Transition Table
 
I | Predicate Actions Output Events Next State
===o=================================================================
A | 1,2,5,7 EFID CLOP
---+-----------------------------------------------------------------
B | 1,2 ESID(R=02)
| F_ABORT_IND(R,AO=L) WF_NDISC
---+-----------------------------------------------------------------
C | P1: 1,2,3 F_CLOSE_FILE_CF(+,SP=No)
| CD IDLELI
| !P1: 1,2,4 F_CLOSE_FILE_CF(+,SP=Yes) IDLESP
---+-----------------------------------------------------------------
D | 1,2,6 F_CLOSE_FILE_CF(-) IDLESP
---+-----------------------------------------------------------------
E | See Note 1
---+-----------------------------------------------------------------
U | User Error UE
---------------------------------------------------------------------
 
<a name="section-9.11.3">9.11.3</a>. Predicates and Actions
 
Predicate P1: (I.EFPA.CD-Request = Yes)
 
Predicate P2: No special logic is in use
 
Action 1: Stop inactivity timer
 
Action 2: Start inactivity timer
 
 
 
 
Friend Informational [Page 91]
<a name="page-92"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Action 3: O.F_CLOSE_FILE_CF(+).Speaker = No
 
Action 4: O.F_CLOSE_FILE_CF(+).Speaker = Yes
 
Action 5: Build EFID from F_CLOSE_FILE_RQ
 
Action 6: Build F_CLOSE_FILE_CF(-) from EFNA
 
Action 7: Set V.Credit_S = 0
 
Action 8: Wrap Exchange buffer in special logic
 
Note 1: In order to respect the "half duplex" property of
ODETTE-FTP, it is forbidden to send EFID while in the
OPOWFC state. EFID can be sent only in the OPO state.
 
The ODETTE-FTP implementation must avoid sending EFID
(or receiving F_CLOSE_FILE_RQ) while in the OPOWFC
state.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 92]
<a name="page-93"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-9.12">9.12</a>. Listener State Table
 
<a name="section-9.12.1">9.12.1</a>. State Table
 
o---------------------------------------------o
| | RTRP |
| |-------------------------------------o |
| | CLIP | |
| |---------------------------------o | |
| | OPI | | |
| S |-----------------------------o | | |
| T | OPIP | | | |
| A |-------------------------o | | | |
| T | IDLELICD | | | | |
| E |---------------------o | | | | |
| | IDLELI | | | | | |
|=====================o---+---+---+---+---+---+
| | SFID | A | A | B | B | B | B |
| |-----------------+---+---+---+---+---+---+
| E | DATA | B | B | B | I | B | B |
| V |-----------------+---+---+---+---+---+---+
| E | EFID | B | B | B | J | B | B |
| N |-----------------+---+---+---+---+---+---+
| T | F_START_FILE_RS | U | U | H | U | U | U |
| |-----------------+---+---+---+---+---+---+
| | F_CLOSE_FILE_RS | U | U | U | U | K | U |
| |-----------------+---+---+---+---+---+---+
| | CD | C | B | B | B | B | B |
| |-----------------+---+---+---+---+---+---+
| | ESID R=Normal | D | F | D | D | D | D |
| |-----------------+---+---+---+---+---+---+
| | ESID R=Error | D | D | D | D | D | D |
| |-----------------+---+---+---+---+---+---+
| | EERP | E | E | B | B | B | B |
| |-----------------+---+---+---+---+---+---+
| | NERP | L | L | B | B | B | B |
| |-----------------+---+---+---+---+---+---+
| | F_RTR_RS | U | U | U | U | U | M |
o---------------------------------------------o
 
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 93]
<a name="page-94"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
<a name="section-9.12.2">9.12.2</a>. Transition Table
 
I | Predicate Actions Output Events Next State
===o=================================================================
A | P1: 1,2 ESID(R=02)
| F_ABORT_IND(R,AO=L) WF_NDISC
| !P1: 1,2,3 F_START_FILE_IND OPIP
---+-----------------------------------------------------------------
B | 1,2 ESID(R=02)
| F_ABORT_IND(R,AO=L) WF_NDISC
---+-----------------------------------------------------------------
C | 1,2 F_CD_IND IDLESPCD
---+-----------------------------------------------------------------
D | 1 F_ABORT_IND(Received
| ESID Reason,AO=D)
| N_DISC_RQ IDLE
---+-----------------------------------------------------------------
E | 1,2,4 F_EERP_IND RTRP
---+-----------------------------------------------------------------
F | 1 F_RELEASE_IND
| N_DISC_RQ IDLE
---+-----------------------------------------------------------------
H | P4: User Error UE
| P2 &amp; !P4 &amp; !P5: 1,2,8 SFPA OPI
| !P2 &amp; !P4 &amp; !P5: 1,2 SFNA IDLELI
| P2 &amp; !P4 &amp; P5: 1,2,5,8 SFPA OPI
| !P2 &amp; !P4 &amp; P5: 1,2,5 SFNA IDLELI
---+-----------------------------------------------------------------
I | P6: 1,2 ESID(R=02)
| F_ABORT_IND(R,A0=L) WF_NDISC
| !P5 &amp; !P6 &amp; !P7: 1,2,7 F_DATA_IND (See Note 1) OPI
| !P5 &amp; !P6 &amp; P7: 1,2,8 F_DATA_IND
| CDT (See Note 1) OPI
| P5 &amp; !P6 &amp; P8: 1,2 ESID(R=07)
| F_ABORT_IND(R,A0=L) WF_NDISC
| P5 &amp; !P6 &amp; !P7 : 1,2,6,7 F_DATA_IND (See Note 1) OPI
| &amp; !P8
| P5 &amp; !P6 &amp; P7 : 1,2,5,6,8 F_DATA_IND OPI
| &amp; !P8 CDT (See Note 1)
---+-----------------------------------------------------------------
J | 1,2 F_CLOSE_FILE_IND CLIP
---+-----------------------------------------------------------------
K | P2 &amp; P3 &amp; !P5: 1,2 EFPA(CD-Req) WF_CD
| P2 &amp; !P3 &amp; !P5: 1,2 EFPA(no CD) IDLELI
| !P2 &amp; !P5: 1,2 EFNA IDLELI
| P2 &amp; !P3 &amp; P5: 1,2,5 EFPA(no CD) IDLELI
| !P2 &amp; P5: 1,2,5 EFNA IDLELI
| P2 &amp; P3 &amp; P5: 1,2,5 EFPA(CD-Req) WF_CD
 
 
 
Friend Informational [Page 94]
<a name="page-95"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
---+-----------------------------------------------------------------
L | 1,2,10 F_NERP_IND RTRP
---+-----------------------------------------------------------------
M | 1,2 RTR IDLELI
---+-----------------------------------------------------------------
U | User Error UE
---------------------------------------------------------------------
 
<a name="section-9.12.3">9.12.3</a>. Predicates and Actions
 
Predicate P1: (I.SFID.Restart-pos &gt; 0 AND V.Restart = No) OR (V.Mode
= Sender-only)
 
Note: Invalid Start File command.
 
Predicate P2: Positive Response
 
Predicate P3: I.F_CLOSE_FILE_RS(+).Speaker = Yes
 
Predicate P4: I.F_START_FILE_RS(+).Restart-pos &gt; V.Restart
 
Predicate P5: Special logic is used
 
Predicate P6: V.Credit_L - 1 &lt; 0
 
Note: Protocol Error because the Speaker has exceeded its
available transmission credit.
 
Predicate P7: V.Credit_L - 1 = 0
 
Note: The Speaker's credit must be reset before it can send
further Data Exchange Buffers.
 
Predicate P8: The calculus of the received CRC indicates an error
 
Action 1: Stop inactivity timer
 
Action 2: Start inactivity timer
 
Action 3: Build F_START_FILE_IND from I.SFID
V.Restart-pos = I.SFID.Restart-pos
 
Action 4: Build F_EERP_IND from I.EERP
 
Action 5: Add special logic header to the command to be sent to
the Speaker
 
 
 
 
 
Friend Informational [Page 95]
<a name="page-96"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Action 6: Suppress the special logic header from the data buffer
before giving it to the user
 
Action 7: V.Credit_L = V.Credit_L - 1
 
Action 8: V.Credit_L = V.Window
 
Action 10: Build F_NERP_IND from I.NERP
 
Note 1: Flow control in case of reception.
 
The ODETTE-FTP Listener must periodically send new
credit to the Speaker. The timing of this operation
will depend on:
 
<a name="section-1">1</a>. The User Monitor's capacity to receive data.
2. The number of buffers available to ODETTE-FTP.
3. The Speaker's available credit, which must be
equal to zero.
 
<a name="section-9.13">9.13</a>. Example
 
Consider an ODETTE-FTP entity that has sent a Start File (SFID)
command and entered the Open Out Pending (OPOP) state. Its response
on receiving a Positive Answer (SFPA) is documented in Speaker State
Table 1, which shows that transition 'K' should be applied and is
interpreted as follows:
 
if (I.SFPA.Restart-pos &gt; V.Restart-pos) then
begin // invalid restart
Actions: Stop inactivity timer, // reset timer
Start inactivity timer;
Output: ESID(R=02), // to peer ODETTE-FTP
F_ABORT_IND(R,AO=L); // to User Monitor
New State: WF_NDISC;
end
else begin
Actions: Stop inactivity timer, // reset timer
Start inactivity timer;
Build F_START_FILE_CF(+) from I.SFPA
V.Credit_S = V.Window // initialise credit
Output: F_START_FILE_CF(+); // to User Monitor
New State: OPO;
end
 
 
 
 
 
 
 
Friend Informational [Page 96]
<a name="page-97"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
ODETTE-FTP checks the restart position in the received Start File
Positive Answer (SFPA) command. If it is invalid, it aborts the
session by sending an End Session (ESID) command to its peer and an
Abort indication (F_ABORT_IND) to its User Monitor. If the restart
position is valid, a Start File confirmation (F_START_FILE_CF) is
built and sent to the User Monitor, the credit window is initialised,
and the Open Out (OPO) state is entered.
 
<a name="section-10">10</a>. Miscellaneous
 
<a name="section-10.1">10.1</a>. Algorithm Choice
 
The choice of algorithms to use for security or compression between
partners is for bilateral agreement outside of ODETTE-FTP.
 
<a name="section-10.2">10.2</a>. Cryptographic Algorithms
 
The algorithms for symmetric and asymmetric cryptography and hashing
are represented by a coded value, the cipher suite:
 
Cipher Suite Symmetric Asymmetric Hashing
------------ ----------------- ------------ -------
 
<a name="section-01">01</a> 3DES_EDE_CBC_3KEY RSA_PKCS1_15 SHA-1
02 AES_256_CBC RSA_PKCS1_15 SHA-1
 
Support of all cipher suites listed here is mandatory.
 
The certificates used must be [<a href="#ref-X.509">X.509</a>] certificates.
 
TripleDES is using Cipher Block Chaining (CBC) mode for added
security and uses the Encryption Decryption Encryption (EDE) process
with 3 different 64-bit keys.
 
RSA padding is as defined in [PKCS#1].
 
AES is using a 256-bit key in CBC mode.
 
An extended list of optional cipher suites may be used (Section
10.3), but there is no guarantee that two communicating ODETTE-FTP
entities would both support these optional cipher suites.
 
<a name="section-10.3">10.3</a>. Protocol Extensions
 
The algorithms and file enveloping formats available in ODETTE-FTP
may be extended outside of this document.
 
 
 
 
 
Friend Informational [Page 97]
<a name="page-98"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
An up-to-date list of cipher suite values for use in ODETTE-FTP is
maintained by ODETTE International, and published on their website at
www.odette.org.
 
<a name="section-10.4">10.4</a>. Certificate Services
 
Certificates and certificate revocation lists may be exchanged as
[<a href="#ref-CMS">CMS</a>] enveloped files. It is therefore valid to exchange a [<a href="#ref-CMS">CMS</a>]
file that is neither encrypted, compressed, nor signed. It is an
application implementation issue to determine the correct course of
action on receipt of such a file.
 
<a name="section-11">11</a>. Security Considerations
 
ODETTE-FTP security requires the use of [<a href="#ref-X.509">X.509</a>] certificates. If no
security options are agreed for use, the send and receive passwords
are sent in plain text. Whilst this is acceptable over X.25 and ISDN
networks, this is a risky practice over insecure public networks such
as the Internet.
 
All, some, or none of the security options available in ODETTE-FTP
may be used. No recommendations for the use of these options are
provided in this specification. Whilst use of the highest-strength
encryption algorithms may seem admirable, there is often a
performance tradeoff to be made, and signing all files and
acknowledgements has potential legal implications that should be
considered.
 
It should be noted that whilst the security measures ensure that an
ODETTE-FTP partner is authenticated, it does not necessarily mean
that the partner is authorised. Having proven the identity of a
partner, it is an application issue to decide whether that partner is
allowed to connect or exchange files.
 
Extracted from [<a href="#ref-RFC3850">RFC3850</a>]:
 
"When processing certificates, there are many situations where the
processing might fail. Because the processing may be done by a user
agent, a security gateway, or other program, there is no single way
to handle such failures. Just because the methods to handle the
failures have not been listed, however, the reader should not assume
that they are not important. The opposite is true: if a certificate
is not provably valid and associated with the message, the processing
software should take immediate and noticeable steps to inform the end
user about it.
 
 
 
 
 
 
Friend Informational [Page 98]
<a name="page-99"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Some of the many situations in which signature and certificate
checking might fail include the following:
 
No certificate chain leads to a trusted CA
No ability to check the Certificate Revocation List (CRL) for a
certificate
An invalid CRL was received
The CRL being checked is expired
The certificate is expired
The certificate has been revoked
 
There are certainly other instances where a certificate may be
invalid, and it is the responsibility of the processing software to
check them all thoroughly, and to decide what to do if the check
fails. See <a href="http://ietfdocs.potaroo.net/idref/rfc3280">RFC 3280</a> for additional information on certificate path
validation."
 
The push / pull nature of ODETTE-FTP means that a party can make an
outbound connection from behind a firewall to another party and
exchange files in both directions. There is no need for both
partners to open ports on their firewalls to allow incoming
connections; only one party needs to allow incoming connections.
 
See <a href="#section-1.7">Section 1.7</a> for a discussion of the benefits of session security
[<a href="#ref-TLS">TLS</a>] versus file security.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 99]
<a name="page-100"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Appendix A. Virtual File Mapping Example
 
This example demonstrates the mapping of a Virtual File into a
sequence of ODETTE-FTP Data Exchange Buffers.
 
Each line in this extract from 'The Rime of the Ancient Mariner' by
Coleridge [<a href="#ref-RIME">RIME</a>] is separated by CR-LFs in a file that is being
transmitted as a T format file.
 
It is an ancient Mariner,
And he stoppeth one of three.
"By thy long grey beard and glittering eye,
Now wherefore stopp'st thou me?
 
"The Bridegroom's doors are opened wide,
And I am next of kin;
The guests are met, the feast is set:
May'st hear the merry din."
 
He holds him with his skinny hand,
"There was a ship," quoth he.
"Hold off! unhand me, grey-beard loon!"
Eftsoons his hand dropt he.
 
He holds him with his glittering eye--
The Wedding-Guest stood still,
And listens like a three years; child:
The Mariner hath his will.
 
The Wedding-Guest sat on a stone:
He cannot chuse but hear;
And thus spake on that ancient man,
The bright-eyed Mariner.
 
The ship was cheered, the harbour cleared,
Merrily did we drop
Below the kirk, below the hill,
Below the light-house top.
 
The Exchange Buffers below were built from the above. The top line
of each represents the ASCII code, while the two lines below give the
hexadecimal value.
 
Note that:
 
. The "D" at the beginning of each Exchange Buffer is the command
code.
 
 
 
 
Friend Informational [Page 100]
<a name="page-101"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
. The "?" preceding each subrecord is the header octet (see the
hexadecimal value).
 
Exchange Buffer 1
 
D?It is an ancient Mariner,..And he stoppeth one of three..."By
4347267266266666672467666720046626627767767626662662767662002472
4F9409301E01E395E40D129E52CDA1E4085034F005480FE50F6048255EDA2290
 
t?hy long grey beard and glittering eye,..Now wherefore stopp'st
7367266662676726667626662666776766626762004672766766676277677277
4F890CFE70725902512401E407C944529E70595CDAEF70785256F25034F00734
 
?thou me?...."The Bridegroom's doors are opened wide,..And I am
2376672663000025662476666766627266677267626766662766620046624266
0F48F50D5FDADA248502294572FFD7304FF2301250F05E5407945CDA1E40901D
 
?next of kin;..The guests are met, the feast is set:..May'st he
2366772662666300566267677726762667227662666772672767300467277266
0FE5840F60B9EBDA485075534301250D54C04850651340930354ADAD19734085
 
a?r the merry din."....He holds him with his skinny hand,.."Ther
6372766266777266622000046266667266627676266727666672666620025667
1F204850D5229049EE2DADA8508FC43089D07948089303B9EE9081E4CDA24852
 
e? was a ship," quoth he..."Hold off! unhand me, grey-beard loon
6327672627667222776762662002466626662276666626622676726667626666
5F07130103890C2015F48085EDA28FC40F66105E81E40D5C07259D251240CFFE
 
!?"..Eftsoons his hand dropt he.....He holds him with his glitte
2320046776667266726666267677266200004626666726662767626672666776
1F2DA5643FFE30893081E4042F04085EDADA8508FC43089D07948089307C9445
 
r?ing eye--..The Wedding-Guest stood still,..And listens like a
7366626762200566256666662476772776662776662004662667766726666262
2F9E70595DDDA485075449E7D75534034FF40349CCCDA1E40C9345E30C9B5010
 
t?hree years; child:..The Mariner hath his will.....The Wedding-
7367662766773266666300566246766672667626672766620000566256666662
4F8255095123B0389C4ADA4850D129E52081480893079CCEDADA485075449E7D
 
G?uest sat on a stone:..He cannot chuse but hear;..And thus spak
4376772767266262776663004626666672667762677266673004662767727766
7F553403140FE01034FE5ADA85031EEF4038535025408512BDA1E4048530301B
 
e? on that ancient man,..The bright-eyed Mariner.....The ship wa
6326627667266666672666200566267666726766246766672000056627667276
5F0FE0481401E395E40D1ECDA4850229784D59540D129E52EDADA48503890071
 
 
 
Friend Informational [Page 101]
<a name="page-102"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
s? cheered, the harbour cleared,..Merrily did we drop..Below the
7326666766227662667667726666766200467766726662762676700466672766
3F03855254C048508122F5203C51254CDAD5229C90494075042F0DA25CF70485
 
.kirk, below the hill,..Below the light-house top...
2B667622666672766266662004666727662666672667762767200
03B92BC025CF70485089CCCDA25CF704850C9784D8F53504F0EDA
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Friend Informational [Page 102]
<a name="page-103"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Appendix B. ISO 646 Character Subset
 
o-----------------------------------------------------------------o
| | 7| 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
| | B -+-----+-----+-----+-----+-----+-----+-----+-----|
| | I 6| 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 |
| | T -+-----+-----+-----+-----+-----+-----+-----+-----|
| | 5| 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 |
| |----+-----+-----+-----+-----+-----+-----+-----+-----|
| | | | | | | | | | |
| | | | | | | | | | |
|------------| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| BIT | | | | | | | | | |
| 4 3 2 1 | | | | | | | | | |
|============o====o=====+=====+=====+=====+=====+=====+=====+=====|
| 0 0 0 0 | 0 | | | SP | 0 | | P | | |
|------------|----|-----+-----+-----+-----+-----+-----+-----+-----|
| 0 0 0 1 | 1 | | | | 1 | A | Q | | |
|------------+----|-----+-----+-----+-----+-----+-----+-----+-----|
| 0 0 1 0 | 2 | | | | 2 | B | R | | |
|------------+----|-----+-----+-----+-----+-----+-----+-----+-----|
| 0 0 1 1 | 3 | | | | 3 | C | S | | |
|------------+----|-----+-----+-----+-----+-----+-----+-----+-----|
| 0 1 0 0 | 4 | | | | 4 | D | T | | |
|------------+----|-----+-----+-----+-----+-----+-----+-----+-----|
| 0 1 0 1 | 5 | | | | 5 | E | U | | |
|------------+----|-----+-----+-----+-----+-----+-----+-----+-----|
| 0 1 1 0 | 6 | | | &amp; | 6 | F | V | | |
|------------+----|-----+-----+-----+-----+-----+-----+-----+-----|
| 0 1 1 1 | 7 | | | | 7 | G | W | | |
|------------+----|-----+-----+-----+-----+-----+-----+-----+-----|
| 1 0 0 0 | 8 | | | ( | 8 | H | X | | |
|------------+----|-----+-----+-----+-----+-----+-----+-----+-----|
| 1 0 0 1 | 9 | | | ) | 9 | I | Y | | |
|------------+----|-----+-----+-----+-----+-----+-----+-----+-----|
| 1 0 1 0 | 10 | | | | | J | Z | | |
|------------+----|-----+-----+-----+-----+-----+-----+-----+-----|
| 1 0 1 1 | 11 | | | | | K | | | |
|------------+----|-----+-----+-----+-----+-----+-----+-----+-----|
| 1 1 0 0 | 12 | | | | | L | | | |
|------------+----|-----+-----+-----+-----+-----+-----+-----+-----|
| 1 1 0 1 | 13 | | | - | | M | | | |
|------------+----|-----+-----+-----+-----+-----+-----+-----+-----|
| 1 1 1 0 | 14 | | | . | | N | | | |
|------------+----|-----+-----+-----+-----+-----+-----+-----+-----|
| 1 1 1 1 | 15 | | | / | | O | | | |
o-----------------------------------------------------------------o
 
 
 
 
Friend Informational [Page 103]
<a name="page-104"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Appendix C. X.25 Specific Information
 
The International Organization for Standardization (ISO) Open Systems
Interconnection (OSI) model is the basis for ODETTE-FTP.
 
ODETTE-FTP covers levels 4 to 7, and originally CCITT X.25 was the
only recommended telecommunication protocol for OSI's layers 1, 2, 3.
 
ISO Reference Model:
 
+------------------------------+ &lt;==== File Service
| Level-7 FTP application |
|------------------------------|
| Level-6 FTP presentation |
|------------------------------|
| Level-5 FTP session |
|------------------------------|
| Level-4 FTP transport |
|------------------------------| &lt;==== Network Service
| Level-3 X.25 |
|------------------------------|
| Level-2 X.25 |
|------------------------------|
| Level-1 X.25 |
+------------------------------+
 
C.1. X.25 Addressing Restrictions
 
When an X.25 call is made over a PSDN, the Network User Address (NUA)
of the destination must be specified in order that the PTT may route
the call. The call placed is directed to the termination equipment
upon the user's premises.
 
It is possible to provide extra information in the Call Request
Packet in addition to the mandatory NUA required by the PTT.
 
This extra information may be of 2 kinds:
 
(a) A subaddress:
 
It is simply an extension to the address and it is put into the
called address field of the Call Request Packet. This
information (Address + Subaddress) is taken from the destination
address field of the F_CONNECT_RQ; therefore, from the user's
point of view, there is no distinction between the main address
and subaddress parts.
 
 
 
 
 
Friend Informational [Page 104]
<a name="page-105"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
(b) User data:
 
There is no standard for user data. Moreover, there is no
information in the F_CONNECT_RQ from which the ODETTE-entity may
derive user data to be put in the N_CONNECT_RQ; therefore, user
data shall not be used.
 
C.2. Special Logic
 
The SSID field SSIDSPEC specifies whether special logic must be
applied (Y (yes) or N (no)) to the Data Exchange Buffer before the
ODETTE-FTP moves the data into the NSDU (Network Service Data Unit)
and passes control to the Network Service.
 
C.2.1. When Special Logic Is Not To Be Used
 
This logic is not applied to SSRM and SSID commands.
 
C.2.2. The Need for "Enveloping" Exchange Buffers
 
The "special-logic" parameter was created in order to allow the use
of ODETTE-FTP over asynchronous links. The "special-logic" could be
needed to enable terminals to access an X.25 network via an
asynchronous entry (through a PAD: Packet Assembly / Disassembly).
The "special-logic" is not needed in case of a whole X.25 connection.
This "special-logic" realises a CRC function in order to detect
errors due to the asynchronous medium.
 
Negotiation of the "special-logic" parameter in the SSID command is
as follows:
 
SSID SSID
-----------------------------------------------
 
special-logic=yes ---------------------&gt;
 
&lt;------------------------------------ special-logic=yes
or
&lt;------------------------------------ special-logic=no
 
special-logic=no ----------------------&gt;
 
&lt;------------------------------------ special-logic=no
 
This logic is activated when the "special-logic" parameter in the
SSID specifies Y (yes).
 
 
 
 
 
Friend Informational [Page 105]
<a name="page-106"> </a>
<a href="http://ietfdocs.potaroo.net/idref/rfc5024">RFC 5024</a> ODETTE FTP 2 November 2007
 
 
Special logic processing, when activated, will function within level
4 of the OSI model.
 
+------------------------------+ &lt;==== File Service
| Level-7 FTP application |
|------------------------------|
| Level-6 FTP presentation |
|------------------------------|
| Level-5 FTP session |
|------------------------------|
| Level-4 FTP transport |
| SPECIAL LOGIC PROCESSING |
|------------------------------| &lt;==== Network Service
| Level-3 X.25 |
|------------------------------|
| Level-2 X.25 |
|------------------------------|
| Level-1 X.25 |
+------------------------------+
 
C.2.3. Responsibilities of Special Logic
 
When transmitting an Exchange Buffer and special logic is active,
layer 4 will wrap the Exchange Buffer in synchronization and
delineation characters, then protect the data integrity by means of a
block checksum (BCS). When receiving an Exchange Buffer and special
logic is active, layer 4 will remove such things as synchronization
and delineation characters, etc., before passing the Exchange Buffer
to the higher layers.
 
C.2.4. Extended Exchange Buffer Format
 
Each envelope has a 1-byte header prefixed to it, and a 2-byte
checksum appended to the end. The checksum is derived in a manner
specified in the ISO DIS 8073 TRANSPORT LAYER documentation.