diff options
Diffstat (limited to 'lib/cosFileTransfer')
46 files changed, 0 insertions, 6474 deletions
diff --git a/lib/cosFileTransfer/AUTHORS b/lib/cosFileTransfer/AUTHORS deleted file mode 100644 index 55d8059989..0000000000 --- a/lib/cosFileTransfer/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -Original Authors: -Niclas Eklund - -Contributors: diff --git a/lib/cosFileTransfer/Makefile b/lib/cosFileTransfer/Makefile deleted file mode 100644 index c9c07dcdad..0000000000 --- a/lib/cosFileTransfer/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2016. All Rights Reserved. -# -# 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. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include vsn.mk -VSN=$(COSFILETRANSFER_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- -# SUB_DIRECTORIES = src test examples doc/src -# At the moment we don't have any example programs. -SUB_DIRECTORIES = src doc/src - -SPECIAL_TARGETS = - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk diff --git a/lib/cosFileTransfer/doc/html/.gitignore b/lib/cosFileTransfer/doc/html/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/cosFileTransfer/doc/html/.gitignore +++ /dev/null diff --git a/lib/cosFileTransfer/doc/man3/.gitignore b/lib/cosFileTransfer/doc/man3/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/cosFileTransfer/doc/man3/.gitignore +++ /dev/null diff --git a/lib/cosFileTransfer/doc/man6/.gitignore b/lib/cosFileTransfer/doc/man6/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/cosFileTransfer/doc/man6/.gitignore +++ /dev/null diff --git a/lib/cosFileTransfer/doc/pdf/.gitignore b/lib/cosFileTransfer/doc/pdf/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/cosFileTransfer/doc/pdf/.gitignore +++ /dev/null diff --git a/lib/cosFileTransfer/doc/src/CosFileTransfer.gif b/lib/cosFileTransfer/doc/src/CosFileTransfer.gif Binary files differdeleted file mode 100644 index 16970ad5ad..0000000000 --- a/lib/cosFileTransfer/doc/src/CosFileTransfer.gif +++ /dev/null diff --git a/lib/cosFileTransfer/doc/src/CosFileTransfer_Directory.xml b/lib/cosFileTransfer/doc/src/CosFileTransfer_Directory.xml deleted file mode 100644 index da5810521a..0000000000 --- a/lib/cosFileTransfer/doc/src/CosFileTransfer_Directory.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> - <header> - <copyright> - <year>2000</year> - <year>2016</year> - <holder>Ericsson AB, All Rights Reserved</holder> - </copyright> - <legalnotice> - 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. - - The Initial Developer of the Original Code is Ericsson AB. - </legalnotice> - - <title>CosFileTransfer_Directory</title> - <prepared></prepared> - <docno></docno> - <checked></checked> - <date>2000-11-09</date> - <rev>PA1</rev> - </header> - <module>CosFileTransfer_Directory</module> - <modulesummary>This module implements the OMG CosFileTransfer::Directory interface.</modulesummary> - <description> - <p>To get access to the record definitions for the structures use: <br></br> -<c>-include_lib("cosFileTransfer/include/*.hrl").</c></p> - <p>This module also exports the functions described in:</p> - <list type="bulleted"> - <item> - <p><seealso marker="CosFileTransfer_File">CosFileTransfer_File</seealso></p> - </item> - <item> - <p>CosPropertyService_PropertySetDef in the cosProperty application.</p> - </item> - </list> - </description> - <funcs> - <func> - <name>list(Directory, Max) -> Return</name> - <fsummary>Return a list, of length <c>Max</c>or less, containing Object References representing files or directories contained within the target Directory and a <c>FileIterator</c>or a <c>NIL</c>object</fsummary> - <type> - <v>Directory = #objref</v> - <v>Return = {ok, FileList, FileIterator}</v> - <v>FileList = [File]</v> - <v>File = FileIterator = #objref</v> - </type> - <desc> - <p>This operation returns a list, of length <c>Max</c> or less, containing - Object References representing files or directories contained within - the target Directory. If the amount of objects found is less than <c>Max</c> - the returned Iterator will be a <c>NIL</c> object.</p> - </desc> - </func> - </funcs> - -</erlref> - diff --git a/lib/cosFileTransfer/doc/src/CosFileTransfer_File.xml b/lib/cosFileTransfer/doc/src/CosFileTransfer_File.xml deleted file mode 100644 index 373c14d1f1..0000000000 --- a/lib/cosFileTransfer/doc/src/CosFileTransfer_File.xml +++ /dev/null @@ -1,94 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> - <header> - <copyright> - <year>2000</year> - <year>2016</year> - <holder>Ericsson AB, All Rights Reserved</holder> - </copyright> - <legalnotice> - 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. - - The Initial Developer of the Original Code is Ericsson AB. - </legalnotice> - - <title>CosFileTransfer_File</title> - <prepared></prepared> - <docno></docno> - <approved></approved> - <checked></checked> - <date>2000-11-09</date> - <rev>PA1</rev> - </header> - <module>CosFileTransfer_File</module> - <modulesummary>This module implements the OMG CosFileTransfer::File interface.</modulesummary> - <description> - <p>To get access to the record definitions for the structures use: <br></br> -<c>-include_lib("cosFileTransfer/include/*.hrl").</c></p> - <p>This module also exports the functions described in:</p> - <list type="bulleted"> - <item> - <p>CosPropertyService_PropertySetDef in the cosProperty application.</p> - </item> - </list> - </description> - <funcs> - <func> - <name>'_get_name'(File) -> string()</name> - <fsummary>Return the target object's associated name</fsummary> - <type> - <v>File = #objref</v> - </type> - <desc> - <p>This read only attribute represents the target object's associated name.</p> - </desc> - </func> - <func> - <name>'_get_complete_file_name'(File) -> string()</name> - <fsummary>Return the target object's associated absolute name.</fsummary> - <type> - <v>File = #objref</v> - </type> - <desc> - <p>This read only attribute represents the target object's associated - absolute name.</p> - </desc> - </func> - <func> - <name>'_get_parent'(File) -> Directory</name> - <fsummary>Return the target object's container.</fsummary> - <type> - <v>File = Directory = #objref</v> - </type> - <desc> - <p>This read only attribute represents the target object's container. - In some cases a <c>NIL</c> object will be returned.</p> - </desc> - </func> - <func> - <name>'_get_associated_session'(File) -> FileTransferSession</name> - <fsummary>Return the target object's associated <c>FileTransferSession</c></fsummary> - <type> - <v>File = FileTransferSession = #objref</v> - </type> - <desc> - <p>This read only attribute represents the target object's associated - <c>FileTransferSession</c>.</p> - </desc> - </func> - </funcs> - -</erlref> - diff --git a/lib/cosFileTransfer/doc/src/CosFileTransfer_FileIterator.xml b/lib/cosFileTransfer/doc/src/CosFileTransfer_FileIterator.xml deleted file mode 100644 index f5c219b9c1..0000000000 --- a/lib/cosFileTransfer/doc/src/CosFileTransfer_FileIterator.xml +++ /dev/null @@ -1,86 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> - <header> - <copyright> - <year>2000</year><year>2016</year> - <holder>Ericsson AB. All Rights Reserved.</holder> - </copyright> - <legalnotice> - 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. - - </legalnotice> - - <title>CosFileTransfer_FileIterator</title> - <prepared></prepared> - <docno></docno> - <checked></checked> - <date>2000-11-09</date> - <rev>PA1</rev> - </header> - <module>CosFileTransfer_FileIterator</module> - <modulesummary>This module implements the OMG CosFileTransfer::FileIterator interface.</modulesummary> - <description> - <p>To get access to the record definitions for the structures use: <br></br> -<c>-include_lib("cosFileTransfer/include/*.hrl").</c></p> - </description> - <funcs> - <func> - <name>next_one(Iterator) -> Return</name> - <fsummary>Return the next <c>FileWrapper</c>and a boolean which indicate whether the <c>FileWrapper</c>is valid or not.</fsummary> - <type> - <v>Iterator = #objref</v> - <v>Return = {boolean(), #'CosFileTransfer_FileWrapper'{the_file = File file_type = Type}}</v> - <v>File = #objref</v> - <v>Type = nfile | ndirectory</v> - </type> - <desc> - <p>This operation returns true if a <c>FileWrapper</c> exists at the - current position and the out parameter contains a valid <c>File</c> - reference. If false is returned the out parameter is a non-valid - <c>FileWrapper</c>.</p> - </desc> - </func> - <func> - <name>next_n(Iterator, Max) -> Return</name> - <fsummary>Return a list, of length <c>Max</c>or less, containing <c>FileWrappers</c>and a boolean which indicates if more <c>FileWrappers</c>exists</fsummary> - <type> - <v>Iterator = #objref</v> - <v>Max = unsigned long()</v> - <v>Return = {boolean(), FileList}</v> - <v>FileList = [#'CosFileTransfer_FileWrapper'{the_file = File file_type = Type}]</v> - <v>File = #objref</v> - <v>Type = nfile | ndirectory</v> - </type> - <desc> - <p>This operation returns true if the requested number of <c>FileWrappers</c> - can be delivered and there are additional <c>FileWrappers</c>. If false is - returned a list, of length <c>Max</c> or less, containing the last valid - <c>FileWrappers</c> associated with the target object.</p> - </desc> - </func> - <func> - <name>destroy(Iterator) -> ok</name> - <fsummary>Terminate the target object</fsummary> - <type> - <v>Iterator = #objref</v> - </type> - <desc> - <p>This operation terminates the target object.</p> - </desc> - </func> - </funcs> - -</erlref> - diff --git a/lib/cosFileTransfer/doc/src/CosFileTransfer_FileTransferSession.xml b/lib/cosFileTransfer/doc/src/CosFileTransfer_FileTransferSession.xml deleted file mode 100644 index 312af3b8c2..0000000000 --- a/lib/cosFileTransfer/doc/src/CosFileTransfer_FileTransferSession.xml +++ /dev/null @@ -1,191 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> - <header> - <copyright> - <year>2000</year><year>2016</year> - <holder>Ericsson AB. All Rights Reserved.</holder> - </copyright> - <legalnotice> - 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. - - </legalnotice> - - <title>CosFileTransfer_FileTransferSession</title> - <prepared></prepared> - <docno></docno> - <checked></checked> - <date>2000-11-09</date> - <rev>PA1</rev> - </header> - <module>CosFileTransfer_FileTransferSession</module> - <modulesummary>This module implements the OMG CosFileTransfer::FileTransferSession interface.</modulesummary> - <description> - <p>To get access to the record definitions for the structures use: <br></br> -<c>-include_lib("cosFileTransfer/include/*.hrl").</c></p> - </description> - <funcs> - <func> - <name>'_get_protocols_supported'(FTS) -> Return</name> - <fsummary>Return the protocols supported by the target object</fsummary> - <type> - <v>FTS = #objref</v> - <v>Return = [#'CosFileTransfer_ProtocolSupport'{protocol_name=Type, addresses=[Address]}]</v> - <v>Type = Address = string()</v> - </type> - <desc> - <p>This read only attribute returns the protocols supported by the - target object.</p> - </desc> - </func> - <func> - <name>set_directory(FTS, Directory) -> Return</name> - <fsummary>Change the current working directory of the target object's associated file system</fsummary> - <type> - <v>FTS = Directory = #objref</v> - <v>Return = ok | {'EXCEPTION, E}</v> - </type> - <desc> - <p>Invoking this operation will change the current working directory of - the target object's associated file system. If fail to do so the - appropriate exception is raised. </p> - </desc> - </func> - <func> - <name>create_file(FTS, FileNameList) -> Return</name> - <fsummary>Create a <c>File</c>Object representing a file which may or may not exist</fsummary> - <type> - <v>FTS = #objref</v> - <v>FileNameList = [string()]</v> - <v>Return = File | {'EXCEPTION, E}</v> - <v>File = #objref</v> - </type> - <desc> - <p>This operation creates a <c>File</c> Object representing a file which - may or may not exist. - For this operation to be independent of the working directory the - supplied <c>FileNameList</c> must represent the absolute name.</p> - </desc> - </func> - <func> - <name>create_directory(FTS, FileNameList) -> Return</name> - <fsummary>Create a new directory in the target objects associated file systems domain</fsummary> - <type> - <v>FTS = #objref</v> - <v>FileNameList = [string()]</v> - <v>Return = Directory | {'EXCEPTION, E}</v> - <v>Directory = #objref</v> - </type> - <desc> - <p>This operation creates a new directory in the target objects associated - file systems domain. If fail to do so an exception is raised but, - if successful, a <c>Directory</c> object representing the new - directory is returned.</p> - </desc> - </func> - <func> - <name>get_file(FTS, FileNameList) -> Return</name> - <fsummary>Create a <c>FileWrapper</c>which represents a file or directory</fsummary> - <type> - <v>FTS = #objref</v> - <v>FileNameList = [string()]</v> - <v>Return = FileWrapper | {'EXCEPTION, E}</v> - <v>FileWrapper = #'CosFileTransfer_FileWrapper'{the_file = File file_type = Type}</v> - <v>File = #objref</v> - <v>Type = nfile | ndirectory</v> - </type> - <desc> - <p>This operation, creates a <c>FileWrapper</c> which represents a file or directory, and - should be independent of the working Directory, - i.e., a full path name must be supplied. Furthermore, the file or - directory represented by the <c>FileNameList</c> must exist.</p> - </desc> - </func> - <func> - <name>delete(FTS, File) -> Return</name> - <fsummary>Delete the file or directory, represented by the <c>File</c>object, from the target objects associated file system</fsummary> - <type> - <v>FTS = File = #objref</v> - <v>Return = ok | {'EXCEPTION', E}</v> - </type> - <desc> - <p>This operation removes the file or directory, represented by the <c>File</c> - object, from the target objects associated file system. If it is a non-empty - directory or non-existing file or directory an exception is raised.</p> - </desc> - </func> - <func> - <name>transfer(FTS, SourceFile, DestinationFile) -> Return</name> - <fsummary>Copy the file represented by the <c>SourceFile</c>from the target object's file system to a file in the destination <c>FileTransferSession's</c>file system</fsummary> - <type> - <v>FTS = SourceFile = DestinationFile = #objref</v> - <v>Return = ok | {'EXCEPTION', E}</v> - </type> - <desc> - <p>If the target object's and the <c>DestinationFile's</c> associated - <c>FileTransferSession's</c> support the same protocol(s) this operation - will copy the file represented by the <c>SourceFile</c> from the target - object's file system to a file in the destination - <c>FileTransferSession's</c> file system. The file is represented by the - <c>DestinationFile</c> object and may not exist. - This operation must be invoked on the <c>FileTransferSession</c> - associated with the <c>SourceFile</c> object.</p> - </desc> - </func> - <func> - <name>append(FTS, SourceFile, DestinationFile) -> Return</name> - <fsummary>Append the file represented by the <c>SourceFile</c>from the target object's file system to a file in the destination <c>FileTransferSession's</c>file system</fsummary> - <type> - <v>FTS = SourceFile = DestinationFile = #objref</v> - <v>Return = ok | {'EXCEPTION', E}</v> - </type> - <desc> - <p>This operation behaves almost like the <c>transfer/3</c> operation. The - difference is that the <c>DestinationFile</c> must exist since the - <c>SourceFile</c> will be appended to the <c>DestinationFile</c>.</p> - <p>Currently, it is not possible to use this operation when the target - object represents FTP.</p> - </desc> - </func> - <func> - <name>insert(FTS, SourceFile, DestinationFile, Offset) -> Return</name> - <fsummary>Insert the <c>SourceFile</c>into the <c>DestinationFile</c> <c>Offset</c>bytes from the start of the file</fsummary> - <type> - <v>FTS = SourceFile = DestinationFile = #objref</v> - <v>Offset = long()</v> - <v>Return = ok | {'EXCEPTION', E}</v> - </type> - <desc> - <p>This operation behaves almost like the <c>append/3</c> operation. The - difference is that the <c>SourceFile</c> will be inserted into the - <c>DestinationFile</c> <c>Offset</c> bytes from the start of the file.</p> - <p>Currently, it is not possible to use this operation when the target - object represents FTP.</p> - </desc> - </func> - <func> - <name>logout(FTS) -> ok</name> - <fsummary>Terminate the target object and close the connection to the file system it represents</fsummary> - <type> - <v>FTS = #objref</v> - </type> - <desc> - <p>This operation terminates the target object and closes the connection - to the file system it represents.</p> - </desc> - </func> - </funcs> - -</erlref> - diff --git a/lib/cosFileTransfer/doc/src/CosFileTransfer_VirtualFileSystem.xml b/lib/cosFileTransfer/doc/src/CosFileTransfer_VirtualFileSystem.xml deleted file mode 100644 index 701e56e660..0000000000 --- a/lib/cosFileTransfer/doc/src/CosFileTransfer_VirtualFileSystem.xml +++ /dev/null @@ -1,83 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> - <header> - <copyright> - <year>2000</year> - <year>2016</year> - <holder>Ericsson AB, All Rights Reserved</holder> - </copyright> - <legalnotice> - 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. - - The Initial Developer of the Original Code is Ericsson AB. - </legalnotice> - - <title>CosFileTransfer_VirtualFileSystem</title> - <prepared></prepared> - <docno></docno> - <checked></checked> - <date>2000-11-09</date> - <rev>PA1</rev> - </header> - <module>CosFileTransfer_VirtualFileSystem</module> - <modulesummary>This module implements the OMG CosFileTransfer::VirtualFileSystem interface.</modulesummary> - <description> - <p>To get access to the record definitions for the structures use: <br></br> -<c>-include_lib("cosFileTransfer/include/*.hrl").</c></p> - </description> - <funcs> - <func> - <name>'_get_file_system_type'(VFS) -> Return</name> - <fsummary>Return the target object's associated file system</fsummary> - <type> - <v>VFS = #objref</v> - <v>Return = 'FTP' | 'NATIVE'</v> - </type> - <desc> - <p>This read only attribute represents the target object's associated - file system.</p> - </desc> - </func> - <func> - <name>'_get_supported_content_types'(VFS) -> Return</name> - <fsummary>Return the target object's supported content types.</fsummary> - <type> - <v>VFS = #objref</v> - <v>Return = </v> - </type> - <desc> - <p>This read only attribute represents the target object's supported - content types.</p> - </desc> - </func> - <func> - <name>login(VFS, User, Password, Account) -> Return</name> - <fsummary>Create a new instance of a <c>FileTransferSession</c>and a <c>Directory</c></fsummary> - <type> - <v>VFS = #objref</v> - <v>User = Password = Account = string()</v> - <v>Return = {FileTransferSession, Directory} | {'EXCEPTION', E}</v> - <v>FileTransferSession = Directory = #objref</v> - </type> - <desc> - <p>This operation creates a new instance of a <c>FileTransferSession</c> - and a <c>Directory</c>. The later represents the current working - directory of the returned <c>FileTransferSession</c>.</p> - </desc> - </func> - </funcs> - -</erlref> - diff --git a/lib/cosFileTransfer/doc/src/Makefile b/lib/cosFileTransfer/doc/src/Makefile deleted file mode 100644 index fcaa88c1e2..0000000000 --- a/lib/cosFileTransfer/doc/src/Makefile +++ /dev/null @@ -1,142 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2017. All Rights Reserved. -# -# 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. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(COSFILETRANSFER_VSN) -APPLICATION=cosFileTransfer - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -XML_APPLICATION_FILES = ref_man.xml -XML_REF3_FILES = \ - cosFileTransferApp.xml \ - CosFileTransfer_Directory.xml \ - CosFileTransfer_File.xml \ - CosFileTransfer_VirtualFileSystem.xml \ - CosFileTransfer_FileTransferSession.xml \ - CosFileTransfer_FileIterator.xml - -XML_PART_FILES = \ - part.xml -XML_CHAPTER_FILES = \ - ch_contents.xml \ - ch_introduction.xml \ - ch_install.xml \ - ch_system.xml \ - ch_example.xml \ - notes.xml - -BOOK_FILES = book.xml - -XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ - $(XML_PART_FILES) $(XML_CHAPTER_FILES) - -TECHNICAL_DESCR_FILES = - -GIF_FILES = \ - CosFileTransfer.gif - -PS_FILES = - -# ---------------------------------------------------- - -INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html) - -HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) - - -INFO_FILE = ../../info - -EXTRA_FILES = \ - $(DEFAULT_GIF_FILES) \ - $(DEFAULT_HTML_FILES) \ - $(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) - -MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) - -HTML_REF_MAN_FILE = $(HTMLDIR)/index.html - -TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -XML_FLAGS += -DVIPS_FLAGS += - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -$(HTMLDIR)/%.gif: %.gif - $(INSTALL_DATA) $< $@ - -docs: pdf html man - -$(TOP_PDF_FILE): $(XML_FILES) - -pdf: $(TOP_PDF_FILE) - -html: gifs $(HTML_REF_MAN_FILE) - -clean clean_docs: - rm -rf $(HTMLDIR)/* - rm -f $(MAN3DIR)/* - rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) - rm -f errs core *~ - -man: $(MAN3_FILES) - -gifs: $(GIF_FILES:%=$(HTMLDIR)/%) - -$(INDEX_TARGET): $(INDEX_SRC) - sed -e 's;%VSN%;$(VSN);' $(INDEX_SRC) > $(INDEX_TARGET) - -debug opt: - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_docs_spec: docs - $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DIR) "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(HTMLDIR)/* \ - "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" - $(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3" - -release_spec: diff --git a/lib/cosFileTransfer/doc/src/book.xml b/lib/cosFileTransfer/doc/src/book.xml deleted file mode 100644 index 9a9ec3d0a2..0000000000 --- a/lib/cosFileTransfer/doc/src/book.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE book SYSTEM "book.dtd"> - -<book xmlns:xi="http://www.w3.org/2001/XInclude"> - <header titlestyle="normal"> - <copyright> - <year>2000</year><year>2016</year> - <holder>Ericsson AB. All Rights Reserved.</holder> - </copyright> - <legalnotice> - 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. - - </legalnotice> - - <title>cosFileTransfer</title> - <prepared></prepared> - <docno></docno> - <date>2000-08-24</date> - <rev>1.0</rev> - </header> - <insidecover> - </insidecover> - <pagetext>cosFileTransfer</pagetext> - <preamble> - <contents level="2"></contents> - </preamble> - <parts lift="no"> - <xi:include href="part.xml"/> - </parts> - <applications> - <xi:include href="ref_man.xml"/> - </applications> - <releasenotes> - <xi:include href="notes.xml"/> - </releasenotes> - <listofterms></listofterms> - <index></index> -</book> - diff --git a/lib/cosFileTransfer/doc/src/ch_contents.xml b/lib/cosFileTransfer/doc/src/ch_contents.xml deleted file mode 100644 index bd4ed5116f..0000000000 --- a/lib/cosFileTransfer/doc/src/ch_contents.xml +++ /dev/null @@ -1,75 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> - -<chapter> - <header> - <copyright> - <year>2000</year><year>2016</year> - <holder>Ericsson AB. All Rights Reserved.</holder> - </copyright> - <legalnotice> - 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. - - </legalnotice> - - <title>The cosFileTransfer Application</title> - <prepared></prepared> - <docno></docno> - <date>2000-08-24</date> - <rev>1.0</rev> - <file>ch_contents.xml</file> - </header> - - <section> - <title>Content Overview</title> - <p>The cosFileTransfer documentation is divided into three sections: - </p> - <list type="bulleted"> - <item> - <p>PART ONE - The User's Guide - <br></br> -Description of the cosFileTransfer Application including - services and a small tutorial demonstrating - the development of a simple service.</p> - </item> - <item> - <p>PART TWO - Release Notes - <br></br> -A concise history of cosFileTransfer.</p> - </item> - <item> - <p>PART THREE - The Reference Manual - <br></br> - A quick reference guide, including a - brief description, to all the functions available in cosFileTransfer.</p> - </item> - </list> - </section> - - <section> - <title>Brief description of the User's Guide</title> - <p>The User's Guide contains the following parts:</p> - <list type="bulleted"> - <item> - <p>cosFileTransfer overview</p> - </item> - <item> - <p>cosFileTransfer installation</p> - </item> - <item> - <p>A tutorial example</p> - </item> - </list> - </section> -</chapter> - diff --git a/lib/cosFileTransfer/doc/src/ch_example.xml b/lib/cosFileTransfer/doc/src/ch_example.xml deleted file mode 100644 index 7e3c65eedd..0000000000 --- a/lib/cosFileTransfer/doc/src/ch_example.xml +++ /dev/null @@ -1,96 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> - -<chapter> - <header> - <copyright> - <year>2000</year><year>2016</year> - <holder>Ericsson AB. All Rights Reserved.</holder> - </copyright> - <legalnotice> - 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. - - </legalnotice> - - <title>cosFileTransfer Examples</title> - <prepared></prepared> - <docno></docno> - <date>2000-08-24</date> - <rev>A</rev> - <file>ch_example.xml</file> - </header> - - <section> - <title>A tutorial on how to create a simple service</title> - - <section> - <title>Initiate the application</title> - <p>To use the complete cosFileTransfer application cosProperty - must be installed.</p> - </section> - - <section> - <title>How to run everything</title> - <p>Below is a short transcript on how to run cosFileTransfer. </p> - <code type="none"> - -%% Start Mnesia and Orber -mnesia:delete_schema([node()]), -mnesia:create_schema([node()]), -orber:install([node()]), -mnesia:start(), -orber:start(), - -%% The File Transfer Service depends on the cosProperty -%% application. Hence, we must install cosProperty first. -%% It's NOT necessary to invoke cosProperty:install_db(). -cosProperty:install(), - -%% Install File Transfer Service in the IFR. -cosFileTransfer:install(), - -%% Now start the application and necessary services. -cosFileTransfer:start(), - -%% Create two Virtual File Systems respectively representing an FTP- -%% and the local NFS file system. -VFSFTP = cosFileTransferApp:create_VFS('FTP', [], FTPHost, 21), -VFSNATIVE = cosFileTransferApp: - create_VFS({'NATIVE', 'cosFileTransferNATIVE_file'}, - [], MyLocalHost, 0), - -%% Login to each system. -{FSFTP, DirFTP} = 'CosFileTransfer_VirtualFileSystem': - login(VFSFTP, "myId", "myPwd", "myAccount"), -{FSNATIVE, DirNATIVE} = 'CosFileTransfer_VirtualFileSystem': - login(VFSNATIVE, "myId", "myPwd", "myAccount"), - -%% If we want to copy a file from the NFS to the FTP we must first -%% create a File object which contains its attributes. -Target = 'CosFileTransfer_FileTransferSession':create_file(FSFTP, - ["/", "ftp", "incoming", "targetFile"])), - - #'CosFileTransfer_FileWrapper'{the_file = Dir} = -%% Lookup the file we want to copy. -FileWrapper = 'CosFileTransfer_FileTransferSession':get_file(FSNATIVE, - ["/", "home", "myId", "sourceFile"]), -Source = FileWrapper#'CosFileTransfer_FileWrapper'.the_file, - -%% Now we are ready to transfer the file. Please note that we most -%% call the source Session object. -'CosFileTransfer_FileTransferSession':transfer(FSNATIVE, Source, Target), - </code> - </section> - </section> -</chapter> - diff --git a/lib/cosFileTransfer/doc/src/ch_install.xml b/lib/cosFileTransfer/doc/src/ch_install.xml deleted file mode 100644 index 9681f98b45..0000000000 --- a/lib/cosFileTransfer/doc/src/ch_install.xml +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> - -<chapter> - <header> - <copyright> - <year>2000</year><year>2016</year> - <holder>Ericsson AB. All Rights Reserved.</holder> - </copyright> - <legalnotice> - 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. - - </legalnotice> - - <title>Installing cosFileTransfer</title> - <prepared></prepared> - <docno></docno> - <date>2000-08-24</date> - <rev></rev> - <file>ch_install.xml</file> - </header> - - <section> - <title>Installation Process </title> - <p>This chapter describes how to install - <seealso marker="cosFileTransferApp">cosFileTransferApp</seealso> in an Erlang Environment. - </p> - - <section> - <title>Preparation</title> - <p>Before starting the installation process for cosFileTransfer, - the application <c>Orber</c> must be running and <c>cosProperty</c> installed by - using <c>cosProperty:install()</c>. Please note that it is <em>NOT</em> necessary - to use <c>cosProperty:install_db()</c> for running the cosFileTransfer application.</p> - </section> - - <section> - <title>Configuration</title> - <p>When starting the cosFileTransfer application the following configuration parameters - can be used:</p> - <list type="bulleted"> - <item><em>buffert_size</em> - default is 64000. This option determine - how many bytes will be read at a time when transferring files.</item> - </list> - </section> - </section> -</chapter> - diff --git a/lib/cosFileTransfer/doc/src/ch_introduction.xml b/lib/cosFileTransfer/doc/src/ch_introduction.xml deleted file mode 100644 index 67616b0a39..0000000000 --- a/lib/cosFileTransfer/doc/src/ch_introduction.xml +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> - -<chapter> - <header> - <copyright> - <year>2000</year><year>2016</year> - <holder>Ericsson AB. All Rights Reserved.</holder> - </copyright> - <legalnotice> - 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. - - </legalnotice> - - <title>Introduction to cosFileTransfer</title> - <prepared></prepared> - <docno></docno> - <date>2000-08-24</date> - <rev></rev> - <file>ch_introduction.xml</file> - </header> - - <section> - <title>Overview</title> - <p>The cosFileTransfer application is a FileTransfer Service compliant with the - <url href="http://www.omg.org">OMG</url> Service CosFileTransfer. - </p> - - <section> - <title>Purpose and Dependencies</title> - <p>If a Virtual File System is started as 'FTP', the inets-2.5.4 application, - or later, must be installed.</p> - <p><em>cosFileTransfer</em> is dependent on <em>Orber</em>, which provides CORBA functionality in an Erlang environment, - and <em>cosProperty</em>.</p> - </section> - - <section> - <title>Prerequisites</title> - <p>To fully understand the concepts presented in the - documentation, it is recommended that the user is familiar - with distributed programming, CORBA, the Orber and cosProperty applications. - </p> - <p>Recommended reading includes <em>CORBA, Fundamentals and Programming - Jon Siegel</em> and <em>Open Telecom Platform Documentation Set</em>. It is also helpful to have read <em>Concurrent Programming in Erlang</em>.</p> - </section> - </section> -</chapter> - diff --git a/lib/cosFileTransfer/doc/src/ch_system.xml b/lib/cosFileTransfer/doc/src/ch_system.xml deleted file mode 100644 index 377ec1fa49..0000000000 --- a/lib/cosFileTransfer/doc/src/ch_system.xml +++ /dev/null @@ -1,138 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> - -<chapter> - <header> - <copyright> - <year>2001</year><year>2016</year> - <holder>Ericsson AB. All Rights Reserved.</holder> - </copyright> - <legalnotice> - 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. - - </legalnotice> - - <title>Using the File Transfer Service</title> - <prepared></prepared> - <docno></docno> - <date>2001-08-07</date> - <rev></rev> - <file>ch_system.xml</file> - </header> - - <section> - <title>Overview</title> - <p>This chapter describes how two File Transfer Service applications interact.</p> - - <section> - <title>Components</title> - <p>There are several ways the OMG File Transfer Service can be used. - Below one scenario is visualized: </p> - <marker id="CosFileTransfer"></marker> - <image file="CosFileTransfer.gif"> - <icaption>Figure 1: The File Transfer Service Components.</icaption> - </image> - <list type="bulleted"> - <item><em>Source ORB:</em> this is the ORB we want to transfer a file from/via and it holds - an object reference to a - <seealso marker="CosFileTransfer_VirtualFileSystem">Virtual File System (VFS)</seealso> which, - in this example, represents an FTP server.</item> - <item><em>Target ORB:</em> the goal may be, for example, to transfer a new file or append to an - existing file placed at the location that this ORB's <c>VFS</c> represents. - In this scenario it is the local disk or the NFS.</item> - <item><em>Transport Protocol:</em> initially the ORB's, i.e., target and source, communicate via - normal <c>CORBA</c> requests to determine whether or not they can communicate. If the - File Transfer Service's have one, or more, <c>Transport Protocol</c> in common the data - will be streamed using this protocol. The cosFileTransfer application currently supports - <c>TCP/IP</c> and <c>SSL</c>.</item> - </list> - <p>Which type of file system the <c>VFS</c> is supposed to represent is determined - by the options given when creating it, which is also how one determine which - <c>Transport Protocol</c> to use. Hence, the source and target <c>VFS</c> described above - can be started by invoking, respectively, the following operations:</p> - <code type="none"> -1> SVFS = cosFileTransferApp:create_VFS('FTP', [], Host, 21, [{protocol, tcp}]), -2> TVFS = cosFileTransferApp:create_VFS({'NATIVE', 'cosFileTransferNATIVE_file'}, - [], OtherHost, 0, [{protocol, tcp}]), - </code> - <p>Naturally can any combination of <c>VFS</c>-types be used and it is also possible - to use own drivers, i.e., <c>{'NATIVE', 'MyDriver'}</c>.</p> - <p>After creating necessary <c>VFS's</c> we can login in and perform operations - on files and directories residing on each file system.</p> - </section> - - <section> - <title>How To Use SSL</title> - <p>To be able to use <c>SSL</c> as transport protocol a few configuration - parameters must be set. The required parameters depend on if Orber is - the target or/and the source ORB. However, the SSL_CERT_FILE variable - must be defined in both cases.</p> - <p>Setting of a CA certificate file with an option does not work due to - weaknesses in the SSLeay package. A work-around in the ssl application is - to set the OS environment variable SSL_CERT_FILE before SSL is started. - However, then the CA certificate file will be global for all connections - (both incoming and outgoing calls).</p> - - <section> - <title>Configurations when cosFileTransfer is Used as Target</title> - <p>The following three configuration variables can be used to configure - cosFileTransfer's SSL target behavior.</p> - <list type="bulleted"> - <item><em>ssl_server_certfile</em> which is a path to a file containing a - chain of PEM encoded certificates for cosFileTransfer as target.</item> - <item><em>ssl_server_verify</em> which specifies type of verification: - 0 = do not verify peer; 1 = verify peer, verify client once, 2 = - verify peer, verify client once, fail if no peer certificate. - The default value is 0.</item> - <item><em>ssl_server_depth</em> which specifies verification depth, i.e. - how far in a chain of certificates the verification process shall - proceed before the verification is considered successful. The - default value is 1. </item> - </list> - <p>There also exist a number of API functions for accessing the values of - these variables:</p> - <list type="bulleted"> - <item>cosFileTransferApp:ssl_server_certfile/0</item> - <item>cosFileTransferApp:ssl_server_verify/0</item> - <item>cosFileTransferApp:ssl_server_depth/0</item> - </list> - </section> - - <section> - <title>Configurations when cosFileTransfer is used as Source</title> - <p>Below is the list of configuration variables used when cosFileTransfer - act as the source application.</p> - <list type="bulleted"> - <item><em>ssl_client_certfile</em> which is a path to a file containing a - chain of PEM encoded certificates used in outgoing calls.</item> - <item><em>ssl_client_verify</em> which specifies type of verification: - 0 = do not verify peer; 1 = verify peer, verify client once, 2 = - verify peer, verify client once, fail if no peer certificate. - The default value is 0.</item> - <item><em>ssl_client_depth</em> which specifies verification depth, i.e. - how far in a chain of certificates the verification process shall - proceed before the verification is considered successful. The - default value is 1. </item> - </list> - <p>There also exist a number of API functions for accessing the values of - these variables in the client processes:</p> - <list type="bulleted"> - <item>cosFileTransferApp:ssl_client_certfile/0</item> - <item>cosFileTransferApp:ssl_client_verify/0</item> - <item>cosFileTransferApp:ssl_client_depth/0</item> - </list> - </section> - </section> - </section> -</chapter> - diff --git a/lib/cosFileTransfer/doc/src/cosFileTransferApp.xml b/lib/cosFileTransfer/doc/src/cosFileTransferApp.xml deleted file mode 100644 index ae7b4f1ec5..0000000000 --- a/lib/cosFileTransfer/doc/src/cosFileTransferApp.xml +++ /dev/null @@ -1,173 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> - <header> - <copyright> - <year>2000</year><year>2016</year> - <holder>Ericsson AB. All Rights Reserved.</holder> - </copyright> - <legalnotice> - 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. - - </legalnotice> - - <title>cosFileTransferApp</title> - <prepared></prepared> - <docno></docno> - <checked></checked> - <date>2000-08-24</date> - <rev>PA1</rev> - </header> - <module>cosFileTransferApp</module> - <modulesummary>The main module of the cosFileTransfer application.</modulesummary> - <description> - <p>To get access to the record definitions for the structures use: <br></br> -<c>-include_lib("cosFileTransfer/include/*.hrl").</c></p> - <p>This module contains the functions for starting and stopping the application.</p> - </description> - <funcs> - <func> - <name>install() -> Return</name> - <fsummary>Install the cosFileTransfer application</fsummary> - <type> - <v>Return = ok | {'EXIT', Reason}</v> - </type> - <desc> - <p>This operation installs the cosFileTransfer application. Note, the - <c>cosProperty</c> application must be installed prior to invoking this - operation.</p> - </desc> - </func> - <func> - <name>uninstall() -> Return</name> - <fsummary>Uninstall the cosFileTransfer application</fsummary> - <type> - <v>Return = ok | {'EXIT', Reason}</v> - </type> - <desc> - <p>This operation uninstalls the cosFileTransfer application.</p> - </desc> - </func> - <func> - <name>start() -> Return</name> - <fsummary>Start the cosFileTransfer application</fsummary> - <type> - <v>Return = ok | {error, Reason}</v> - </type> - <desc> - <p>This operation starts the cosFileTransfer application.</p> - </desc> - </func> - <func> - <name>stop() -> Return</name> - <fsummary>Stop the cosFileTransfer application</fsummary> - <type> - <v>Return = ok | {error, Reason}</v> - </type> - <desc> - <p>This operation stops the cosFileTransfer application.</p> - </desc> - </func> - <func> - <name>create_VFS(Type, Content, Host, Port [,Options]) -> Return</name> - <fsummary>Create a new instance of a Virtual File System</fsummary> - <type> - <v>Type = 'FTP' | {'NATIVE', 'cosFileTransferNATIVE_file'} | {'NATIVE', MyModule}</v> - <v>Content = []</v> - <v>Host = string(), e.g. "myHost@myServer" or "012.345.678.910"</v> - <v>Port = integer()</v> - <v>Options = [Option]</v> - <v>Option = {protocol, Protocol} | {connect_timeout, Seconds}</v> - <v>Protocol = tcp | ssl</v> - <v>Return = VFS | {'EXCEPTION, E}</v> - <v>VFS = #objref</v> - </type> - <desc> - <p>This operation creates a new instance of a Virtual File System. The - <c>Type</c> parameter determines which type we want the VFS to represent. - 'FTP' maps to the <c>INETS</c> ftp implementation, while - {'NATIVE', 'cosFileTransferNATIVE_file'} uses the <c>file</c> module. - It is also possible to implement own mappings which are activated by - supplying {'NATIVE', MyModule}. The MyModule module must export the same - functions and behave in the same way as the INETS ftp module, and - an operation named <c>open(Host, Port)</c>, which shall return - <c>{ok, Pid}</c> or <c>{error, Reason}</c>.</p> - <p>If no <c>Options</c> are supplied the default setting will be - used, i.e., tcp and 60 seconds.</p> - <p>The <c>Content</c> parameter is currently ignored by must be supplied - as an empty list.</p> - </desc> - </func> - <func> - <name>ssl_server_certfile() -> string()</name> - <fsummary>Display the path to the target certificate</fsummary> - <desc> - <p>This function returns a path to a file containing a chain of PEM encoded - certificates for the cosFileTransfer as target. - This is configured by setting the application variable - <em>ssl_server_certfile</em>.</p> - </desc> - </func> - <func> - <name>ssl_client_certfile() -> string()</name> - <fsummary>Display the path to the client certificate</fsummary> - <desc> - <p>This function returns a path to a file containing a chain of PEM encoded - certificates used in outgoing calls. - The default value is configured by setting the application variable - <em>ssl_client_certfile</em>.</p> - </desc> - </func> - <func> - <name>ssl_server_verify() -> 0 | 1 | 2</name> - <fsummary>Display the SSL verification type for incoming calls</fsummary> - <desc> - <p>This function returns the type of verification used by SSL during authentication of the other - peer for incoming calls. - It is configured by setting the application variable - <em>ssl_server_verify</em>.</p> - </desc> - </func> - <func> - <name>ssl_client_verify() -> 0 | 1 | 2</name> - <fsummary>Display the SSL verification type for outgoing calls</fsummary> - <desc> - <p>This function returns the type of verification used by SSL during authentication of the other - peer for outgoing calls. - The default value is configured by setting the application variable - <em>ssl_client_verify</em>.</p> - </desc> - </func> - <func> - <name>ssl_server_depth() -> int()</name> - <fsummary>Display the SSL verification depth for incoming calls</fsummary> - <desc> - <p>This function returns the SSL verification depth for incoming calls. - It is configured by setting the application variable - <em>ssl_server_depth</em>.</p> - </desc> - </func> - <func> - <name>ssl_client_depth() -> int()</name> - <fsummary>Display the SSL verification depth for outgoing calls</fsummary> - <desc> - <p>This function returns the SSL verification depth for outgoing calls. - The default value is configured by setting the application variable - <em>ssl_client_depth</em>.</p> - </desc> - </func> - </funcs> - -</erlref> - diff --git a/lib/cosFileTransfer/doc/src/notes.xml b/lib/cosFileTransfer/doc/src/notes.xml deleted file mode 100644 index e0b4bdf64b..0000000000 --- a/lib/cosFileTransfer/doc/src/notes.xml +++ /dev/null @@ -1,379 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> - -<chapter> - <header> - <copyright> - <year>2000</year><year>2016</year> - <holder>Ericsson AB. All Rights Reserved.</holder> - </copyright> - <legalnotice> - 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. - - </legalnotice> - - <title>cosFileTransfer Release Notes</title> - <prepared></prepared> - <docno></docno> - <checked></checked> - <date>2000-08-24</date> - <rev>A</rev> - <file>notes.xml</file> - </header> - - <section><title>cosFileTransfer 1.2.2</title> - - <section><title>Fixed Bugs and Malfunctions</title> - <list> - <item> - <p> Removed all old unused files in the documentation. - </p> - <p> - Own Id: OTP-14475 Aux Id: ERL-409, PR-1493 </p> - </item> - </list> - </section> - -</section> - -<section><title>cosFileTransfer 1.2.1</title> - - <section><title>Improvements and New Features</title> - <list> - <item> - <p> - Internal changes</p> - <p> - Own Id: OTP-13551</p> - </item> - </list> - </section> - -</section> - -<section><title>cosFileTransfer 1.2</title> - - <section><title>Improvements and New Features</title> - <list> - <item> - <p> Remove the usage of erlang:now() from all Corba - applications and use the new rand module instead of - random. </p> - <p> - Own Id: OTP-12687</p> - </item> - </list> - </section> - -</section> - -<section><title>cosFileTransfer 1.1.16</title> - - <section><title>Improvements and New Features</title> - <list> - <item> - <p> The default encoding of Erlang files has been changed - from ISO-8859-1 to UTF-8. </p> <p> The encoding of XML - files has also been changed to UTF-8. </p> - <p> - Own Id: OTP-10907</p> - </item> - </list> - </section> - -</section> - -<section><title>cosFileTransfer 1.1.15</title> - - <section><title>Improvements and New Features</title> - <list> - <item> - <p> Postscript files no longer needed for the generation - of PDF files have been removed. </p> - <p> - Own Id: OTP-11016</p> - </item> - </list> - </section> - -</section> - -<section><title>cosFileTransfer 1.1.14</title> - - <section><title>Improvements and New Features</title> - <list> - <item> - <p> - Misc build updates</p> - <p> - Own Id: OTP-10784</p> - </item> - </list> - </section> - -</section> - -<section><title>cosFileTransfer 1.1.13</title> - - <section><title>Improvements and New Features</title> - <list> - <item> - <p>Erlang/OTP can now be built using parallel make if you - limit the number of jobs, for instance using '<c>make - -j6</c>' or '<c>make -j10</c>'. '<c>make -j</c>' does not - work at the moment because of some missing - dependencies.</p> - <p> - Own Id: OTP-9451</p> - </item> - </list> - </section> - -</section> - -<section><title>cosFileTransfer 1.1.12</title> - - <section><title>Fixed Bugs and Malfunctions</title> - <list> - <item> - <p> XML files have been corrected. </p> - <p> - Own Id: OTP-9550 Aux Id: OTP-9541 </p> - </item> - </list> - </section> - -</section> - -<section> - <title>cosFileTransfer 1.1.11</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p> - Removed superfluous usage of shy in the documentation since it can cause problem if - a buggy tool is used.</p> - <p> - Own Id: OTP-9319 Aux Id:</p> - </item> - </list> - </section> - </section> - - <section> - <title>cosFileTransfer 1.1.10</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p> - Removed obsolete SSL dependency.</p> - <p> - Own Id: OTP-8374 Aux Id:</p> - </item> - </list> - </section> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>The documentation EIX file was not generated.</p> - <p>Own id: OTP-8355 Aux Id:</p> - </item> - </list> - </section> - </section> - - <section> - <title>cosFileTransfer 1.1.9</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p> - The documentation is now built with open source tools (xsltproc and fop) - that exists on most platforms. One visible change is that the frames are removed.</p> - <p> - Own Id: OTP-8201 Aux Id:</p> - </item> - </list> - </section> - </section> - - <section> - <title>cosFileTransfer 1.1.8</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p>Obsolete guards, e.g. record vs is_record, has been changed - to avoid compiler warnings.</p> - <p>Own id: OTP-7987</p> - </item> - </list> - </section> - </section> - - <section> - <title>cosFileTransfer 1.1.7</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p>Updated file headers.</p> - <p>Own id: OTP-7837</p> - </item> - </list> - </section> - </section> - - <section> - <title>cosFileTransfer 1.1.6</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p>Documentation source included in open source releases.</p> - <p>Own id: OTP-7595</p> - </item> - </list> - </section> - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>When using predefined native file copy the return values from - file operation was not handled correctly.</p> - <p>Own id: OTP-7599</p> - </item> - </list> - </section> - </section> - - <section> - <title>cosFileTransfer 1.1.5</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p>CosFileTransfer now uses the changed Inets API.</p> - <p>Own id: OTP-7020</p> - </item> - </list> - </section> - </section> - - <section> - <title>cosFileTransfer 1.1.4</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p>The documentation source has been converted from SGML to XML.</p> - <p>Own id: OTP-6754</p> - </item> - </list> - </section> - </section> - - <section> - <title>cosFileTransfer 1.1.3</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p>Minor Makefile changes.</p> - <p>Own id: OTP-6701</p> - </item> - </list> - </section> - </section> - - <section> - <title>cosFileTransfer 1.1.2</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p>Due to changed behavior of the ftp client a few changes - has been made.</p> - <p>Own id: OTP-5135</p> - </item> - </list> - </section> - </section> - - <section> - <title>cosFileTransfer 1.1.1</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>Depending on which ftp server is used, the operation - CosFileTransfer::Directory::list could fail.</p> - <p>Own id: OTP-4954</p> - </item> - </list> - </section> - </section> - - <section> - <title>cosFileTransfer 1.1</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p>The stub/skeleton-files generated by IC have been improved, - i.e., depending on the IDL-files, reduced the size of the - erl- and beam-files and decreased dependencies off Orber's - Interface Repository. It is necessary to re-compile all IDL-files - and use COS-applications, including Orber, compiled with - IC-4.2.</p> - <p>Own id: OTP-4576</p> - </item> - </list> - </section> - </section> - - <section> - <title>cosFileTransfer 1.0.2</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p>First release of the cosFileTransfer application. Please note that - the OMG specification was not finalized when this version - was released. Hence, the API may be changed in way which is not - compatible with this version. Contact support if you are in doubt.</p> - <p>Own Id: -</p> - </item> - </list> - </section> - </section> -</chapter> - diff --git a/lib/cosFileTransfer/doc/src/part.xml b/lib/cosFileTransfer/doc/src/part.xml deleted file mode 100644 index b4e6f573dd..0000000000 --- a/lib/cosFileTransfer/doc/src/part.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE part SYSTEM "part.dtd"> - -<part xmlns:xi="http://www.w3.org/2001/XInclude"> - <header> - <copyright> - <year>2000</year><year>2016</year> - <holder>Ericsson AB. All Rights Reserved.</holder> - </copyright> - <legalnotice> - 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. - - </legalnotice> - - <title>cosFileTransfer User's Guide</title> - <prepared></prepared> - <docno></docno> - <date>2000-08-24</date> - <rev>1.0</rev> - </header> - <description> - <p>The cosFileTransfer Application is an Erlang implementation of the OMG - CORBA FileTransfer Service.</p> - </description> - <xi:include href="ch_contents.xml"/> - <xi:include href="ch_introduction.xml"/> - <xi:include href="ch_install.xml"/> - <xi:include href="ch_system.xml"/> - <xi:include href="ch_example.xml"/> -</part> - diff --git a/lib/cosFileTransfer/doc/src/ref_man.xml b/lib/cosFileTransfer/doc/src/ref_man.xml deleted file mode 100644 index ce050128e6..0000000000 --- a/lib/cosFileTransfer/doc/src/ref_man.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE application SYSTEM "application.dtd"> - -<application xmlns:xi="http://www.w3.org/2001/XInclude"> - <header> - <copyright> - <year>2000</year><year>2016</year> - <holder>Ericsson AB. All Rights Reserved.</holder> - </copyright> - <legalnotice> - 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. - - </legalnotice> - - <title>cosFileTransfer Reference Manual</title> - <prepared></prepared> - <docno></docno> - <date>2000-08-24</date> - <rev>1.0</rev> - </header> - <description> - <p>The cosFileTransfer Application is an Erlang implementation of the OMG - CORBA File Transfer Service.</p> - </description> - <xi:include href="cosFileTransferApp.xml"/>> - <xi:include href="CosFileTransfer_File.xml"/>> - <xi:include href="CosFileTransfer_Directory.xml"/>> - <xi:include href="CosFileTransfer_FileIterator.xml"/>> - <xi:include href="CosFileTransfer_VirtualFileSystem.xml"/>> - <xi:include href="CosFileTransfer_FileTransferSession.xml"/>> -</application> - diff --git a/lib/cosFileTransfer/ebin/.gitignore b/lib/cosFileTransfer/ebin/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/cosFileTransfer/ebin/.gitignore +++ /dev/null diff --git a/lib/cosFileTransfer/examples/.gitignore b/lib/cosFileTransfer/examples/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/cosFileTransfer/examples/.gitignore +++ /dev/null diff --git a/lib/cosFileTransfer/include/.gitignore b/lib/cosFileTransfer/include/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/cosFileTransfer/include/.gitignore +++ /dev/null diff --git a/lib/cosFileTransfer/info b/lib/cosFileTransfer/info deleted file mode 100644 index e5ca860f1c..0000000000 --- a/lib/cosFileTransfer/info +++ /dev/null @@ -1,3 +0,0 @@ -group: orb -short: Orber OMG File Transfer Service - diff --git a/lib/cosFileTransfer/priv/.gitignore b/lib/cosFileTransfer/priv/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/cosFileTransfer/priv/.gitignore +++ /dev/null diff --git a/lib/cosFileTransfer/src/CosFileTransfer.cfg b/lib/cosFileTransfer/src/CosFileTransfer.cfg deleted file mode 100644 index a98f102e73..0000000000 --- a/lib/cosFileTransfer/src/CosFileTransfer.cfg +++ /dev/null @@ -1,10 +0,0 @@ -{this, "CosFileTransfer::Directory"}. -{{handle_info, "CosFileTransfer::Directory"}, true}. -{this, "CosFileTransfer::File"}. -{{handle_info, "CosFileTransfer::File"}, true}. -{this, "CosFileTransfer::VirtualFileSystem"}. -{{handle_info, "CosFileTransfer::VirtualFileSystem"}, true}. -{this, "CosFileTransfer::FileTransferSession"}. -{{handle_info, "CosFileTransfer::FileTransferSession"}, true}. -{this, "CosFileTransfer::FileIterator"}. -{{handle_info, "CosFileTransfer::FileIterator"}, true}. diff --git a/lib/cosFileTransfer/src/CosFileTransfer.idl b/lib/cosFileTransfer/src/CosFileTransfer.idl deleted file mode 100644 index 2eb310478a..0000000000 --- a/lib/cosFileTransfer/src/CosFileTransfer.idl +++ /dev/null @@ -1,157 +0,0 @@ -//File: CosFileTransfer.idl -#ifndef _COS_FILE_TRANSFER_IDL_ -#define _COS_FILE_TRANSFER_IDL_ - -#include <CosProperty.idl> -#pragma prefix "omg.org" - -module CosFileTransfer { - - typedef string Istring; - typedef Istring ProtocolAddress; - typedef long ContentType; - - const ContentType FTAM_1 = 1; - const ContentType FTAM_2 = 2; - const ContentType FTAM_3 = 3; - const ContentType FTAM_4 = 4; - const ContentType FTAM_5 = 5; - const ContentType NBS_9 = 6; - const ContentType INTAP_1 = 7; - - exception CommandNotImplementedException { Istring reason; }; - exception SessionException { Istring reason; }; - exception TransferException { Istring reason; }; - exception FileNotFoundException { Istring reason; }; - exception RequestFailureException { Istring reason; }; - exception IllegalOperationException { Istring reason; }; - - interface VirtualFileSystem; - - struct AccessLevel { - boolean read; - boolean insert; - boolean replace; - boolean extend; - boolean erase; - boolean read_attr; - boolean change_attr; - boolean delete; - }; - - typedef sequence<ProtocolAddress> ProtocolAddressList; - - struct ProtocolSupport { - Istring protocol_name; - ProtocolAddressList addresses; - }; - - typedef sequence<ProtocolSupport> SupportedProtocolAddresses; - - interface Directory; - interface FileTransferSession; - - typedef Istring FileName; - typedef sequence<FileName> FileNameList; - - interface File:CosPropertyService::PropertySetDef { - - readonly attribute FileName name; - readonly attribute FileNameList complete_file_name; - readonly attribute Directory parent; - readonly attribute FileTransferSession associated_session; - - }; - - enum FileType {nfile, ndirectory}; - - struct FileWrapper { - File the_file; - FileType file_type; - }; - - typedef sequence<FileWrapper> FileList; - - interface FileIterator; - interface Directory : File { - - void list(in unsigned long how_many, out FileList fl, out FileIterator fi); - - }; - - interface FileIterator { - - boolean next_one(out FileWrapper f); - boolean next_n(in unsigned long how_many, out FileList fl); - - void destroy(); - }; - - interface FileTransferSession { - - readonly attribute SupportedProtocolAddresses protocols_supported; - - void set_directory(in Directory new_directory) - raises(SessionException, FileNotFoundException, RequestFailureException, - IllegalOperationException); - - File create_file(in FileNameList name) - raises(SessionException, FileNotFoundException, RequestFailureException, - IllegalOperationException); - - Directory create_directory(in FileNameList name) - raises(SessionException, FileNotFoundException, RequestFailureException, - IllegalOperationException); - - FileWrapper get_file(in FileNameList complete_file_name) - raises(SessionException, FileNotFoundException, RequestFailureException, - IllegalOperationException); - - void delete(in File file) - raises(SessionException, FileNotFoundException, RequestFailureException, - IllegalOperationException); - - void transfer(in File src, in File dest) - raises(SessionException, TransferException, FileNotFoundException, - RequestFailureException, IllegalOperationException); - - void append(in File src, in File dest) - raises(CommandNotImplementedException, SessionException, TransferException, - FileNotFoundException, RequestFailureException, - IllegalOperationException); - - void insert(in File src, in File dest, in long offset) - raises(CommandNotImplementedException, SessionException, TransferException, - FileNotFoundException, RequestFailureException, - IllegalOperationException); - - void logout(); - - // WARNING!!! - // Theses are Orber specific operations and may only be used internally!! - // Maybe removed, altered and changed in any way without warning!! - Directory oe_orber_create_directory_current() - raises(SessionException, FileNotFoundException, IllegalOperationException); - FileList oe_orber_get_content(in FileNameList complete_file_name, - in Directory parent); - long oe_orber_count_children(in FileNameList complete_file_name); - - }; - - interface VirtualFileSystem { - - enum NativeFileSystemType { FTAM, FTP, NATIVE }; - - readonly attribute NativeFileSystemType file_system_type; - - typedef sequence<ContentType> ContentList; - - readonly attribute ContentList supported_content_types; - - FileTransferSession login(in Istring username, in Istring password, - in Istring account, out Directory root) - raises(SessionException, FileNotFoundException, IllegalOperationException); - }; -}; - -#endif //_COS_FILE_TRANSFER_IDL_ diff --git a/lib/cosFileTransfer/src/CosFileTransfer_Directory_impl.erl b/lib/cosFileTransfer/src/CosFileTransfer_Directory_impl.erl deleted file mode 100644 index 8ce6cebf77..0000000000 --- a/lib/cosFileTransfer/src/CosFileTransfer_Directory_impl.erl +++ /dev/null @@ -1,453 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% 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. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosFileTransfer_Directory_impl -%% Description : -%% -%% Created : 12 Sept 2000 -%%---------------------------------------------------------------------- --module('CosFileTransfer_Directory_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - --include_lib("cosProperty/include/CosPropertyService.hrl"). - --include("cosFileTransferApp.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2]). - -%% Interface functions --export([list/3]). - -%% Inherited CosFileTransfer::File --export(['_get_name'/2, - '_get_complete_file_name'/2, - '_get_parent'/2, - '_get_associated_session'/2]). - -%% Inherited CosPropertyService::PropertySetDef --export([get_allowed_property_types/2, - get_allowed_properties/2, - define_property_with_mode/5, - define_properties_with_modes/3, - get_property_mode/3, - get_property_modes/3, - set_property_mode/4, - set_property_modes/3]). - -%% Inherited CosPropertyService::PropertySet --export([define_property/4, - define_properties/3, - get_number_of_properties/2, - get_all_property_names/3, - get_property_value/3, - get_properties/3, - get_all_properties/3, - delete_property/3, - delete_properties/3, - delete_all_properties/2, - is_property_defined/3]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {property, - name, - completeName, - parent, - assocSession}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- --define(create_InitState(Pr, N, C, Pa, A), - #state{property = Pr, - name = N, - completeName = C, - parent = Pa, - assocSession = A}). - --define(get_PropertyRef(S), S#state.property). --define(get_Name(S), S#state.name). --define(get_CompleteName(S), S#state.completeName). --define(get_Parent(S), S#state.parent). --define(get_AssocSession(S), S#state.assocSession). - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([Name, CompleteName, Parent, AssocSession]) -> - PropTypes = [tk_long, tk_boolean], - %% WARNING if the order of the properties is changed so must - %% get_all_properties/3 in this module be as well! - PropDefs = [#'CosPropertyService_PropertyDef' - {property_name = "num_children", - property_value = #any{typecode=tk_long, value=0}, - property_mode = fixed_readonly}, - #'CosPropertyService_PropertyDef' - {property_name = "is_directory", - property_value = #any{typecode=tk_boolean, value=true}, - property_mode = fixed_readonly}], - Prop = cosProperty:create_static_SetDef(PropTypes, PropDefs), - {ok, ?create_InitState(Prop, Name, CompleteName, Parent, AssocSession)}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%====================================================================== -%% CosFileTransfer::Directory -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : list -%% Arguments : Max - ulong() -%% Returns : {ok, FileList, FileIterator} -%% Description: -%%---------------------------------------------------------------------- -list(OE_This, State, Max) -> - case 'CosFileTransfer_FileTransferSession': - oe_orber_get_content(?get_AssocSession(State), ?get_CompleteName(State), - OE_This) of - [] -> - {reply, {ok, [], corba:create_nil_objref()}, State}; - FileList when length(FileList) > Max -> - {reply, - {ok, lists:sublist(FileList, Max), - 'CosFileTransfer_FileIterator':oe_create([lists:nthtail(Max, - FileList)])}, - State}; - FileList -> - {reply, {ok, FileList, corba:create_nil_objref()}, State} - end. - -%%====================================================================== -%% CosFileTransfer::File -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : '_get_name' -%% Arguments : - -%% Returns : CosFileTransfer::FileName - string -%% Description: -%%---------------------------------------------------------------------- -'_get_name'(_OE_This, State) -> - {reply, ?get_Name(State), State}. - -%%---------------------------------------------------------------------% -%% Function : '_get_complete_file_name' -%% Arguments : - -%% Returns : CosFileTransfer::FileNameList - a list of strings's -%% Description: -%%---------------------------------------------------------------------- -'_get_complete_file_name'(_OE_This, State) -> - {reply, ?get_CompleteName(State), State}. - -%%---------------------------------------------------------------------% -%% Function : '_get_parent' -%% Arguments : - -%% Returns : CosFileTransfer::Directory -%% Description: -%%---------------------------------------------------------------------- -'_get_parent'(_OE_This, State) -> - {reply, ?get_Parent(State), State}. - -%%---------------------------------------------------------------------% -%% Function : '_get_associated_session' -%% Arguments : - -%% Returns : CosFileTransfer::FileTransferSession -%% Description: -%%---------------------------------------------------------------------- -'_get_associated_session'(_OE_This, State) -> - {reply, ?get_AssocSession(State), State}. - -%%====================================================================== -%% CosPropertyService::PropertySetDef -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : get_allowed_property_types -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_allowed_property_types(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySetDef': - get_allowed_property_types(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : get_allowed_properties -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_allowed_properties(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySetDef': - get_allowed_properties(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : define_property_with_mode -%% Arguments : Name - string() -%% Value - #any{} -%% Mode - normal | read_only | fixed_normal | fixed_readonly -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_property_with_mode(_OE_This, State, Name, Value, Mode) -> - {reply, 'CosPropertyService_PropertySetDef': - define_property_with_mode(?get_PropertyRef(State), Name, Value, Mode), State}. - -%%---------------------------------------------------------------------% -%% Function : define_properties_with_modes -%% Arguments : PropertyDefs - list of #'CosPropertyService_PropertyDef'{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_properties_with_modes(_OE_This, State, PropertyDefs) -> - {reply, 'CosPropertyService_PropertySetDef': - define_properties_with_modes(?get_PropertyRef(State), PropertyDefs), State}. - -%%---------------------------------------------------------------------% -%% Function : get_property_mode -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_property_mode(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySetDef': - get_property_mode(?get_PropertyRef(State), Name), State}. - - -%%---------------------------------------------------------------------% -%% Function : get_property_modes -%% Arguments : Names - a list of Name (i.e. string()'s). -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_property_modes(_OE_This, State, Names) -> - {reply, 'CosPropertyService_PropertySetDef': - get_property_modes(?get_PropertyRef(State), Names), State}. - -%%---------------------------------------------------------------------% -%% Function : set_property_mode -%% Arguments : Name - string() -%% Mode - normal | read_only | fixed_normal | fixed_readonly -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -set_property_mode(_OE_This, State, Name, Mode) -> - {reply, 'CosPropertyService_PropertySetDef': - set_property_mode(?get_PropertyRef(State), Name, Mode), State}. - - -%%---------------------------------------------------------------------% -%% Function : set_property_modes -%% Arguments : Modes - a list of #'CosPropertyService_PropertyModes'{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -set_property_modes(_OE_This, State, PropertyModes) -> - {reply, 'CosPropertyService_PropertySetDef': - set_property_modes(?get_PropertyRef(State), PropertyModes), State}. - -%%====================================================================== -%% CosPropertyService::PropertySet -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : define_property -%% Arguments : Name - string() -%% Value - #any{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_property(_OE_This, State, Name, Value) -> - {reply, 'CosPropertyService_PropertySet': - define_property(?get_PropertyRef(State), Name, Value), State}. - -%%---------------------------------------------------------------------% -%% Function : define_properties -%% Arguments : Properties - a list of #'CosPropertyService_Property'{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_properties(_OE_This, State, Properties) -> - {reply, 'CosPropertyService_PropertySet': - define_properties(?get_PropertyRef(State), Properties), State}. - - -%%---------------------------------------------------------------------% -%% Function : get_number_of_properties -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_number_of_properties(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySet': - get_number_of_properties(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : get_all_property_names -%% Arguments : Max - ulong() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_all_property_names(_OE_This, State, Max) -> - {reply, 'CosPropertyService_PropertySet': - get_all_property_names(?get_PropertyRef(State), Max), State}. - -%%---------------------------------------------------------------------% -%% Function : get_property_value -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_property_value(_OE_This, State, "num_children") -> - Count = 'CosFileTransfer_FileTransferSession': - oe_orber_count_children(?get_AssocSession(State), ?get_CompleteName(State)), - {reply, #any{typecode=tk_long, value=Count}, State}; -get_property_value(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySet': - get_property_value(?get_PropertyRef(State), Name), State}. - -%%---------------------------------------------------------------------% -%% Function : get_properties -%% Arguments : Names - a list of Name (i.e. string()'s) -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_properties(_OE_This, State, Names) -> - {Bool, Props} = - 'CosPropertyService_PropertySet':get_properties(?get_PropertyRef(State), - Names), - NewProps = change_property(Props, [], State), - {reply, {Bool, NewProps}, State}. - -change_property([], Acc, _State) -> - Acc; -change_property([H|T], Acc, State) -> - NewAcc = - case H of - #'CosPropertyService_Property'{property_name = "num_children"} -> - Count = 'CosFileTransfer_FileTransferSession': - oe_orber_count_children(?get_AssocSession(State), - ?get_CompleteName(State)), - [H#'CosPropertyService_Property' - {property_value = #any{typecode=tk_long, value=Count}}|Acc]; - _ -> - [H|Acc] - end, - change_property(T, NewAcc, State). - -%%---------------------------------------------------------------------% -%% Function : get_all_properties -%% Arguments : Max - ulong() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_all_properties(_OE_This, State, 0) -> - %% WARNING if we start supporting more than 10 Properties the next line must - %% be updated! - {ok, Props, _Iterator} = - 'CosPropertyService_PropertySet':get_all_properties(?get_PropertyRef(State), - 10), - NewProps = change_property(Props, [], State), - %% WARNING if the cosProperty:start_PropertiesIterator/1 is updated - %% it must be done hear as well. - {reply, {ok, [], cosProperty:start_PropertiesIterator(NewProps)}, State}; -get_all_properties(_OE_This, State, Max) -> - {ok, Props, Iterator} = - 'CosPropertyService_PropertySet':get_all_properties(?get_PropertyRef(State), - Max), - NewProps = change_property(Props, [], State), - {reply, {ok, NewProps, Iterator}, State}. - -%%---------------------------------------------------------------------% -%% Function : delete_property -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -delete_property(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySet': - delete_property(?get_PropertyRef(State), Name), State}. - - -%%---------------------------------------------------------------------% -%% Function : delete_properties -%% Arguments : Names - a list of Name (i.e. string()'s) -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -delete_properties(_OE_This, State, Names) -> - {reply, 'CosPropertyService_PropertySet': - delete_properties(?get_PropertyRef(State), Names), State}. - - -%%---------------------------------------------------------------------% -%% Function : delete_all_properties -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -delete_all_properties(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySet': - delete_all_properties(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : is_property_defined -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -is_property_defined(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySet': - is_property_defined(?get_PropertyRef(State), Name), State}. - -%%====================================================================== -%% Internal functions -%%====================================================================== - -%%====================================================================== -%% END OF MODULE -%%====================================================================== - diff --git a/lib/cosFileTransfer/src/CosFileTransfer_FileIterator_impl.erl b/lib/cosFileTransfer/src/CosFileTransfer_FileIterator_impl.erl deleted file mode 100644 index d824129147..0000000000 --- a/lib/cosFileTransfer/src/CosFileTransfer_FileIterator_impl.erl +++ /dev/null @@ -1,158 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% 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. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosFileTransfer_FileIterator_impl.erl -%% Description : -%% -%% Created : 12 Sept 2000 -%%---------------------------------------------------------------------- --module('CosFileTransfer_FileIterator_impl'). - - - - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include("cosFileTransferApp.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). - -%% Interface functions --export([next_one/2, - next_n/3, - destroy/2]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([FileList]) -> - {ok, FileList}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% function : handle_info/2 -%% Arguments: -%% Returns : -%% Effect : -%%---------------------------------------------------------------------- -handle_info(Info, State) -> - case Info of - {'EXIT', _Pid, Reason} -> - {stop, Reason, State}; - _Other -> - {noreply, State} - end. - -%%====================================================================== -%% CosFileTransfer::FileIterator -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : next_one -%% Arguments : -%% Returns : {boolean(), FileWrapper} -%% Description: -%%---------------------------------------------------------------------- -next_one(_OE_This, []) -> - {reply, {false, - #'CosFileTransfer_FileWrapper'{the_file = corba:create_nil_objref(), - file_type = nfile}}, []}; -next_one(_OE_This, [FileWrapper]) -> - {reply, {true, FileWrapper}, []}; -next_one(_OE_This, [FileWrapper|Rest]) -> - {reply, {true, FileWrapper}, Rest}. - -%%---------------------------------------------------------------------% -%% Function : next_n -%% Arguments : HowMany - ulong() -%% Returns : {boolean(), FileWrapperList} -%% Description: -%%---------------------------------------------------------------------- -next_n(_OE_This, [], _) -> - {reply, {false, []}, []}; -next_n(_OE_This, FileWrapperList, HowMany) when HowMany > length(FileWrapperList) -> - {reply, {true, FileWrapperList}, []}; -next_n(_OE_This, FileWrapperList, HowMany) -> - {reply, {true, lists:sublist(FileWrapperList, HowMany)}, - lists:nthtail(HowMany, FileWrapperList)}. - -%%---------------------------------------------------------------------% -%% Function : destroy -%% Arguments : - -%% Returns : - -%% Description: -%%---------------------------------------------------------------------- -destroy(_OE_This, State) -> - {stop, normal, ok, State}. - - -%%====================================================================== -%% Internal functions -%%====================================================================== - - - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosFileTransfer/src/CosFileTransfer_FileTransferSession_impl.erl b/lib/cosFileTransfer/src/CosFileTransfer_FileTransferSession_impl.erl deleted file mode 100644 index 3a8285f092..0000000000 --- a/lib/cosFileTransfer/src/CosFileTransfer_FileTransferSession_impl.erl +++ /dev/null @@ -1,1061 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% 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. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosFileTransfer_FileTransferSession_impl.erl -%% Description : -%% -%% Created : 12 Sept 2000 -%%---------------------------------------------------------------------- --module('CosFileTransfer_FileTransferSession_impl'). - - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - --include("cosFileTransferApp.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). - -%% Interface functions --export(['_get_protocols_supported'/2, - set_directory/3, - create_file/3, - create_directory/3, - get_file/3, - delete/3, - transfer/4, - append/4, - insert/5, - logout/2]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([oe_orber_create_directory_current/2, oe_orber_get_content/4, - oe_orber_count_children/3]). --export([invoke_call/3]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {protocols, server, type, current, module, connection, mytype, - connection_timeout}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- --define(create_InitState(P, S, T, C, M, Co, Ty, CT), - #state{protocols=P, server=S, type=T, current=C, module=M, connection=Co, - mytype=Ty, connection_timeout=CT}). - --define(get_Protocols(S), S#state.protocols). --define(get_Server(S), S#state.server). --define(get_CurrentDir(S), S#state.current). --define(get_Module(S), S#state.module). --define(get_Connection(S), S#state.connection). --define(get_MyType(S), S#state.mytype). --define(get_ConnectionTimeout(S), S#state.connection_timeout). --define(set_CurrentDir(S, C), S#state{current=C}). - --define(is_FTP(S), S#state.type=='FTP'). --define(is_FTAM(S), S#state.type=='FTAM'). --define(is_NATIVE(S), S#state.type=='NATIVE'). --define(is_ORBER_NATIVE(S), S#state.module==cosFileTransferNATIVE_file). - - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init(['FTP', Host, Port, User, Password, _Account, Protocol, Timeout]) -> - {ok, Pid} = inets:start(ftpc, [{host, Host}, {port, Port}], stand_alone), - ok = ftp:user(Pid, User, Password), - {ok, PWD} = ftp:pwd(Pid), - {Connection, ProtocolSupport} = setup_local(Protocol), - {ok, ?create_InitState(ProtocolSupport, Pid, 'FTP', - PWD, ftp, Connection, Protocol, Timeout)}; -init([{'NATIVE', Mod}, Host, Port, User, Password, _Account, Protocol, Timeout]) -> - {ok, Pid} = Mod:open(Host, Port), - ok = Mod:user(Pid, User, Password), - {ok, PWD} = Mod:pwd(Pid), - {Connection, ProtocolSupport} = setup_local(Protocol), - {ok, ?create_InitState(ProtocolSupport, Pid, 'NATIVE', - PWD, Mod, Connection, Protocol, Timeout)}. - - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, #state{type = Type, server = Server, module = Mod} = State) -> - case ?get_MyType(State) of - ssl -> - catch ssl:close(?get_Connection(State)); - _ -> - catch gen_tcp:close(?get_Connection(State)) - end, - case Type of - 'FTP' -> - inets:stop(ftpc, Server); - 'NATIVE' -> - Mod:close(Server); - _ -> - ok - end, - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% function : handle_info/2 -%% Arguments: -%% Returns : -%% Effect : -%%---------------------------------------------------------------------- -handle_info(Info, State) -> - case Info of - {'EXIT', _Pid, Reason} -> - {stop, Reason, State}; - _Other -> - {noreply, State} - end. - -%%====================================================================== -%% CosFileTransfer::FileTransferSession -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : _get_protocols_supported -%% Arguments : -%% Returns : A list of CosFileTransfer::ProtocolSupport, i.e., -%% struct ProtocolSupport { -%% Istring protocol_name; -%% ProtocolAddressList addresses; %% eq a list of strings. -%% }; -%% Description: -%%---------------------------------------------------------------------- -'_get_protocols_supported'(_OE_This, State) -> - {reply, ?get_Protocols(State), State}. - -%%---------------------------------------------------------------------- -%% Function : set_directory -%% Arguments : Directory - CosFileTransfer::Directory -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -set_directory(_OE_This, State, Directory) when ?is_FTP(State); ?is_NATIVE(State) -> - Mod = ?get_Module(State), - Path = filename:join('CosFileTransfer_Directory': - '_get_complete_file_name'(Directory)), - case catch Mod:cd(?get_Server(State), Path) of - ok -> - {reply, ok, ?set_CurrentDir(State, Path)}; - {error, epath} -> - corba:raise(#'CosFileTransfer_FileNotFoundException' - {reason="Directory not found."}); - {error, elogin} -> - corba:raise(#'CosFileTransfer_SessionException' - {reason="User not loggen in."}); - {error, econn} -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Premature connection ending."}); - _ -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason = "Unexpected error."}) - end. - -%%---------------------------------------------------------------------- -%% Function : create_file -%% Arguments : FileNameList -%% Returns : File -%% Description: This operation creates a File Object representing a -%% file which may or may not exist. Typically used as -%% argument when invoking transfer/3. See also get_file/2. -%%---------------------------------------------------------------------- -create_file(OE_This, State, FileNameList) -> - {reply, cosFileTransferApp:create_file(OE_This, FileNameList), State}. - -%%---------------------------------------------------------------------- -%% Function : create_directory -%% Arguments : FileNameList - full path name. -%% Returns : Directory -%% Description: -%%---------------------------------------------------------------------- -create_directory(OE_This, State, FileNameList) when ?is_FTP(State); - ?is_NATIVE(State) -> - Mod = ?get_Module(State), - case Mod:mkdir(?get_Server(State), filename:join(FileNameList)) of - ok -> - {reply, cosFileTransferApp:create_dir(OE_This, FileNameList), State}; - {error, epath} -> - corba:raise(#'CosFileTransfer_FileNotFoundException' - {reason="Directory not found."}); - {error, elogin} -> - corba:raise(#'CosFileTransfer_SessionException' - {reason="User not loggen in."}); - {error, econn} -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Premature connection ending."}); - _ -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Unknown error."}) - end. - - -%%---------------------------------------------------------------------- -%% Function : get_file -%% Arguments : FileNameList -%% Returns : FileWrapper -%% Description: This operation should be independent of the working Directory, -%% i.e., a full path name must be supplied. The file or -%% directory the returned object is supposed to represent -%% MUST(!!!!) exist. -%%---------------------------------------------------------------------- -get_file(OE_This, State, FileNameList) when ?is_FTP(State); - ?is_NATIVE(State) -> - case check_type(OE_This, State, filename:join(FileNameList)) of - {ndirectory, _Listing} -> - {reply, - #'CosFileTransfer_FileWrapper'{the_file = - cosFileTransferApp: - create_dir(OE_This, - FileNameList), - file_type = ndirectory}, - State}; - nfile -> - {reply, - #'CosFileTransfer_FileWrapper'{the_file = - cosFileTransferApp: - create_file(OE_This, - FileNameList), - file_type = nfile}, - State}; - Other -> - %% If we want to return {stop, ....} - Other - end. - -%%---------------------------------------------------------------------- -%% Function : delete -%% Arguments : File -%% Returns : - -%% Description: -%%---------------------------------------------------------------------- -delete(_OE_This, State, File) when ?is_FTP(State); ?is_NATIVE(State) -> - Mod = ?get_Module(State), - Result = - case 'CosPropertyService_PropertySet': - get_property_value(File, "is_directory") of - #any{value=false} -> - Mod:delete(?get_Server(State), - filename:join('CosFileTransfer_File': - '_get_complete_file_name'(File))); - #any{value=true} -> - Mod:rmdir(?get_Server(State), - filename:join('CosFileTransfer_File': - '_get_complete_file_name'(File))); - Other -> - Other - end, - case Result of - ok -> - {reply, ok, State}; - {error, epath} -> - corba:raise(#'CosFileTransfer_FileNotFoundException' - {reason="File or Directory not found."}); - {error, elogin} -> - corba:raise(#'CosFileTransfer_SessionException' - {reason="User not loggen in."}); - {error, econn} -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Premature connection ending."}); - _ -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Unknown error."}) - end. - -%%---------------------------------------------------------------------- -%% Function : transfer -%% Arguments : SrcFile eq DestFile eq CosFileTransfer::File -%% Returns : - -%% Description: DestFile must be a newly created File object, using create_file() -%% on the Target FileTransferSession, prior to calling transfer(). -%%---------------------------------------------------------------------- -transfer(OE_This, State, SrcFile, DestFile) when ?is_ORBER_NATIVE(State) -> - case which_FTS_type(OE_This, SrcFile, DestFile) of - {source, TargetFTS} -> - %% The source FTS is supposed to be the active one, set up a connection. - Protocols = 'CosFileTransfer_FileTransferSession': - '_get_protocols_supported'(TargetFTS), - SrcName = 'CosFileTransfer_File':'_get_complete_file_name'(SrcFile), - Pid = spawn(?MODULE, invoke_call, [self(), transfer, - [TargetFTS, SrcFile, DestFile]]), - send_file(Protocols, ?get_MyType(State), ?get_ConnectionTimeout(State), - filename:join(SrcName)), - check_reply(Pid), - {reply, ok, State}; - {target, _SourceFTS} -> - DestName = 'CosFileTransfer_File':'_get_complete_file_name'(DestFile), - receive_file(?get_MyType(State), ?get_Connection(State), - ?get_ConnectionTimeout(State), - filename:join(DestName), write), - {reply, ok, State} - end; -transfer(OE_This, State, SrcFile, DestFile) when ?is_FTP(State); ?is_NATIVE(State) -> - case which_FTS_type(OE_This, SrcFile, DestFile) of - {source, TargetFTS} -> - source_FTS_operation(State, SrcFile, DestFile, transfer, 0, TargetFTS); - {target, _SourceFTS} -> - target_FTS_operation(State, SrcFile, DestFile, send, 0) - end. - - -%%---------------------------------------------------------------------- -%% Function : append -%% Arguments : SrcFile eq DestFile eq CosFileTransfer::File -%% Returns : - -%% Description: -%%---------------------------------------------------------------------- -append(OE_This, State, SrcFile, DestFile) when ?is_ORBER_NATIVE(State) -> - case which_FTS_type(OE_This, SrcFile, DestFile) of - {source, TargetFTS} -> - SrcName = filename:join('CosFileTransfer_File': - '_get_complete_file_name'(SrcFile)), - check_type(OE_This, State, SrcName), - %% The source FTS is supposed to be the active one, set up a connection. - Protocols = 'CosFileTransfer_FileTransferSession': - '_get_protocols_supported'(TargetFTS), - Pid = spawn(?MODULE, invoke_call, [self(), append, - [TargetFTS, SrcFile, DestFile]]), - send_file(Protocols, ?get_MyType(State), ?get_ConnectionTimeout(State), - SrcName), - check_reply(Pid), - {reply, ok, State}; - {target, _SourceFTS} -> - DestName = filename:join('CosFileTransfer_File': - '_get_complete_file_name'(DestFile)), - check_type(OE_This, State, DestName), - receive_file(?get_MyType(State), ?get_Connection(State), - ?get_ConnectionTimeout(State), DestName, append), - {reply, ok, State} - end; -append(OE_This, State, SrcFile, DestFile) when ?is_NATIVE(State) -> - case which_FTS_type(OE_This, SrcFile, DestFile) of - {source, TargetFTS} -> - source_FTS_operation(State, SrcFile, DestFile, append, 0, TargetFTS); - {target, _SourceFTS} -> - target_FTS_operation(State, SrcFile, DestFile, append, 0) - end; -append(_OE_This, _State, _SrcFile, _DestFile) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}). - - -%%---------------------------------------------------------------------- -%% Function : insert -%% Arguments : SrcFile eq DestFile eq CosFileTransfer::File -%% Offset - long -%% Returns : - -%% Description: -%%---------------------------------------------------------------------- -insert(OE_This, State, SrcFile, DestFile, Offset) when ?is_NATIVE(State) -> - case which_FTS_type(OE_This, SrcFile, DestFile) of - {source, TargetFTS} when ?is_ORBER_NATIVE(State) -> - SrcName = 'CosFileTransfer_File':'_get_complete_file_name'(SrcFile), - check_type(OE_This, State, filename:join(SrcName)), - %% The source FTS is supposed to be the active one, set up a connection. - Protocols = 'CosFileTransfer_FileTransferSession': - '_get_protocols_supported'(TargetFTS), - Pid = spawn(?MODULE, invoke_call, [self(), insert, - [TargetFTS, SrcFile, - DestFile, Offset]]), - send_file(Protocols, ?get_MyType(State), ?get_ConnectionTimeout(State), - filename:join(SrcName)), - check_reply(Pid), - {reply, ok, State}; - {source, TargetFTS} -> - source_FTS_operation(State, SrcFile, DestFile, insert, Offset, TargetFTS); - {target, _SourceFTS} -> - target_FTS_operation(State, SrcFile, DestFile, insert, Offset) - end; -insert(_OE_This, _State, _SrcFile, _DestFile, _Offset) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}). - - -%%---------------------------------------------------------------------- -%% Function : logout -%% Arguments : - -%% Returns : - -%% Description: -%%---------------------------------------------------------------------- -logout(_OE_This, State) when ?is_FTP(State); ?is_NATIVE(State) -> - Mod = ?get_Module(State), - catch Mod:close(?get_Server(State)), - {stop, normal, ok, State}. - -%%====================================================================== -%% Internal functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : oe_orber_create_directory_current -%% Arguments : - -%% Returns : Directory -%% Description: Creates a Directory describing the working directory -%% of the remote server, e.g., an FTP-server. -%%---------------------------------------------------------------------- -oe_orber_create_directory_current(OE_This, State) when ?is_FTP(State); - ?is_NATIVE(State) -> - Mod = ?get_Module(State), - FileNameList = filename:split(?get_CurrentDir(State)), - case Mod:nlist(?get_Server(State), ?get_CurrentDir(State)) of - {ok, _Listing} -> - {reply, cosFileTransferApp:create_dir(OE_This, FileNameList), - State}; - {error, epath} -> - corba:raise(#'CosFileTransfer_FileNotFoundException' - {reason="Directory not found."}); - {error, elogin} -> - corba:raise(#'CosFileTransfer_SessionException' - {reason="User not loggen in."}); - {error, econn} -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Premature connection ending."}); - _ -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Unknown error."}) - end. -%%---------------------------------------------------------------------- -%% Function : oe_orber_get_content -%% Arguments : - -%% Returns : string -%% Description: -%%---------------------------------------------------------------------- -oe_orber_get_content(OE_This, State, FileNameList, Parent) when ?is_FTP(State); - ?is_NATIVE(State) -> - Mod = ?get_Module(State), - case Mod:nlist(?get_Server(State), filename:join(FileNameList)) of - {ok, Listing} -> - create_content(Listing, OE_This, State, Parent, FileNameList); - {error, epath} -> - {reply, [], State}; - _ -> - corba:raise(#'CosFileTransfer_FileNotFoundException' - {reason="Directory not found."}) - end. - -%%---------------------------------------------------------------------- -%% Function : oe_orber_count_children -%% Arguments : - -%% Returns : string -%% Description: -%%---------------------------------------------------------------------- -oe_orber_count_children(OE_This, State, FileNameList) when ?is_FTP(State); - ?is_NATIVE(State) -> - case catch check_type(OE_This, State, filename:join(FileNameList)) of - {ndirectory, Members} -> - {reply, length(Members), State}; - {stop, normal, _, _} -> - {stop, normal, - {'EXCEPTION', #'INTERNAL'{completion_status=?COMPLETED_NO}}, - State}; - _-> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%---------------------------------------------------------------------- -%% Function : delete_tmp_file -%% Arguments : - -%% Returns : ok | {'EXCEPTION', E} -%% Description: -%%---------------------------------------------------------------------- -delete_tmp_file(TmpFileName, ErrorMsg) -> - case file:delete(TmpFileName) of - ok -> - ok; - _ -> - corba:raise(#'CosFileTransfer_RequestFailureException'{reason=ErrorMsg}) - end. - - -%%---------------------------------------------------------------------- -%% Function : invoke_call -%% Arguments : - -%% Returns : ok | {'EXCEPTION', E} -%% Description: -%%---------------------------------------------------------------------- -invoke_call(Pid, Op, Args) -> - Result = (catch apply('CosFileTransfer_FileTransferSession', Op, Args)), - Pid ! {transfer_result, self(), Result}, - ok. - -%%---------------------------------------------------------------------- -%% Function : check_reply -%% Arguments : Pid - the pid of the spawned process. -%% Returns : ok | {'EXCEPTION', E} -%% Description: -%%---------------------------------------------------------------------- -check_reply(Pid) -> - receive - {transfer_result, Pid, ok} -> - ok; - {transfer_result, Pid, {'EXCEPTION', E}} -> - orber:debug_level_print("[~p] CosFileTransfer_FileTransferSession:check_reply(); -Raised exception: ", [?LINE, E], ?DEBUG_LEVEL), - corba:raise(E); - {transfer_result, Pid, {'EXIT', Reason}} -> - orber:debug_level_print("[~p] CosFileTransfer_FileTransferSession:check_reply(); -Got EXIT-signal with reason: ", [?LINE, Reason], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{minor=199, - completion_status=?COMPLETED_NO}) - after infinity -> - %% Should we add an exception here or do we reuse the iiop_timeout? - %% For now keep as is. - corba:raise(#'INTERNAL'{minor=199, - completion_status=?COMPLETED_NO}) - end. - - -%%---------------------------------------------------------------------- -%% Function : which_FTS_type -%% Arguments : - -%% Returns : {source, FTS} | {target, FTS} | {'EXCEPTION', #'BAD_PARAM'{}} -%% Description: Used to determine if the target FTS is supposed to act -%% as sender or receiver and also return the counter part FTS. -%% An exception is raised if the user supplied incorrect parameters. -%%---------------------------------------------------------------------- -which_FTS_type(OE_This, SrcFile, DestFile) -> - TargetFTS = 'CosFileTransfer_File':'_get_associated_session'(DestFile), - SourceFTS = 'CosFileTransfer_File':'_get_associated_session'(SrcFile), - case corba_object:is_equivalent(OE_This, TargetFTS) of - true -> - {target, SourceFTS}; - false -> - case corba_object:is_equivalent(OE_This, SourceFTS) of - true -> - {source, TargetFTS}; - false -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end - end. - - -%%---------------------------------------------------------------------- -%% Function : setup_connection -%% Arguments : A list of #'CosFileTransfer_ProtocolSupport'{} -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -setup_connection([], Protocol, _) -> - orber:debug_level_print("[~p] CosFileTransfer_FileTransferSession:setup_connection(~p); -The Protocols listed are not supported.", [?LINE, Protocol], ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_TransferException'{reason="Unsupported protocol"}); -setup_connection([#'CosFileTransfer_ProtocolSupport'{protocol_name="TCP/IP", - addresses=Addr}|_], - tcp, Timeout) -> - setup_connection_helper(Addr, gen_tcp, [], Timeout); -setup_connection([#'CosFileTransfer_ProtocolSupport'{protocol_name="SSL", - addresses=Addr}|_], - ssl, Timeout) -> - Options = [{certfile, cosFileTransferApp:ssl_client_certfile()}, - {verify, cosFileTransferApp:ssl_client_verify()}, - {depth, cosFileTransferApp:ssl_client_depth()}] ++ - ssl_client_cacertfile_option(), - setup_connection_helper(Addr, ssl, Options, Timeout); -setup_connection([_|T], Type, Timeout) -> - setup_connection(T, Type, Timeout). - -setup_connection_helper([], _, _, _) -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Unable to contact remote server."}); -setup_connection_helper([H|T], Driver, Options, Timeout) -> - case string:tokens(H, ":") of - [Host, Port] when Driver == gen_tcp -> - case gen_tcp:connect(Host, list_to_integer(Port), - [binary, - {packet, raw}, - {reuseaddr, true}, - {nodelay, true}|Options], Timeout) of - {ok, Sock} -> - {gen_tcp, Sock}; - _-> - %% No response. - setup_connection_helper(T, Driver, Options, Timeout) - end; - [Host, Port] when Driver == ssl -> - case ssl:connect(Host, list_to_integer(Port), - [binary, - {packet, 0}, - {active, false}|Options], Timeout) of - {ok, Sock} -> - {ssl, Sock}; - _-> - %% No response. - setup_connection_helper(T, Driver, Options, Timeout) - end; - _ -> - %% Badly configured address. - setup_connection_helper(T, Driver, Options, Timeout) - end. - -ssl_client_cacertfile_option() -> - case cosFileTransferApp:ssl_client_cacertfile() of - [] -> - []; - X when is_list(X) -> - {cacertfile, X}; - _ -> - [] - end. - -%%---------------------------------------------------------------------- -%% Function : create_content -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -create_content(Listing, OE_This, State, Parent, PathList) -> - create_content(string:tokens(Listing, ?SEPARATOR), OE_This, - State, Parent, PathList, []). - -create_content([], _OE_This, State, _Parent, _PathList, Acc) -> - {reply, Acc, State}; -create_content([H|T], OE_This, State, Parent, PathList, Acc) -> - FullPathList = PathList ++[filename:basename(H)], - case check_type(OE_This, State, filename:join(FullPathList)) of - nfile -> - create_content(T, OE_This, State, Parent, PathList, - [#'CosFileTransfer_FileWrapper' - {the_file = cosFileTransferApp:create_file(OE_This, - FullPathList, - Parent), - file_type = nfile}|Acc]); - {ndirectory, _Members} -> - create_content(T, OE_This, State, Parent, PathList, - [#'CosFileTransfer_FileWrapper' - {the_file = cosFileTransferApp:create_dir(OE_This, - FullPathList, - Parent), - file_type = ndirectory}|Acc]); - Other -> - Other - end. - - -%%---------------------------------------------------------------------- -%% Function : MISC functions -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -setup_local(tcp) -> - {ok,Socket}=gen_tcp:listen(0, [binary, - {packet, 0}, - {backlog,1}, - {active, false}]), - {ok, Port} = inet:port(Socket), - {Socket, [#'CosFileTransfer_ProtocolSupport'{protocol_name="TCP/IP", - addresses = [local_address(Port)]}]}; -setup_local(ssl) -> - Options = [{certfile, cosFileTransferApp:ssl_server_certfile()}, - {verify, cosFileTransferApp:ssl_server_verify()}, - {depth, cosFileTransferApp:ssl_server_depth()}] ++ - ssl_server_cacertfile_option(), - {ok,Socket}=ssl:listen(0, [binary, - {packet, 0}, - {backlog,1}, - {active, false}|Options]), - {ok, {_Address, Port}} = ssl:sockname(Socket), - {Socket, [#'CosFileTransfer_ProtocolSupport'{protocol_name="SSL", - addresses = [local_address(Port)]}]}. - -local_address(Port) -> - {ok, Hostname} = inet:gethostname(), - {ok, {A1, A2, A3, A4}} = inet:getaddr(Hostname, inet), - integer_to_list(A1) ++ "." ++ integer_to_list(A2) ++ "." ++ integer_to_list(A3) - ++ "." ++ integer_to_list(A4)++":"++integer_to_list(Port). - -ssl_server_cacertfile_option() -> - case cosFileTransferApp:ssl_server_cacertfile() of - [] -> - []; - X when is_list(X) -> - [{cacertfile, X}]; - _ -> - [] - end. - -%%---------------------------------------------------------------------- -%% Function : source_file_operation -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -source_FTS_operation(State, SrcFile, DestFile, Op, Offset, FTS) -> - Mod = ?get_Module(State), - %% The source FTS is supposed to be the active one, set up a connection. - Protocols = 'CosFileTransfer_FileTransferSession':'_get_protocols_supported'(FTS), - SrcName = 'CosFileTransfer_File':'_get_complete_file_name'(SrcFile), - TempName = cosFileTransferApp:create_name("TemporarySrcFile"), - case Mod:recv(?get_Server(State), filename:join(SrcName), TempName) of - ok when Op == insert -> - %% Downloaded the File, we are now ready to transmit. - Pid = spawn(?MODULE, invoke_call, [self(), insert, - [FTS, SrcFile, DestFile, Offset]]), - send_file(Protocols, ?get_MyType(State), ?get_ConnectionTimeout(State), - TempName), - %% Delete the temporary local copy. - delete_tmp_file(TempName, - "Transfer completed but failed to remove temporary local copy."), - check_reply(Pid), - {reply, ok, State}; - ok -> - %% Downloaded the File, we are now ready to transmit. - Pid = spawn(?MODULE, invoke_call, [self(), Op, [FTS, SrcFile, DestFile]]), - send_file(Protocols, ?get_MyType(State), ?get_ConnectionTimeout(State), - TempName), - %% Delete the temporary local copy. - delete_tmp_file(TempName, - "Transfer completed but failed to remove temporary local copy."), - check_reply(Pid), - {reply, ok, State}; - {error, epath} -> - corba:raise(#'CosFileTransfer_FileNotFoundException' - {reason="File not found."}); - {error, elogin} -> - corba:raise(#'CosFileTransfer_SessionException' - {reason="User not loggen in."}); - {error, econn} -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Premature connection ending."}) - end. - -%%---------------------------------------------------------------------- -%% Function : target_file_operation -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -target_FTS_operation(State, _SrcFile, DestFile, Op, Offset) -> - Mod = ?get_Module(State), - DestName = 'CosFileTransfer_File':'_get_complete_file_name'(DestFile), - TempName = cosFileTransferApp:create_name("TemporaryDestFile"), - receive_file(?get_MyType(State), ?get_Connection(State), - ?get_ConnectionTimeout(State), TempName, write), - Result = - if - Op == insert -> - Mod:insert(?get_Server(State), TempName, filename:join(DestName), Offset); - true -> - Mod:Op(?get_Server(State), TempName, filename:join(DestName)) - end, - case Result of - ok -> - %% Delete the temporary local copy. - delete_tmp_file(TempName, - "Transfer completed but failed to remove temporary local copy."), - %% Completed the transfer successfully. - {reply, ok, State}; - {error, epath} -> - delete_tmp_file(TempName, - "IllegalOperationException and not able to remove temporary local copy."), - corba:raise(#'CosFileTransfer_IllegalOperationException' - {reason="Not allowed by destination."}); - {error, elogin} -> - delete_tmp_file(TempName, - "SessionException and not able to remove temporary local copy."), - corba:raise(#'CosFileTransfer_SessionException' - {reason="User not logged in."}); - {error, econn} -> - delete_tmp_file(TempName, - "TransferException and not able to remove temporary local copy."), - corba:raise(#'CosFileTransfer_TransferException' - {reason="Premature connection ending."}); - {error, etnospc} -> - delete_tmp_file(TempName, - "RequestFailureException and not able to remove temporary local copy."), - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Premature connection ending."}); - {error, efnamena} -> - delete_tmp_file(TempName, - "IllegalOperationException and not able to remove temporary local copy."), - corba:raise(#'CosFileTransfer_IllegalOperationException' - {reason="Not allowed by destination."}) - end. - -%%---------------------------------------------------------------------- -%% Function : receive_file -%% Arguments : Driver - currently only gen_tcp supported. -%% LSocket - which socket to use. -%% FileName - an absolute file name representing the -%% file we want to create or append to. -%% Type - 'read', 'write', 'append'. -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -receive_file(tcp, LSock, Timeout, FileName, Type) -> - %% The Type can be the ones allowed by the file-module, i.e., - %% 'read', 'write' or 'append' - FD = file_open(FileName, Type), - case gen_tcp:accept(LSock, Timeout) of - {ok, Sock} -> - receive_file_helper(gen_tcp, Sock, FD); - {error, timeout} -> - orber:dbg("[~p] CosFileTransfer_FileTransferSession:receive_file();~n" - "gen_tcp:accept(~p) timed out", [?LINE, Timeout], ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="TCP accept timed out.."}); - {error, Why} -> - orber:dbg("[~p] CosFileTransfer_FileTransferSession:receive_file();~n" - "gen_tcp:accept(~p) failed: ~p", [?LINE, Timeout, Why], ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="TCP accept failed."}) - end; -receive_file(ssl, LSock, Timeout, FileName, Type) -> - %% The Type can be the ones allowed by the file-module, i.e., - %% 'read', 'write' or 'append' - FD = file_open(FileName, Type), - case ssl:transport_accept(LSock, Timeout) of - {ok, Sock} -> - case ssl:ssl_accept(Sock, Timeout) of - ok -> - receive_file_helper(ssl, Sock, FD); - {error, Error} -> - orber:dbg("[~p] CosFileTransfer_FileTransferSession:receive_file();~n" - "ssl:ssl_accept(~p) failed: ~p", - [?LINE, Timeout, Error], ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="TCP accept failed."}) - end; - {error, timeout} -> - orber:dbg("[~p] CosFileTransfer_FileTransferSession:receive_file();~n" - "ssl:transport_accept(~p) timed out", - [?LINE, Timeout], ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="TCP accept timed out.."}); - {error, Why} -> - orber:dbg("[~p] CosFileTransfer_FileTransferSession:receive_file();~n" - "ssl:transport_accept(~p) failed: ~p", - [?LINE, Timeout, Why], ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="TCP accept failed."}) - end. - -receive_file_helper(Driver, Sock, FD) -> - case Driver:recv(Sock, 0) of - {ok, Bin} -> - file:write(FD, Bin), - receive_file_helper(Driver, Sock, FD); - {error, closed} -> - file:close(FD); - What -> - orber:debug_level_print("[~p] CosFileTransfer_FileTransferSession:receive_file(~p); -Error occured when receiving data: ~p", [?LINE, Driver, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%---------------------------------------------------------------------- -%% Function : send_file -%% Arguments : Driver - currently only gen_tcp supported. -%% Sock - which socket to use. -%% FileName - an absolute file name representing the -%% file we want to send. -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -send_file(Protocols, Type, Timeout, FileName) -> - {Driver, Sock} = setup_connection(Protocols, Type, Timeout), - FD = file_open(FileName, read), - BuffSize = cosFileTransferApp:get_buffert_size(), - send_file_helper(Driver, Sock, FD, BuffSize). - -send_file_helper(Driver, Sock, FD, BuffSize) -> - case file:read(FD, BuffSize) of - eof -> - file:close(FD), - Driver:close(Sock); - {ok, Bin} -> - case Driver:send(Sock, Bin) of - ok -> - send_file_helper(Driver, Sock, FD, BuffSize); - What -> - orber:debug_level_print("[~p] CosFileTransfer_FileTransferSession:send_file_helper(~p); -Error occured when sending data: ~p", [?LINE, Driver, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end - end. - - -file_open(File, Type) -> - case file:open(File, [raw, binary, Type]) of - {ok, FD} -> - FD; - {error, What} -> - orber:debug_level_print("[~p] CosFileTransfer_FileTransferSession:file_open(~p); -Failed to open the file due to: ~p", [?LINE, File, What], ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Unable to open given file."}) - end. - -%%---------------------------------------------------------------------- -%% Function : check_type -%% Arguments : FullName - an absolute file name representing the -%% file or directory we want to evaluate. -%% Returns : -%% Description: -%% When communcating with FTP-servers on different platforms a variety of -%% answers can be returned. A few examples: -%% -%% ### ftp:nlist on an empty directory ### -%% {ok, ""}, {error, epath} -%% -%% ### ftp:nlist on a non-existing directory or file ### -%% {ok, "XXX: No such file or directory}, {error, epath} -%% -%% ### ftp:nlist on an existing directory with one contained item ### -%% {ok, "Item"} -%% -%% Comparing the above we see that it's virtually impossible to tell apart -%% {ok, "XXX: No such file or directory} and {ok, "Item"}. -%% Hence, it's easier to test if it's possible to do ftp:cd instead. -%% Ugly, but rather effective. If we look at the bright side, it's only -%% necessary when we try to lookup: -%% * non-existing item -%% * A directory with one member only. -%% * An empty directory. -%% -%% Furthermore, no need for traversing Listings etc. -%%---------------------------------------------------------------------- -check_type(_OE_This, State, FullName) when ?is_FTP(State); ?is_NATIVE(State) -> - Mod = ?get_Module(State), - Result = - case Mod:nlist(?get_Server(State), FullName) of - {ok, Listing} when length(Listing) > 0-> - case string:tokens(Listing, ?SEPARATOR) of - [FullName] -> - nfile; - Members when length(Members) > 1 -> - %% Must test if more than one member since sometimes - %% this operation returns for example: - %% {ok, "XXX No such file or drectory"} - {ndirectory, Members}; - Member -> - case Mod:cd(?get_Server(State), FullName) of - ok -> - case Mod:cd(?get_Server(State), - ?get_CurrentDir(State)) of - ok -> - {ndirectory, Member}; - _ -> - %% Failed, we cannot continue since the - %% FTS now pointso an incorrect Directory. - %% Hence, we must terminate. - {stop, normal, - {'EXCEPTION', - #'CosFileTransfer_RequestFailureException' - {reason="Unknown error."}}, State} - end; - {error, E} -> - {error, E}; - _ -> - nfile - end - end; - {error, epath} -> - %% Might be a file. - DirName = filename:dirname(FullName), - case Mod:nlist(?get_Server(State), DirName) of - {ok, Listing} when length(Listing) > 0-> - Members = string:tokens(Listing, ?SEPARATOR), - case lists:member(FullName, Members) of - true -> - nfile; - _ -> - BName = filename:basename(FullName), - case lists:member(BName, Members) of - true -> - nfile; - _ -> - {error, epath} - end - end; - _ -> - {error, epath} - end; - _ -> - case Mod:cd(?get_Server(State), FullName) of - ok -> - case Mod:cd(?get_Server(State), ?get_CurrentDir(State)) of - ok -> - {ndirectory, []}; - _ -> - %% Failed, we cannot continue since the - %% FTS now pointso an incorrect Directory. - %% Hence, we must terminate. - {stop, normal, - {'EXCEPTION', - #'CosFileTransfer_RequestFailureException' - {reason="Unknown error."}}, State} - end; - _ -> - {error, epath} - end - end, - case Result of - {error, epath} -> - corba:raise(#'CosFileTransfer_FileNotFoundException' - {reason="File or Directory not found."}); - {error, elogin} -> - corba:raise(#'CosFileTransfer_SessionException' - {reason="User not logged in."}); - {error, econn} -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Premature connection ending."}); - Other -> - Other - end. - - - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosFileTransfer/src/CosFileTransfer_File_impl.erl b/lib/cosFileTransfer/src/CosFileTransfer_File_impl.erl deleted file mode 100644 index 263255413e..0000000000 --- a/lib/cosFileTransfer/src/CosFileTransfer_File_impl.erl +++ /dev/null @@ -1,385 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% 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. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosFileTransfer_File_impl.erl -%% Description : -%% -%% Created : 5 Feb 2001 -%%---------------------------------------------------------------------- --module('CosFileTransfer_File_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - --include_lib("cosProperty/include/CosPropertyService.hrl"). - --include("cosFileTransferApp.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2]). - -%% Interface functions --export(['_get_name'/2, - '_get_complete_file_name'/2, - '_get_parent'/2, - '_get_associated_session'/2]). - -%% Inherited CosPropertyService::PropertySetDef --export([get_allowed_property_types/2, - get_allowed_properties/2, - define_property_with_mode/5, - define_properties_with_modes/3, - get_property_mode/3, - get_property_modes/3, - set_property_mode/4, - set_property_modes/3]). - -%% Inherited CosPropertyService::PropertySet --export([define_property/4, - define_properties/3, - get_number_of_properties/2, - get_all_property_names/3, - get_property_value/3, - get_properties/3, - get_all_properties/3, - delete_property/3, - delete_properties/3, - delete_all_properties/2, - is_property_defined/3]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {property, - name, - completeName, - parent, - assocSession}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- --define(create_InitState(Pr, N, C, Pa, A), - #state{property = Pr, - name = N, - completeName = C, - parent = Pa, - assocSession = A}). - --define(get_PropertyRef(S), S#state.property). --define(get_Name(S), S#state.name). --define(get_CompleteName(S), S#state.completeName). --define(get_Parent(S), S#state.parent). --define(get_AssocSession(S), S#state.assocSession). - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([Name, CompleteName, Parent, AssocSession]) -> - PropTypes = [tk_boolean], - PropDefs = [#'CosPropertyService_PropertyDef' - {property_name = "is_directory", - property_value = #any{typecode=tk_boolean, value=false}, - property_mode = fixed_readonly}], - Prop = cosProperty:create_static_SetDef(PropTypes, PropDefs), - {ok, ?create_InitState(Prop, Name, CompleteName, Parent, AssocSession)}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%====================================================================== -%% CosFileTransfer::File -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : '_get_name' -%% Arguments : - -%% Returns : CosFileTransfer::FileName - string -%% Description: -%%---------------------------------------------------------------------- -'_get_name'(_OE_This, State) -> - {reply, ?get_Name(State), State}. - -%%---------------------------------------------------------------------% -%% Function : '_get_complete_file_name' -%% Arguments : - -%% Returns : CosFileTransfer::FileNameList - a list of strings's -%% Description: -%%---------------------------------------------------------------------- -'_get_complete_file_name'(_OE_This, State) -> - {reply, ?get_CompleteName(State), State}. - -%%---------------------------------------------------------------------% -%% Function : '_get_parent' -%% Arguments : - -%% Returns : CosFileTransfer::Directory -%% Description: -%%---------------------------------------------------------------------- -'_get_parent'(_OE_This, State) -> - {reply, ?get_Parent(State), State}. - -%%---------------------------------------------------------------------% -%% Function : '_get_associated_session' -%% Arguments : - -%% Returns : CosFileTransfer::FileTransferSession -%% Description: -%%---------------------------------------------------------------------- -'_get_associated_session'(_OE_This, State) -> - {reply, ?get_AssocSession(State), State}. - -%%====================================================================== -%% CosPropertyService::PropertySetDef -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : get_allowed_property_types -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_allowed_property_types(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySetDef': - get_allowed_property_types(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : get_allowed_properties -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_allowed_properties(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySetDef': - get_allowed_properties(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : define_property_with_mode -%% Arguments : Name - string() -%% Value - #any{} -%% Mode - normal | read_only | fixed_normal | fixed_readonly -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_property_with_mode(_OE_This, State, Name, Value, Mode) -> - {reply, 'CosPropertyService_PropertySetDef': - define_property_with_mode(?get_PropertyRef(State), Name, Value, Mode), State}. - -%%---------------------------------------------------------------------% -%% Function : define_properties_with_modes -%% Arguments : PropertyDefs - list of #'CosPropertyService_PropertyDef'{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_properties_with_modes(_OE_This, State, PropertyDefs) -> - {reply, 'CosPropertyService_PropertySetDef': - define_properties_with_modes(?get_PropertyRef(State), PropertyDefs), State}. - -%%---------------------------------------------------------------------% -%% Function : get_property_mode -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_property_mode(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySetDef': - get_property_mode(?get_PropertyRef(State), Name), State}. - - -%%---------------------------------------------------------------------% -%% Function : get_property_modes -%% Arguments : Names - a list of Name (i.e. string()'s). -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_property_modes(_OE_This, State, Names) -> - {reply, 'CosPropertyService_PropertySetDef': - get_property_modes(?get_PropertyRef(State), Names), State}. - -%%---------------------------------------------------------------------% -%% Function : set_property_mode -%% Arguments : Name - string() -%% Mode - normal | read_only | fixed_normal | fixed_readonly -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -set_property_mode(_OE_This, State, Name, Mode) -> - {reply, 'CosPropertyService_PropertySetDef': - set_property_mode(?get_PropertyRef(State), Name, Mode), State}. - - -%%---------------------------------------------------------------------% -%% Function : set_property_modes -%% Arguments : Modes - a list of #'CosPropertyService_PropertyModes'{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -set_property_modes(_OE_This, State, PropertyModes) -> - {reply, 'CosPropertyService_PropertySetDef': - set_property_modes(?get_PropertyRef(State), PropertyModes), State}. - -%%====================================================================== -%% CosPropertyService::PropertySet -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : define_property -%% Arguments : Name - string() -%% Value - #any{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_property(_OE_This, State, Name, Value) -> - {reply, 'CosPropertyService_PropertySet': - define_property(?get_PropertyRef(State), Name, Value), State}. - -%%---------------------------------------------------------------------% -%% Function : define_properties -%% Arguments : Properties - a list of #'CosPropertyService_Property'{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_properties(_OE_This, State, Properties) -> - {reply, 'CosPropertyService_PropertySet': - define_properties(?get_PropertyRef(State), Properties), State}. - - -%%---------------------------------------------------------------------% -%% Function : get_number_of_properties -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_number_of_properties(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySet': - get_number_of_properties(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : get_all_property_names -%% Arguments : Max - ulong() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_all_property_names(_OE_This, State, Max) -> - {reply, 'CosPropertyService_PropertySet': - get_all_property_names(?get_PropertyRef(State), Max), State}. - -%%---------------------------------------------------------------------% -%% Function : get_property_value -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_property_value(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySet': - get_property_value(?get_PropertyRef(State), Name), State}. - -%%---------------------------------------------------------------------% -%% Function : get_properties -%% Arguments : Names - a list of Name (i.e. string()'s) -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_properties(_OE_This, State, Names) -> - {reply, 'CosPropertyService_PropertySet': - get_properties(?get_PropertyRef(State), Names), State}. - - -%%---------------------------------------------------------------------% -%% Function : get_all_properties -%% Arguments : Max - ulong() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_all_properties(_OE_This, State, Max) -> - {reply, 'CosPropertyService_PropertySet': - get_all_properties(?get_PropertyRef(State), Max), State}. - - -%%---------------------------------------------------------------------% -%% Function : delete_property -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -delete_property(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySet': - delete_property(?get_PropertyRef(State), Name), State}. - - -%%---------------------------------------------------------------------% -%% Function : delete_properties -%% Arguments : Names - a list of Name (i.e. string()'s) -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -delete_properties(_OE_This, State, Names) -> - {reply, 'CosPropertyService_PropertySet': - delete_properties(?get_PropertyRef(State), Names), State}. - - -%%---------------------------------------------------------------------% -%% Function : delete_all_properties -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -delete_all_properties(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySet': - delete_all_properties(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : is_property_defined -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -is_property_defined(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySet': - is_property_defined(?get_PropertyRef(State), Name), State}. - -%%====================================================================== -%% Internal functions -%%====================================================================== - -%%====================================================================== -%% END OF MODULE -%%====================================================================== - diff --git a/lib/cosFileTransfer/src/CosFileTransfer_VirtualFileSystem_impl.erl b/lib/cosFileTransfer/src/CosFileTransfer_VirtualFileSystem_impl.erl deleted file mode 100644 index 7440498a23..0000000000 --- a/lib/cosFileTransfer/src/CosFileTransfer_VirtualFileSystem_impl.erl +++ /dev/null @@ -1,217 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% 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. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosFileTransfer_VirtualFileSystem_impl.erl -%% Description : -%% -%% Created : 12 Sept 2000 -%%---------------------------------------------------------------------- --module('CosFileTransfer_VirtualFileSystem_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - --include_lib("cosFileTransfer/include/CosFileTransfer.hrl"). --include("cosFileTransferApp.hrl"). - - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). - -%% Interface functions --export(['_get_file_system_type'/2, - '_get_supported_content_types'/2, - login/5]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {type, content, host, port, protocol, timeout, module}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- --define(create_InitState(T, C, H, P, Pr, TO), - #state{type=T, - content=C, - host=H, - port=P, - protocol=Pr, - timeout=TO}). --define(create_NativeInitState(T, C, H, P, Pr, TO, M), - #state{type=T, - content=C, - host=H, - port=P, - protocol=Pr, - timeout=TO, - module=M}). - --define(get_Type(S), S#state.type). --define(get_Content(S), S#state.content). --define(get_Host(S), S#state.host). --define(get_Port(S), S#state.port). --define(get_StartDir(S), S#state.startdir). --define(get_Module(S), S#state.module). --define(get_Protocol(S), S#state.protocol). --define(get_Timeout(S), S#state.timeout). - --define(is_FTP(S), S#state.type == 'FTP'). --define(is_FTAM(S), S#state.type == 'FTAM'). --define(is_NATIVE(S), S#state.type == 'NATIVE'). - - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([{Type, Mod}, Content, Host, Port, Options]) -> - Prot = cosFileTransferApp:get_option(protocol, Options, ?DEFAULT_CONFIG), - Time = timer:seconds(cosFileTransferApp:get_option(connect_timeout, Options, - ?DEFAULT_CONFIG)), - {ok, ?create_NativeInitState(Type, Content, Host, Port, Prot, Time, Mod)}; -init([Type, Content, Host, Port, Options]) -> - Prot = cosFileTransferApp:get_option(protocol, Options, ?DEFAULT_CONFIG), - Time = timer:seconds(cosFileTransferApp:get_option(connect_timeout, Options, - ?DEFAULT_CONFIG)), - {ok, ?create_InitState(Type, Content, Host, Port, Prot, Time)}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% function : handle_info/2 -%% Arguments: -%% Returns : -%% Effect : -%%---------------------------------------------------------------------- -handle_info(_Info, State) -> - {noreply, State}. - -%%====================================================================== -%% CosFileTransfer::VirtualFileSystem -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : '_get_file_system_type' -%% Arguments : - -%% Returns : CosFileTransfer::NativeFileSystemType, i.e., 'FTP', 'FTAM', -%% or 'NATIVE'. Currently only 'FTP' is allowed. -%% Description: -%%---------------------------------------------------------------------- -'_get_file_system_type'(_OE_This, State) -> - {reply, ?get_Type(State), State}. - -%%---------------------------------------------------------------------% -%% Function : '_get_supported_content_types' -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -'_get_supported_content_types'(_OE_This, State) -> - {reply, ?get_Content(State), State}. - -%%---------------------------------------------------------------------- -%% Function : login -%% Arguments : User - string() -%% Password - string() -%% Account - string() -%% Returns : FileTransferSession object and Directory object (out-type). -%% Description: -%%---------------------------------------------------------------------- -login(_OE_This, State, User, Password, Account) when ?is_FTP(State) -> - case catch 'CosFileTransfer_FileTransferSession': - oe_create(['FTP', ?get_Host(State), ?get_Port(State), User, Password, Account, - ?get_Protocol(State), ?get_Timeout(State)], - [{sup_child, true}]) of - {ok, _Pid, FTS} -> - Dir = 'CosFileTransfer_FileTransferSession': - oe_orber_create_directory_current(FTS), - {reply, {FTS, Dir}, State}; - What -> - orber:debug_level_print("[~p] CosFileTransfer_VirtualFileSystem:login(~p ~p ~p ~p); -Unable to create a FileTransferSession: ~p", - [?LINE, ?get_Host(State), ?get_Port(State), User, - ?get_Protocol(State), What], - ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_SessionException'{reason="Failed creating a FTS"}) - end; -login(_OE_This, State, User, Password, Account) when ?is_NATIVE(State) -> - case catch 'CosFileTransfer_FileTransferSession': - oe_create([{'NATIVE', ?get_Module(State)}, ?get_Host(State), - ?get_Port(State), User, Password, Account, - ?get_Protocol(State), ?get_Timeout(State)], - [{sup_child, true}]) of - {ok, _Pid, FTS} -> - Dir = 'CosFileTransfer_FileTransferSession': - oe_orber_create_directory_current(FTS), - {reply, {FTS, Dir}, State}; - What -> - orber:debug_level_print("[~p] CosFileTransfer_VirtualFileSystem:login(~p ~p ~p ~p); -Unable to create a FileTransferSession: ~p", - [?LINE, ?get_Host(State), ?get_Port(State), User, - ?get_Protocol(State), What], - ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_SessionException'{reason="Failed creating a FTS"}) - end. - -%%====================================================================== -%% Internal functions -%%====================================================================== - - - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosFileTransfer/src/Makefile b/lib/cosFileTransfer/src/Makefile deleted file mode 100644 index b3967101e9..0000000000 --- a/lib/cosFileTransfer/src/Makefile +++ /dev/null @@ -1,188 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2016. All Rights Reserved. -# -# 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. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk - -ifeq ($(TYPE),debug) -ERL_COMPILE_FLAGS += -Ddebug -W -endif - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSFILETRANSFER_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/cosFileTransfer-$(VSN) - -EXTERNAL_INC_PATH = ../include - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -MODULES = \ - cosFileTransferApp \ - CosFileTransfer_Directory_impl \ - CosFileTransfer_File_impl \ - CosFileTransfer_VirtualFileSystem_impl \ - CosFileTransfer_FileTransferSession_impl \ - CosFileTransfer_FileIterator_impl \ - cosFileTransferNATIVE_file \ - -ERL_FILES = $(MODULES:%=%.erl) -HRL_FILES = \ - cosFileTransferApp.hrl \ - -GEN_ERL_FILES = \ - oe_CosFileTransfer.erl \ - CosFileTransfer.erl \ - CosFileTransfer_AccessLevel.erl \ - CosFileTransfer_CommandNotImplementedException.erl \ - CosFileTransfer_Directory.erl \ - CosFileTransfer_File.erl \ - CosFileTransfer_FileIterator.erl \ - CosFileTransfer_FileList.erl \ - CosFileTransfer_FileNameList.erl \ - CosFileTransfer_FileNotFoundException.erl \ - CosFileTransfer_FileTransferSession.erl \ - CosFileTransfer_FileWrapper.erl \ - CosFileTransfer_IllegalOperationException.erl \ - CosFileTransfer_ProtocolAddressList.erl \ - CosFileTransfer_ProtocolSupport.erl \ - CosFileTransfer_RequestFailureException.erl \ - CosFileTransfer_SessionException.erl \ - CosFileTransfer_SupportedProtocolAddresses.erl \ - CosFileTransfer_TransferException.erl \ - CosFileTransfer_VirtualFileSystem.erl \ - CosFileTransfer_VirtualFileSystem_ContentList.erl \ - -LOCAL_HRL_FILES = \ - oe_CosFileTransfer.hrl \ - CosFileTransfer.hrl \ - CosFileTransfer_Directory.hrl \ - CosFileTransfer_File.hrl \ - CosFileTransfer_FileIterator.hrl \ - CosFileTransfer_FileTransferSession.hrl \ - CosFileTransfer_VirtualFileSystem.hrl \ - -GEN_HRL_FILES = $(LOCAL_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - -GEN_FILES = \ - $(GEN_HRL_FILES) \ - $(GEN_ERL_FILES) - -TARGET_FILES = \ - $(GEN_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ - $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - -IDL_FILES = \ - CosFileTransfer.idl - -APPUP_FILE = cosFileTransfer.appup -APPUP_SRC = $(APPUP_FILE).src -APPUP_TARGET = $(EBIN)/$(APPUP_FILE) - -APP_FILE = cosFileTransfer.app -APP_SRC = $(APP_FILE).src -APP_TARGET = $(EBIN)/$(APP_FILE) - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosFileTransfer/ebin \ - -pa $(ERL_TOP)/lib/cosProperty/ebin \ - -pa $(ERL_TOP)/lib/cosProperty/src \ - -I$(ERL_TOP)/lib/cosProperty/src \ - -pa $(ERL_TOP)/lib/ic/ebin \ - -pa $(ERL_TOP)/lib/orber/ebin - -# The -pa option is just used temporary until erlc can handle -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber/include \ - -pa $(ERL_TOP)/lib/cosFileTransfer/include \ - -pa $(ERL_TOP)/lib/cosProperty/include \ - -pa $(ERL_TOP)/lib/cosProperty/src \ - -I$(ERL_TOP)/lib/orber/include \ - -I$(ERL_TOP)/lib/cosFileTransfer/include \ - -I$(ERL_TOP)/lib/cosProperty/include \ - -I$(ERL_TOP)/lib/cosProperty/src \ - +'{parse_transform,sys_pre_attributes}' \ - +'{attribute,insert,app_vsn,"cosFileTransfer_$(COSFILETRANSFER_VSN)"}' - - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - -debug: - @${MAKE} TYPE=debug opt - -cleanb: - rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - rm -f errs core *~ - -clean: - rm -f $(TARGET_FILES) $(GEN_FILES) $(APP_TARGET) $(APPUP_TARGET) IDL-GENERATED - rm -f errs core *~ - -$(APP_TARGET): $(APP_SRC) - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ - -$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- -IDL-GENERATED: CosFileTransfer.idl - $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosFileTransfer.cfg"}' CosFileTransfer.idl - $(V_at)mv $(LOCAL_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)>IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin" - $(INSTALL_DIR) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(GEN_FILES) $(IDL_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(GEN_ERL_FILES) $(IDL_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DIR) "$(RELSYSDIR)/include" - $(INSTALL_DATA) $(GEN_HRL_FILES) "$(RELSYSDIR)/include" - -release_docs_spec: diff --git a/lib/cosFileTransfer/src/cosFileTransfer.app.src b/lib/cosFileTransfer/src/cosFileTransfer.app.src deleted file mode 100644 index 033eec9700..0000000000 --- a/lib/cosFileTransfer/src/cosFileTransfer.app.src +++ /dev/null @@ -1,43 +0,0 @@ -{application, cosFileTransfer, - [{description, "The Erlang CosFileTransfer application"}, - {vsn, "%VSN%"}, - {modules, - [ - 'cosFileTransferApp', - 'CosFileTransfer_Directory_impl', - 'CosFileTransfer_File_impl', - 'CosFileTransfer_VirtualFileSystem_impl', - 'CosFileTransfer_FileTransferSession_impl', - 'CosFileTransfer_FileIterator_impl', - 'cosFileTransferNATIVE_file', - 'oe_CosFileTransfer', - 'CosFileTransfer', - 'CosFileTransfer_AccessLevel', - 'CosFileTransfer_CommandNotImplementedException', - 'CosFileTransfer_Directory', - 'CosFileTransfer_File', - 'CosFileTransfer_FileIterator', - 'CosFileTransfer_FileList', - 'CosFileTransfer_FileNameList', - 'CosFileTransfer_FileNotFoundException', - 'CosFileTransfer_FileTransferSession', - 'CosFileTransfer_FileWrapper', - 'CosFileTransfer_IllegalOperationException', - 'CosFileTransfer_ProtocolAddressList', - 'CosFileTransfer_ProtocolSupport', - 'CosFileTransfer_RequestFailureException', - 'CosFileTransfer_SessionException', - 'CosFileTransfer_SupportedProtocolAddresses', - 'CosFileTransfer_TransferException', - 'CosFileTransfer_VirtualFileSystem', - 'CosFileTransfer_VirtualFileSystem_ContentList' - ] - }, - {registered, []}, - {applications, [orber, stdlib, kernel]}, - {env, []}, - {mod, {cosFileTransferApp, []}}, - {runtime_dependencies, ["stdlib-2.0","ssl-5.3.4","orber-3.6.27","kernel-3.0", - "inets-5.10","erts-7.0","cosProperty-1.1.17"]} -]}. - diff --git a/lib/cosFileTransfer/src/cosFileTransfer.appup.src b/lib/cosFileTransfer/src/cosFileTransfer.appup.src deleted file mode 100644 index 6c3b2833b7..0000000000 --- a/lib/cosFileTransfer/src/cosFileTransfer.appup.src +++ /dev/null @@ -1,7 +0,0 @@ -{"%VSN%", - [ - ], - [ - ] -}. - diff --git a/lib/cosFileTransfer/src/cosFileTransferApp.erl b/lib/cosFileTransfer/src/cosFileTransferApp.erl deleted file mode 100644 index 29a7237d70..0000000000 --- a/lib/cosFileTransfer/src/cosFileTransferApp.erl +++ /dev/null @@ -1,471 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2015. All Rights Reserved. -%% -%% 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. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosFileTransferApp.erl -%% Purpose : -%% Created : 25 Aug 2000 -%%---------------------------------------------------------------------- --module(cosFileTransferApp). - - -%%--------------- INCLUDES ----------------------------------- --include("cosFileTransferApp.hrl"). - -%%--------------- EXPORTS------------------------------------- -%% cosFileTransferApp API external --export([start/0, stop/0, install/0, uninstall/0, create_VFS/4, create_VFS/5, - get_buffert_size/0]). - -%% cosFileTransferApp API internal --export([create_link/3, get_option/3, type_check/2, configure/2]). - -%% Application callbacks --export([start/2, init/1, stop/1]). - -%% INTERNAL EXPORTS!! DO NOT USE THESE!! --export([create_dir/2, create_dir/3, create_file/2, create_file/3, split_paths/1, - create_name/1]). - --export([ssl_server_certfile/0, ssl_client_certfile/0, ssl_port/0, - ssl_server_verify/0, - ssl_client_verify/0, - ssl_server_depth/0, ssl_client_depth/0, - ssl_server_cacertfile/0, - ssl_client_cacertfile/0]). - - -%%--------------- DEFINES ------------------------------------ --define(SUPERVISOR_NAME, oe_cosFileTransferSup). --define(SUP_FLAG, {simple_one_for_one,50,10}). --define(SUP_DIRECTORY_SPEC(Name, Args), - ['CosFileTransfer_Directory',Args, - [{sup_child, true}, {regname, {global, Name}}]]). --define(SUP_CHILD, - {"oe_FileTransferChild", - {cosFileTransfer,create_link, []}, - transient,100000,worker, - []}). - -%%------------------------------------------------------------ -%% function : install -%% Arguments: - -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Install necessary data in the IFR DB -%%------------------------------------------------------------ -install() -> - oe_CosFileTransfer:oe_register(). - -%%------------------------------------------------------------ -%% function : uninstall -%% Arguments: - -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Remove data related to cosFileTransfer from the IFR DB -%%------------------------------------------------------------ -uninstall() -> - oe_CosFileTransfer:oe_unregister(). - - -%%------------------------------------------------------------ -%% function : start/stop -%% Arguments: -%% Returns : -%% Effect : Starts or stops the cosFileTransfer application. -%%------------------------------------------------------------ -start() -> - application:start(cosFileTransfer). -stop() -> - application:stop(cosFileTransfer). - -%%------------------------------------------------------------ -%% function : start -%% Arguments: Type - see module application -%% Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ -start(_, _) -> - supervisor:start_link({local, ?SUPERVISOR_NAME}, cosFileTransferApp, app_init). - - -%%------------------------------------------------------------ -%% function : stop -%% Arguments: Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ -stop(_) -> - ok. - -%%-----------------------------------------------------------% -%% function : init -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -%% Starting using create_factory/X -init(own_init) -> - {ok,{?SUP_FLAG, [?SUP_CHILD]}}; -%% When starting as an application. -init(app_init) -> - {ok,{?SUP_FLAG, [?SUP_CHILD]}}. - -%%------------------------------------------------------------ -%% function : create_VFS -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -create_VFS(Type, Content, Host, Port) -> - create_VFS(Type, Content, Host, Port, []). - -create_VFS('FTP', Content, Host, Port, Options) - when is_list(Host) andalso is_integer(Port) andalso is_list(Options) -> - 'CosFileTransfer_VirtualFileSystem':oe_create(['FTP', Content, Host, Port, - Options], - [{pseudo, true}]); -create_VFS({'NATIVE', Mod}, Content, Host, Port, Options) - when is_list(Host) andalso is_integer(Port) andalso is_list(Options) -> - 'CosFileTransfer_VirtualFileSystem':oe_create([{'NATIVE', Mod}, Content, - Host, Port, Options], - [{pseudo, true}]); -create_VFS(_, _, _, _, _) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%-----------------------------------------------------------% -%% function : create_link -%% Arguments: Module - which Module to call -%% Env/ArgList - ordinary oe_create arguments. -%% Returns : -%% Exception: -%% Effect : Necessary since we want the supervisor to be a -%% 'simple_one_for_one'. Otherwise, using for example, -%% 'one_for_one', we have to call supervisor:delete_child -%% to remove the childs startspecification from the -%% supervisors internal state. -%%------------------------------------------------------------ -create_link(Module, Env, ArgList) -> - Module:oe_create_link(Env, ArgList). - -%%-----------------------------------------------------------% -%% function : get_option -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -get_option(Key, OptionList, DefaultList) -> - case lists:keysearch(Key, 1, OptionList) of - {value,{Key,Value}} -> - Value; - _ -> - case lists:keysearch(Key, 1, DefaultList) of - {value,{Key,Value}} -> - Value; - _-> - {error, "Invalid option"} - end - end. - -%%-----------------------------------------------------------% -%% function : type_check -%% Arguments: Obj - objectrefernce to test. -%% Mod - Module which contains typeID/0. -%% Returns : 'ok' or raises exception. -%% Effect : -%%------------------------------------------------------------ -type_check(Obj, Mod) -> - case catch corba_object:is_a(Obj,Mod:typeID()) of - true -> - ok; - _ -> - corba:raise(#'BAD_PARAM'{minor=700, completion_status=?COMPLETED_NO}) - end. - - -%%-----------------------------------------------------------% -%% function : create_name/1 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -create_name(Type) -> - Time = erlang:system_time(), - Unique = erlang:unique_integer([positive]), - lists:concat(['oe_',node(),'_',Type,'_',Time,'_',Unique]). - - -%%-----------------------------------------------------------% -%% function : get_buffert_size/0 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : Lookup the configuration variable 'buffert_size' -%%------------------------------------------------------------ -get_buffert_size() -> - case application:get_env(cosFileTransfer, buffert_size) of - {ok, Size} when is_integer(Size) -> - Size; - _ -> - ?DEFAULT_BUFSIZE - end. - -%%-----------------------------------------------------------% -%% function : configure/1 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -configure(buffert_size, Value) when is_integer(Value) -> - do_configure(buffert_size, Value); -configure(ssl_port, Value) when is_integer(Value) -> - do_safe_configure(ssl_port, Value); -configure(ssl_server_certfile, Value) when is_list(Value) -> - do_safe_configure(ssl_server_certfile, Value); -configure(ssl_server_certfile, Value) when is_atom(Value) -> - do_safe_configure(ssl_server_certfile, atom_to_list(Value)); -configure(ssl_client_certfile, Value) when is_list(Value) -> - do_safe_configure(ssl_client_certfile, Value); -configure(ssl_client_certfile, Value) when is_atom(Value) -> - do_safe_configure(ssl_client_certfile, atom_to_list(Value)); -configure(ssl_server_verify, Value) when is_integer(Value) -> - do_safe_configure(ssl_server_verify, Value); -configure(ssl_client_verify, Value) when is_integer(Value) -> - do_safe_configure(ssl_client_verify, Value); -configure(ssl_server_depth, Value) when is_integer(Value) -> - do_safe_configure(ssl_server_depth, Value); -configure(ssl_client_depth, Value) when is_integer(Value) -> - do_safe_configure(ssl_client_depth, Value); -configure(ssl_server_cacertfile, Value) when is_list(Value) -> - do_safe_configure(ssl_server_cacertfile, Value); -configure(ssl_server_cacertfile, Value) when is_atom(Value) -> - do_safe_configure(ssl_server_cacertfile, atom_to_list(Value)); -configure(ssl_client_cacertfile, Value) when is_list(Value) -> - do_safe_configure(ssl_client_cacertfile, Value); -configure(ssl_client_cacertfile, Value) when is_atom(Value) -> - do_safe_configure(ssl_client_cacertfile, atom_to_list(Value)); -configure(_, _) -> - exit({error, "Bad configure parameter(s)"}). - -%% This function may be used as long as it is safe to change a value at any time. -do_configure(Key, Value) -> - case is_loaded() of - false -> - application:load(cosFileTransfer), - application_controller:set_env(cosFileTransfer, Key, Value); - true -> - application_controller:set_env(cosFileTransfer, Key, Value) - end. - - -%% This function MUST(!!) be used when we cannot change a value if cosFileTransfer -%% is running. -do_safe_configure(Key, Value) -> - case is_loaded() of - false -> - application:load(cosFileTransfer), - application_controller:set_env(cosFileTransfer, Key, Value); - true -> - case is_running() of - false -> - application_controller:set_env(cosFileTransfer, Key, Value); - true -> - exit("cosFileTransfer already running, the given key may not be updated!") - end - end. - -%%-----------------------------------------------------------% -%% function : SSL parameter access functions -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -ssl_port() -> - case application:get_env(cosFileTransfer, ssl_port) of - {ok, Port} when is_integer(Port) -> - Port; - _ -> - -1 - end. - -ssl_server_certfile() -> - case application:get_env(cosFileTransfer, ssl_server_certfile) of - {ok, V1} when is_list(V1) -> - V1; - {ok, V2} when is_atom(V2) -> - atom_to_list(V2); - _What -> - {ok, Cwd} = file:get_cwd(), - filename:join(Cwd,"ssl_server_cert.pem") - end. - - -ssl_client_certfile() -> - case application:get_env(cosFileTransfer, ssl_client_certfile) of - {ok, V1} when is_list(V1) -> - V1; - {ok, V2} when is_atom(V2) -> - atom_to_list(V2); - _ -> - {ok, Cwd} = file:get_cwd(), - filename:join(Cwd,"ssl_client_cert.pem") - end. - -ssl_server_verify() -> - Verify = case application:get_env(cosFileTransfer, ssl_server_verify) of - {ok, V} when is_integer(V) -> - V; - _ -> - 0 - end, - if - Verify =< 2, Verify >= 0 -> - Verify; - true -> - 0 - end. - -ssl_client_verify() -> - Verify = case application:get_env(cosFileTransfer, ssl_client_verify) of - {ok, V1} when is_integer(V1) -> - V1; - _ -> - 0 - end, - if - Verify =< 2, Verify >= 0 -> - Verify; - true -> - 0 - end. - -ssl_server_depth() -> - case application:get_env(cosFileTransfer, ssl_server_depth) of - {ok, V1} when is_integer(V1) -> - V1; - _ -> - 1 - end. - -ssl_client_depth() -> - case application:get_env(cosFileTransfer, ssl_client_depth) of - {ok, V1} when is_integer(V1) -> - V1; - _ -> - 1 - end. - - -ssl_server_cacertfile() -> - case application:get_env(cosFileTransfer, ssl_server_cacertfile) of - {ok, V1} when is_list(V1) -> - V1; - {ok, V2} when is_atom(V2) -> - atom_to_list(V2); - _ -> - [] - end. - -ssl_client_cacertfile() -> - case application:get_env(cosFileTransfer, ssl_client_cacertfile) of - {ok, V1} when is_list(V1) -> - V1; - {ok, V2} when is_atom(V2) -> - atom_to_list(V2); - _ -> - [] - end. - - -%%============================================================ -%% Internal functions -%%============================================================ -%%-----------------------------------------------------------% -%% function : is_loaded/0 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : Check if the application is loaded -%%------------------------------------------------------------ -is_loaded() -> - is_loaded(application:loaded_applications()). - -is_running() -> - is_loaded(application:which_applications()). - -is_loaded([]) -> - false; -is_loaded([{cosFileTransfer, _, _} |_As]) -> - true; -is_loaded([_ |As]) -> - is_loaded(As). - - - - -%%-----------------------------------------------------------% -%% function : create_dir/3/4 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -create_dir(Session, FileNameList) -> - create_dir(Session, FileNameList, corba:create_nil_objref()). -create_dir(Session, FileNameList, Parent) -> - 'CosFileTransfer_Directory':oe_create([lists:last(FileNameList), FileNameList, - Parent, Session], - [{pseudo, true}]). - -%%-----------------------------------------------------------% -%% function : create_file/2/3 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -create_file(Session, FileNameList) -> - create_file(Session, FileNameList, corba:create_nil_objref()). -create_file(Session, FileNameList, Parent) -> - 'CosFileTransfer_File':oe_create([lists:last(FileNameList), FileNameList, - Parent, Session], [{pseudo, true}]). - -%%-----------------------------------------------------------% -%% function : split_paths -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -split_paths(Listing) -> - split_paths(string:tokens(Listing, ?SEPARATOR), []). -split_paths([], Acc) -> - Acc; -split_paths([H|T], Acc) -> - split_paths(T, [filename:split(H)|Acc]). - - -%%--------------- END OF MODULE ------------------------------ - - diff --git a/lib/cosFileTransfer/src/cosFileTransferApp.hrl b/lib/cosFileTransfer/src/cosFileTransferApp.hrl deleted file mode 100644 index 037be7a4af..0000000000 --- a/lib/cosFileTransfer/src/cosFileTransferApp.hrl +++ /dev/null @@ -1,69 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% 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. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosFileTransferApp.hrl -%% Purpose : -%% Created : 10 Feb 2000 -%%---------------------------------------------------------------------- - - -%%--------------- INCLUDES ----------------------------------- -%% External --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). --include_lib("cosProperty/include/CosPropertyService.hrl"). - -%% Local --include_lib("cosFileTransfer/include/CosFileTransfer.hrl"). - --define(write_ErrorMsg(Txt, Arg), -error_logger:error_msg("============= CosFileTransfer =============~n" - Txt - "===========================================~n", - Arg)). - --define(FTP_PORT_INT, 21). --define(FTP_PORT_STR, "21"). --define(TCP_ID, "TCP"). --define(FTP_ID, "FTP"). --define(FTAM_ID, "FTAM"). --define(NATIVE_ID, "NATIVE"). --define(SUPPURTED_PROTOCOLS, ["TCP/IP", "SSL"]). - --define(DEFAULT_CONFIG, [{protocol, tcp}, {connect_timeout, 60}]). - --define(SEPARATOR, "\r\n"). - --define(DEFAULT_BUFSIZE, 64000). - --define(DEBUG_LEVEL, 3). - --ifdef(debug). --define(debug_print(F,A), - io:format("[LINE: ~p MODULE: ~p] "++F,[?LINE, ?MODULE]++A)). --define(ft_TypeCheck(O,M), 'cosFileTransferApp':type_check(O,M)). --else. --define(debug_print(F,A), ok). --define(ft_TypeCheck(O,I), ok). --endif. - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosFileTransfer/src/cosFileTransferNATIVE_file.erl b/lib/cosFileTransfer/src/cosFileTransferNATIVE_file.erl deleted file mode 100644 index 2969e61a2b..0000000000 --- a/lib/cosFileTransfer/src/cosFileTransferNATIVE_file.erl +++ /dev/null @@ -1,359 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% 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. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosFileTransferNATIVE_file.erl -%% Description : -%% -%% Created : 9 Nov 2000 -%%---------------------------------------------------------------------- --module('cosFileTransferNATIVE_file'). - - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include("cosFileTransferApp.hrl"). --include_lib("kernel/include/file.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([open/1, - open/2, - open/3, - user/3, - pwd/1, - cd/2, - mkdir/2, - rmdir/2, - nlist/1, - nlist/2, - delete/2, - recv/2, - recv/3, - send/2, - send/3, - close/1, - insert/4]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% function : open -%% Arguments: -%% Returns : {ok, Ref} | {error, ehost} for future use -%% Effect : -%%---------------------------------------------------------------------- -open(_Host) -> - {ok, 'NATIVE'}. -open(_Host, _Port) -> - {ok, 'NATIVE'}. -open(_Host, _Port, _Flags) -> - {ok, 'NATIVE'}. - -%%---------------------------------------------------------------------- -%% function : user -%% Arguments: Ref - what's returned by open/1/2 -%% User = Password = string() -%% Returns : ok | {error, euser | econn} for future use -%% Effect : -%%---------------------------------------------------------------------- -user(_Ref, _User, _Password) -> - ok. - -%%---------------------------------------------------------------------- -%% function : pwd -%% Arguments: Ref - what's returned by open/1/2 -%% Returns : {ok, string()} | {error, elogin | econn} -%% Effect : -%%---------------------------------------------------------------------- -pwd(_Ref) -> - case file:get_cwd() of - {ok, Cwd} -> - {ok, Cwd}; - _ -> - {error, econn} - end. - -%%---------------------------------------------------------------------- -%% function : cd -%% Arguments: Ref - what's returned by open/1/2 -%% Dir - string() -%% Returns : ok | {error, epath | elogin | econn} -%% Effect : -%%---------------------------------------------------------------------- -cd(_Ref, Dir) -> - case file:set_cwd(Dir) of - ok -> - ok; - {error, _} -> - {error, epath} - end. - -%%---------------------------------------------------------------------- -%% function : mkdir -%% Arguments: Ref - what's returned by open/1/2 -%% Dir - string() -%% Returns : ok | {error, epath} -%% Effect : -%%---------------------------------------------------------------------- -mkdir(_Ref, Dir) -> - case file:make_dir(Dir) of - ok -> - ok; - {error, _Reason} -> - {error, epath} - end. - -%%---------------------------------------------------------------------- -%% function : rmdir -%% Arguments: Ref - what's returned by open/1/2 -%% Dir - string() -%% Returns : ok | {error, epath} -%% Effect : -%%---------------------------------------------------------------------- -rmdir(_Ref, Dir) -> - case file:del_dir(Dir) of - ok -> - ok; - {error, _Reason} -> - {error, epath} - end. - -%%---------------------------------------------------------------------- -%% function : nlist -%% Arguments: Ref - what's returned by open/1/2 -%% Dir - string() -%% Returns : {ok, Listing} | {error, epath | elogin | econn} -%% Effect : -%%---------------------------------------------------------------------- -nlist(_Ref) -> - case file:get_cwd() of - {ok, Cwd} -> - %% Here we can assume that it's a Directory is tested. - convert_to_nlist(file:list_dir(Cwd)); - _ -> - {error, epath} - end. -nlist(_Ref, Dir) -> - case file:list_dir(Dir) of - {error, _} -> - %% Might be a File - case file:read_file_info(Dir) of - {ok, _} -> - convert_to_nlist_helper([Dir], []); - _ -> - {error, epath} - end; - {ok, Content} -> - convert_to_nlist_helper(Content, []) - end. - -convert_to_nlist({error, _}) -> - {error, epath}; -convert_to_nlist({ok, Content}) -> - convert_to_nlist_helper(Content, []). - -convert_to_nlist_helper([], Acc) -> - {ok, lists:concat(Acc)}; -convert_to_nlist_helper([H|T], Acc) -> - convert_to_nlist_helper(T, [H, "\r\n"|Acc]). - -%%---------------------------------------------------------------------- -%% function : delete -%% Arguments: Ref - what's returned by open/1/2 -%% File - string() -%% Returns : ok | {error, epath} -%% Effect : -%%---------------------------------------------------------------------- -delete(_Ref, File) -> - case file:delete(File) of - ok -> - ok; - {error, _Reason} -> - {error, epath} - end. - -%%---------------------------------------------------------------------- -%% function : recv -%% Arguments: Ref - what's returned by open/1/2 -%% Returns : ok | {error, epath | elogin | econn} -%% Effect : -%%---------------------------------------------------------------------- -recv(_Ref, _Remote) -> - ok. -recv(_Ref, Remote, Local) -> - copy_file(Remote, Local). - -%%---------------------------------------------------------------------- -%% function : send -%% Arguments: Ref - what's returned by open/1/2 -%% Returns : ok | {error, epath | elogin | econn | etnospc | epnospc | efnamena} -%% Effect : -%%---------------------------------------------------------------------- -send(_Ref, _Local) -> - ok. -send(_Ref, Local, Remote) -> - copy_file(Local, Remote). - -%%---------------------------------------------------------------------- -%% function : close -%% Arguments: Ref - what's returned by open/1/2 -%% Returns : ok -%% Effect : Currently none. -%%---------------------------------------------------------------------- -close(_) -> - ok. - - -%%---------------------------------------------------------------------- -%% function : insert -%% Arguments: Ref - what's returned by open/1/2 -%% Local - absolute file name -%% Remote - absolute file name -%% Offset - long() -%% Returns : ok -%% Effect : -%%---------------------------------------------------------------------- -insert(_Ref, Source, Target, Offset) -> - case file:open(Source, [raw, binary, read]) of - {ok, SourceDev} -> - case file:open(Target, [raw, binary, read, write]) of - {ok, TargetDev} -> - {ok, #file_info{size=SSize}} = - file:read_file_info(Source), - {ok, #file_info{size=TSize}} = - file:read_file_info(Target), - insert_file_helper(SourceDev, TargetDev, SSize, TSize, Offset); - Reason -> - file:close(SourceDev), - convert_error(Reason) - end; - Reason -> - convert_error(Reason) - end. - - -insert_file_helper(SourceDev, TargetDev, SSize, TSize, Offset) -> - BuffSize = cosFileTransferApp:get_buffert_size(), - move_data(TargetDev, TSize, SSize+TSize, TSize-Offset, BuffSize), - insert_data(SourceDev, TargetDev, 0, Offset, BuffSize), - file:close(SourceDev), - file:close(TargetDev). -move_data(_F, _RLocation, _WLocation, Counter, _BuffSize) when Counter == 0 -> - ok; -move_data(F, RLocation, WLocation, Counter, BuffSize) when Counter =< BuffSize -> - case file:pread(F, RLocation-Counter, Counter) of - {ok, Bin} -> - file:pwrite(F, WLocation-Counter, Bin); - eof -> - ok - end; -move_data(F, RLocation, WLocation, Counter, BuffSize) -> - NewRLC = RLocation-BuffSize, - NewWLC = WLocation-BuffSize, - case file:pread(F, NewRLC, BuffSize) of - {ok, Bin} -> - file:pwrite(F, NewWLC, Bin), - move_data(F, NewRLC, NewWLC, Counter-BuffSize, BuffSize); - eof -> - ok - end. - -insert_data(FSRC, FTGT, RLocation, WLocation, BuffSize) -> - case file:pread(FSRC, RLocation, BuffSize) of - {ok, Bin} -> - file:pwrite(FTGT, WLocation, Bin), - insert_data(FSRC, FTGT, RLocation+BuffSize, WLocation+BuffSize, BuffSize); - eof -> - ok - end. - - -%%====================================================================== -%% Internal functions -%%====================================================================== -copy_file(Source, Target) -> - case file:open(Source, [raw, binary, read]) of - {ok, SourceDev} -> - case file:open(Target, [raw, binary, append]) of - {ok, TargetDev} -> - BuffSize = cosFileTransferApp:get_buffert_size(), - copy_file_helper(SourceDev, TargetDev, BuffSize); - Reason -> - file:close(SourceDev), - convert_error(Reason) - end; - Reason -> - convert_error(Reason) - end. - -copy_file_helper(SourceDev, TargetDev, BuffSize) -> - case file:read(SourceDev, BuffSize) of - eof -> - file:close(SourceDev), - file:close(TargetDev); - {ok, Bin} -> - case file:write(TargetDev, Bin) of - ok -> - copy_file_helper(SourceDev, TargetDev, BuffSize); - Reason -> - file:close(SourceDev), - file:close(TargetDev), - convert_error(Reason) - end; - {error, Reason} -> - file:close(SourceDev), - file:close(TargetDev), - convert_error(Reason) - end. - -convert_error({error, eacces}) -> - {error, elogin}; -convert_error({error, enoent}) -> - {error, epath}; -convert_error({error, enotdir}) -> - {error, epath}; -convert_error({error, eidir}) -> - {error, epath}; -convert_error({error, enospc}) -> - {error, etnospc}; -convert_error(_) -> - {error, epath}. - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosFileTransfer/test/Makefile b/lib/cosFileTransfer/test/Makefile deleted file mode 100644 index 45c67a95dd..0000000000 --- a/lib/cosFileTransfer/test/Makefile +++ /dev/null @@ -1,132 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2016. All Rights Reserved. -# -# 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. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSFILETRANSFER_VSN) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/cosFileTransfer_test - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -TEST_SPEC_FILE = cosFileTransfer.spec -COVER_FILE = cosFileTransfer.cover - - -IDL_FILES = - -IDLOUTDIR = idl_output - -MODULES = \ - fileTransfer_SUITE \ - -GEN_MODULES = \ - -GEN_HRL_FILES = \ - -ERL_FILES = $(MODULES:%=%.erl) - -HRL_FILES = - -GEN_FILES = \ - $(GEN_HRL_FILES:%=$(IDLOUTDIR)/%) \ - $(GEN_MODULES:%=$(IDLOUTDIR)/%.erl) - -GEN_TARGET_FILES = $(GEN_MODULES:%=$(IDLOUTDIR)/%.$(EMULATOR)) - -SUITE_TARGET_FILES = $(MODULES:%=%.$(EMULATOR)) - -TARGET_FILES = \ - $(GEN_TARGET_FILES) \ - $(SUITE_TARGET_FILES) - - -# ---------------------------------------------------- -# PROGRAMS -# ---------------------------------------------------- -LOCAL_CLASSPATH = $(ERL_TOP)lib/cosFileTransfer/priv:$(ERL_TOP)lib/cosFileTransfer/test -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosFileTransfer/ebin \ - -pa $(ERL_TOP)/lib/cosFileTransfer/src \ - -pa $(ERL_TOP)/lib/cosFileTransfer/include \ - -pa $(ERL_TOP)/lib/cosProperty/ebin \ - -pa $(ERL_TOP)/lib/cosProperty/include \ - -pa $(ERL_TOP)/lib/orber/ebin \ - -pa $(ERL_TOP)/lib/ic/ebin - -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber/include \ - -pa $(ERL_TOP)/lib/cosProperty/include \ - -pa $(ERL_TOP)/lib/cosFileTransfer/ebin \ - -pa $(ERL_TOP)/lib/cosFileTransfer/include \ - -pa $(ERL_TOP)/lib/cosFileTransfer/test/idl_output \ - -I$(ERL_TOP)/lib/orber/include \ - -I$(ERL_TOP)/lib/cosProperty/include \ - -I$(ERL_TOP)/lib/cosFileTransfer/src \ - -I$(ERL_TOP)/lib/cosFileTransfer/include \ - -I$(ERL_TOP)/lib/cosFileTransfer \ - -I$(ERL_TOP)/lib/cosFileTransfer/test/$(IDLOUTDIR) - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- - - -tests debug opt: $(TARGET_FILES) - -clean: - rm -f idl_output/* - rm -f $(TARGET_FILES) - rm -f errs core *~ - -docs: - -# ---------------------------------------------------- -# Special Targets -# ---------------------------------------------------- - -# ---------------------------------------------------- -# Release Targets -# ---------------------------------------------------- -# We don't copy generated intermediate erlang and hrl files - -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: - -release_docs_spec: - -release_tests_spec: tests - $(INSTALL_DIR) "$(RELSYSDIR)" - $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \ - $(COVER_FILE) $(ERL_FILES) "$(RELSYSDIR)" - $(INSTALL_DATA) $(SUITE_TARGET_FILES) "$(RELSYSDIR)" - chmod -R u+w "$(RELSYSDIR)" diff --git a/lib/cosFileTransfer/test/cosFileTransfer.cover b/lib/cosFileTransfer/test/cosFileTransfer.cover deleted file mode 100644 index 063dd66990..0000000000 --- a/lib/cosFileTransfer/test/cosFileTransfer.cover +++ /dev/null @@ -1,2 +0,0 @@ -{incl_app,cosFileTransfer,details}. - diff --git a/lib/cosFileTransfer/test/cosFileTransfer.spec b/lib/cosFileTransfer/test/cosFileTransfer.spec deleted file mode 100644 index 290b27d048..0000000000 --- a/lib/cosFileTransfer/test/cosFileTransfer.spec +++ /dev/null @@ -1 +0,0 @@ -{suites,"../cosFileTransfer_test", all}. diff --git a/lib/cosFileTransfer/test/fileTransfer_SUITE.erl b/lib/cosFileTransfer/test/fileTransfer_SUITE.erl deleted file mode 100644 index 12aef2913a..0000000000 --- a/lib/cosFileTransfer/test/fileTransfer_SUITE.erl +++ /dev/null @@ -1,938 +0,0 @@ -%%----------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% 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. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : fileTransfer_SUITE.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module(fileTransfer_SUITE). - -%%--------------- INCLUDES ----------------------------------- --include_lib("cosFileTransfer/src/cosFileTransferApp.hrl"). - --include_lib("common_test/include/ct.hrl"). - -%%--------------- DEFINES ------------------------------------ --define(default_timeout, test_server:minutes(20)). --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("------ CORRECT RESULT ------~n~p~n", - [AcTuAlReS]), - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - --define(matchnopr(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("------ CORRECT RESULT (~p) ------~n", [?LINE]), - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - - - - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0,suite/0,groups/0, - init_per_group/2,end_per_group/2, - cases/0, - init_per_suite/1, - end_per_suite/1, - fileIterator_api/1, - fts_ftp_file_api/1, - fts_ftp_file_ssl_api/1, - fts_ftp_dir_api/1, - fts_native_file_api/1, - fts_native_file_ssl_api/1, - fts_native_dir_api/1, - init_per_testcase/2, - end_per_testcase/2, - install_data/2, - uninstall_data/1, - slave_sup/0, - app_test/1]). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> - [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - - - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -cases() -> - [fts_ftp_dir_api, fts_ftp_file_api, - fts_ftp_file_ssl_api, fts_native_dir_api, - fts_native_file_api, fts_native_file_ssl_api, - fileIterator_api, app_test]. - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- - -init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -init_per_suite(Config) -> - case crypto_works() of - false -> - {skip,"Could not start crypto!"}; - true -> - orber:jump_start(), - cosProperty:install(), - cosProperty:start(), - Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]), - %% Client - cosFileTransferApp:configure(ssl_client_certfile, - filename:join([Dir, "client", "cert.pem"])), - cosFileTransferApp:configure(ssl_client_cacertfile, - filename:join([Dir, "client", "cacerts.pem"])), - cosFileTransferApp:configure(ssl_client_verify, 1), - cosFileTransferApp:configure(ssl_client_depth, 0), - %% Server - cosFileTransferApp:configure(ssl_server_certfile, - filename:join([Dir, "server", "cert.pem"])), - cosFileTransferApp:configure(ssl_server_cacertfile, - filename:join([Dir, "server", "cacerts.pem"])), - cosFileTransferApp:configure(ssl_server_verify, 1), - cosFileTransferApp:configure(ssl_server_depth, 0), - crypto:start(), - ssl:start(), - cosFileTransferApp:install(), - cosFileTransferApp:start(), - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") - end - end. - -crypto_works() -> - try crypto:start() of - {error,{already_started,crypto}} -> true; - ok -> true - catch - error:_ -> - false - end. - -end_per_suite(Config) -> - ssl:stop(), - crypto:stop(), - cosFileTransferApp:stop(), - cosProperty:stop(), - cosProperty:uninstall(), - cosFileTransferApp:uninstall(), - orber:jump_stop(), - Config. - -%%----------------------------------------------------------------- -%% Local definitions -%%----------------------------------------------------------------- --define(FTP_USER, "anonymous"). --define(FTP_PASS, "fileTransfer_SUITE@localhost"). --define(TEST_DIR,["/", "incoming"]). - --define(FTP_PORT, 21). --define(FTP_ACC, "anonymous"). - --define(BAD_HOST, "badhostname"). --define(BAD_USER, "baduser"). --define(BAD_DIR, "baddirectory"). - --define(TEST_FILE_DATA, "If this file exists after a completed test an error occurred."). --define(TEST_FILE_DATA2, "1234567890123"). - -%%----------------------------------------------------------------- -%% aoo-file test -%%----------------------------------------------------------------- -app_test(_Config) -> - ok=?t:app_test(cosFileTransfer), - ok. - -%%----------------------------------------------------------------- -%% FileIterator API tests -%%----------------------------------------------------------------- -fileIterator_api(Config) -> - case ftp_host(Config) of - {skipped, SkippedReason} -> - {skipped, SkippedReason}; - Host -> - - {ok, Node} = create_node("fileIterator_api", 4008, normal), - ?match(ok, remote_apply(Node, ?MODULE, install_data, - [tcp, {{'NATIVE', - 'cosFileTransferNATIVE_file'}, Host, - "fileIterator_api"}])), - - %% Create a Virtual File System. -%% VFS = ?match({_,_,_,_,_,_}, -%% cosFileTransferApp:create_VFS({'NATIVE', -%% 'cosFileTransferNATIVE_file'}, -%% [], Host, ?FTP_PORT)), - VFS = ?matchnopr({'IOP_IOR',"IDL:omg.org/CosFileTransfer/VirtualFileSystem:1.0",_}, - corba:string_to_object("corbaname::1.2@localhost:4008/NameService#fileIterator_api")), - - %% Start two File Transfer Sessions (Source and Target). - {FS, Dir} = ?matchnopr({{_,_,_},{_,_,_}}, - 'CosFileTransfer_VirtualFileSystem':login(VFS, - ?FTP_USER, - ?FTP_PASS, - ?FTP_ACC)), - - %% Do some basic test on one of the Directories attributes. - ?match([_H|_], 'CosFileTransfer_Directory':'_get_name'(Dir)), - ?match([_H|_], 'CosFileTransfer_Directory':'_get_complete_file_name'(Dir)), - ?match({'IOP_IOR',[],[]}, 'CosFileTransfer_Directory':'_get_parent'(Dir)), - ?matchnopr(FS, 'CosFileTransfer_Directory':'_get_associated_session'(Dir)), - {ok,[],FileIter} = ?match({ok,[],_}, 'CosFileTransfer_Directory':list(Dir, 0)), - %% Usually the working directory for the test is not empty so no need for - %% creating files of our own?! - #any{value=Children} = ?match({any, _, _}, - 'CosPropertyService_PropertySet': - get_property_value(Dir, "num_children")), - - if - Children > 5 -> - ?matchnopr({true, _}, 'CosFileTransfer_FileIterator':next_one(FileIter)), - ?matchnopr({true, _}, 'CosFileTransfer_FileIterator':next_n(FileIter, 3)), - ?matchnopr({true, _}, 'CosFileTransfer_FileIterator':next_n(FileIter, - Children)), - ?matchnopr({false, _}, 'CosFileTransfer_FileIterator':next_one(FileIter)), - ?match({false, []}, 'CosFileTransfer_FileIterator':next_n(FileIter, 1)), - ok; - true -> - ok - end, - ?match(ok, 'CosFileTransfer_FileIterator':destroy(FileIter)), - ?match(false, corba_object:non_existent(FS)), - ?match(ok, 'CosFileTransfer_FileTransferSession':logout(FS)), - %% To make sure Orber can remove it from mnesia. - timer:sleep(1000), - ?match(true, corba_object:non_existent(FS)), - ?match(ok, remote_apply(Node, ?MODULE, uninstall_data, ["fileIterator_api"])), - stop_orber_remote(Node, normal), - ok - end. - - -%%----------------------------------------------------------------- -%% FileTransferSession API tests -%%----------------------------------------------------------------- -fts_ftp_file_api(Config) -> - {ok, Node} = create_node("ftp_file_api", 4004, normal), - file_helper(Config, 'FTP', ?TEST_DIR, Node, 4004, "ftp_file_api", tcp). - -fts_ftp_file_ssl_api(Config) -> - {ok, Node} = create_node("ftp_file_api_ssl", {4005, 1}, ssl), - file_helper(Config, 'FTP', ?TEST_DIR, Node, 4005, "ftp_file_api_ssl", ssl). - -fts_native_file_api(Config) -> - {ok, Node} = create_node("native_file_api", 4006, normal), - {ok, Pwd} = file:get_cwd(), - file_helper(Config,{'NATIVE', 'cosFileTransferNATIVE_file'},filename:split(Pwd), - Node, 4006, "native_file_api", tcp). - -fts_native_file_ssl_api(Config) -> - {ok, Node} = create_node("native_file_ssl_api", {4007, 1}, ssl), - {ok, Pwd} = file:get_cwd(), - file_helper(Config,{'NATIVE', 'cosFileTransferNATIVE_file'},filename:split(Pwd), - Node, 4007, "native_file_ssl_api", ssl). - - -file_helper(Config, WhichType, TEST_DIR, Node, Port, Name, Type) -> - case ftp_host(Config) of - {skipped, SkippedReason} -> - {skipped, SkippedReason}; - Host -> - TEST_SOURCE = TEST_DIR ++ [create_name(remove_me_source)], - TEST_SOURCE2 = TEST_DIR ++ [create_name(remove_me_source)], - TEST_TARGET = TEST_DIR ++ [create_name(remove_me_target)], - - io:format("<<<<<< CosFileTransfer Testing Configuration >>>>>>~n",[]), - io:format("Source: ~p~nTarget: ~p~n", [TEST_SOURCE, TEST_TARGET]), - - ?match(ok, remote_apply(Node, ?MODULE, install_data, - [Type, {WhichType, Host, Name}])), - - VFST = ?match({'IOP_IOR',"IDL:omg.org/CosFileTransfer/VirtualFileSystem:1.0",_}, - corba:string_to_object("corbaname::1.2@localhost:"++integer_to_list(Port)++"/NameService#"++Name)), - - - %% Create a Virtual File System. - VFS = ?match({_,_,_,_,_,_}, - cosFileTransferApp:create_VFS(WhichType, [], Host, ?FTP_PORT, - [{protocol, Type}])), - %% Start two File Transfer Sessions (Source and Target). - {FST, _DirT} = ?match({{_,_,_},{_,_,_}}, - 'CosFileTransfer_VirtualFileSystem':login(VFST, - ?FTP_USER, - ?FTP_PASS, - ?FTP_ACC)), - {FSS, DirS} = ?match({{_,_,_,_,_,_},{_,_,_,_,_,_}}, - 'CosFileTransfer_VirtualFileSystem':login(VFS, - ?FTP_USER, - ?FTP_PASS, - ?FTP_ACC)), - - %% Do some basic test on one of the Directories attributes. - ?match([_H|_], 'CosFileTransfer_Directory':'_get_name'(DirS)), - ?match([_H|_], 'CosFileTransfer_Directory':'_get_complete_file_name'(DirS)), - ?match({'IOP_IOR',[],[]}, 'CosFileTransfer_Directory':'_get_parent'(DirS)), - ?match(FSS, 'CosFileTransfer_Directory':'_get_associated_session'(DirS)), - - %% Get a FileList before we create any new Files - #'CosFileTransfer_FileWrapper'{the_file = Dir} = - ?match({'CosFileTransfer_FileWrapper', _, ndirectory}, - 'CosFileTransfer_FileTransferSession':get_file(FSS, TEST_DIR)), - {ok,FileList, Iter1} = ?match({ok,_,_}, 'CosFileTransfer_Directory':list(Dir, 10)), - loop_files(FileList), - - case Iter1 of - {'IOP_IOR',[],[]} -> - ok; - _-> - ?match(ok, 'CosFileTransfer_FileIterator':destroy(Iter1)) - end, - - #any{value=Count1} = ?match({any, _, _}, 'CosPropertyService_PropertySet': - get_property_value(Dir, "num_children")), - - %% Now we want to transfer a file from source to target. First, we'll create - %% a a file to work with. - create_file_on_source_node(WhichType, Config, Host, - filename:join(TEST_SOURCE), TEST_DIR, - ?TEST_FILE_DATA), - create_file_on_source_node(WhichType, Config, Host, - filename:join(TEST_SOURCE2), TEST_DIR, - ?TEST_FILE_DATA2), - - #'CosFileTransfer_FileWrapper'{the_file = FileS} = - ?matchnopr({'CosFileTransfer_FileWrapper', _, nfile}, - 'CosFileTransfer_FileTransferSession':get_file(FSS, TEST_SOURCE)), - #'CosFileTransfer_FileWrapper'{the_file = FileS2} = - ?matchnopr({'CosFileTransfer_FileWrapper', _, nfile}, - 'CosFileTransfer_FileTransferSession':get_file(FSS, TEST_SOURCE2)), - - #any{value=Count2} = ?match({any, _, _}, 'CosPropertyService_PropertySet': - get_property_value(Dir, "num_children")), - timer:sleep(2000), - ?match(true, (Count1+2 == Count2)), - - %% Create a target File - FileT = ?matchnopr({_,_,_}, - 'CosFileTransfer_FileTransferSession':create_file(FST, TEST_TARGET)), - %% Try to delete the non-existing file. - ?match({'EXCEPTION', _}, - 'CosFileTransfer_FileTransferSession':delete(FST, FileT)), - - ?match(ok, 'CosFileTransfer_FileTransferSession':transfer(FSS, FileS, FileT)), - - %% Remove this test when ftp supports append. - case WhichType of - {'NATIVE', 'cosFileTransferNATIVE_file'} -> - ?match(ok, 'CosFileTransfer_FileTransferSession':append(FSS, FileS, FileT)), - ?match(ok, 'CosFileTransfer_FileTransferSession':insert(FSS, FileS2, FileT, 7)); - _-> - ok - end, - - %% Delete source and target files - ?match(ok, 'CosFileTransfer_FileTransferSession':delete(FSS, FileS)), - ?match(ok, 'CosFileTransfer_FileTransferSession':delete(FSS, FileS2)), - ?match(ok, 'CosFileTransfer_FileTransferSession':delete(FST, FileT)), - - %% Should be back where we started. - timer:sleep(2000), - #any{value=Count3} = ?match({any, _, _}, 'CosPropertyService_PropertySet': - get_property_value(Dir, "num_children")), - ?match(true, (Count1 == Count3)), - - - ?match(false, corba_object:non_existent(FSS)), - ?match(false, corba_object:non_existent(FST)), - ?match(ok, 'CosFileTransfer_FileTransferSession':logout(FSS)), - ?match(ok, 'CosFileTransfer_FileTransferSession':logout(FST)), - %% To make sure Orber can remove it from mnesia. - timer:sleep(2000), - ?match(true, corba_object:non_existent(FSS)), - ?match(true, corba_object:non_existent(FST)), - ?match(ok, remote_apply(Node, ?MODULE, uninstall_data, [Name])), - stop_orber_remote(Node, normal), - ok - end. - -%%----------------------------------------------------------------- -%% FileTransferSession API tests -%%----------------------------------------------------------------- -fts_ftp_dir_api(Config) -> - {ok, Node} = create_node("ftp_dir_api", 4009, normal), - dir_helper(Config, 'FTP', ?TEST_DIR, Node, 4009, "ftp_dir_api"). - -fts_native_dir_api(Config) -> - {ok, Node} = create_node("native_dir_api", 4010, normal), - {ok, Pwd} = file:get_cwd(), - dir_helper(Config, {'NATIVE', 'cosFileTransferNATIVE_file'}, - filename:split(Pwd), Node, 4010, "native_dir_api"). - -dir_helper(Config, WhichType, TEST_DIR, Node, Port, Name) -> - case ftp_host(Config) of - {skipped, SkippedReason} -> - {skipped, SkippedReason}; - Host -> - TEST_DIR_LEVEL1 = TEST_DIR ++ [create_name(remove_me_dir1)], - TEST_DIR_LEVEL2 = TEST_DIR_LEVEL1 ++ [create_name(remove_me_dir2)], - - io:format("<<<<<< CosFileTransfer Testing Configuration >>>>>>~n",[]), - io:format("Top Dir: ~p~nLevel2 Dir: ~p~n", [TEST_DIR_LEVEL1, TEST_DIR_LEVEL2]), - - ?match(ok, remote_apply(Node, ?MODULE, install_data, - [tcp, {WhichType, Host, Name}])), - - VFS = ?matchnopr({'IOP_IOR',"IDL:omg.org/CosFileTransfer/VirtualFileSystem:1.0",_}, - corba:string_to_object("corbaname::1.2@localhost:"++integer_to_list(Port)++"/NameService#"++Name)), - - %% Start two File Transfer Sessions (Source and Target). - {FS, DirS} = ?matchnopr({{'IOP_IOR',_,_}, _}, - 'CosFileTransfer_VirtualFileSystem':login(VFS, - ?FTP_USER, - ?FTP_PASS, - ?FTP_ACC)), - - %% Do some basic test on one of the Directories attributes. - ?match([_H|_], 'CosFileTransfer_Directory':'_get_name'(DirS)), - ?match([_H|_], 'CosFileTransfer_Directory':'_get_complete_file_name'(DirS)), - ?match({'IOP_IOR',[],[]}, 'CosFileTransfer_Directory':'_get_parent'(DirS)), - ?matchnopr(FS, 'CosFileTransfer_Directory':'_get_associated_session'(DirS)), - - %% Create a Root Directory. Currently we only need to create one but - %% later on, when supporting other protocols than FTP it's not enough. - Dir1 = 'CosFileTransfer_FileTransferSession':create_directory(FS, - TEST_DIR_LEVEL1), - io:format("<<<<<< CosFileTransfer Testing Properties >>>>>>~n",[]), - ?match({ok, [tk_long, tk_boolean]}, - 'CosFileTransfer_Directory':get_allowed_property_types(Dir1)), - ?match({ok, [_,_]}, - 'CosFileTransfer_Directory':get_allowed_properties(Dir1)), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property_with_mode(Dir1, - "num_children", - #any{typecode=tk_long, value=0}, - fixed_readonly)), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property_with_mode(Dir1, - "wrong", - #any{typecode=tk_long, value=0}, - fixed_readonly)), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property_with_mode(Dir1, - "num_children", - #any{typecode=tk_short, value=0}, - fixed_readonly)), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property_with_mode(Dir1, - "num_children", - #any{typecode=tk_long, value=0}, - fixed_normal)), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_properties_with_modes(Dir1, - [#'CosPropertyService_PropertyDef' - {property_name = "num_children", - property_value = #any{typecode=tk_long, value=0}, - property_mode = fixed_readonly}])), - ?match(fixed_readonly, - 'CosFileTransfer_Directory':get_property_mode(Dir1, "num_children")), - ?match({true, - [#'CosPropertyService_PropertyMode'{property_name = "num_children", - property_mode = fixed_readonly}]}, - 'CosFileTransfer_Directory':get_property_modes(Dir1, ["num_children"])), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':set_property_mode(Dir1, "num_children", fixed_readonly)), - - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory': - set_property_modes(Dir1, - [#'CosPropertyService_PropertyMode' - {property_name = "num_children", - property_mode = fixed_readonly}])), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory': - set_property_modes(Dir1, - [#'CosPropertyService_PropertyMode' - {property_name = "wrong", - property_mode = fixed_readonly}])), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory': - set_property_modes(Dir1, - [#'CosPropertyService_PropertyMode' - {property_name = "num_children", - property_mode = fixed_normal}])), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property(Dir1, - "num_children", - #any{typecode=tk_long, value=0})), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property(Dir1, - "wrong", - #any{typecode=tk_long, value=0})), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property(Dir1, - "num_children", - #any{typecode=tk_short, value=0})), - - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property(Dir1, - "num_children", - #any{typecode=tk_long, value=0})), - - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory': - define_properties(Dir1, - [#'CosPropertyService_Property' - {property_name = "num_children", - property_value = #any{typecode=tk_long, - value=0}}])), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory': - define_properties(Dir1, - [#'CosPropertyService_Property' - {property_name = "wrong", - property_value = #any{typecode=tk_long, - value=0}}])), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory': - define_properties(Dir1, - [#'CosPropertyService_Property' - {property_name = "num_children", - property_value = #any{typecode=tk_short, - value=0}}])), - ?match(2, 'CosFileTransfer_Directory':get_number_of_properties(Dir1)), - - ?match({ok, ["num_children", "is_directory"], {'IOP_IOR',[],[]}}, - 'CosFileTransfer_Directory':get_all_property_names(Dir1, 2)), - ?match({ok, ["is_directory"], _}, - 'CosFileTransfer_Directory':get_all_property_names(Dir1, 1)), - - ?match(#any{}, - 'CosFileTransfer_Directory':get_property_value(Dir1, "num_children")), - ?match(#any{}, - 'CosFileTransfer_Directory':get_property_value(Dir1, "is_directory")), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':get_property_value(Dir1, "wrong")), - - ?match({true, - [#'CosPropertyService_Property'{property_name = "num_children"}]}, - 'CosFileTransfer_Directory':get_properties(Dir1, ["num_children"])), - ?match({false, - [#'CosPropertyService_Property'{property_name = "wrong"}]}, - 'CosFileTransfer_Directory':get_properties(Dir1, ["wrong"])), - - ?match({ok, [_],_}, - 'CosFileTransfer_Directory':get_all_properties(Dir1, 1)), - ?match({ok, [_,_], {'IOP_IOR',[],[]}}, - 'CosFileTransfer_Directory':get_all_properties(Dir1, 2)), - - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':delete_property(Dir1, "num_children")), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':delete_property(Dir1, "wrong")), - - - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':delete_properties(Dir1, ["num_children"])), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':delete_properties(Dir1, ["wrong"])), - ?match(false, 'CosFileTransfer_Directory':delete_all_properties(Dir1)), - ?match(true, - 'CosFileTransfer_Directory':is_property_defined(Dir1, "num_children")), - ?match(false, - 'CosFileTransfer_Directory':is_property_defined(Dir1, "wrong")), - - %% The Top Dir should be empty and ... - ?match({ok,[],_}, 'CosFileTransfer_Directory':list(Dir1, 1000)), - ?match( #any{value=0}, - 'CosPropertyService_PropertySet':get_property_value(Dir1, "num_children")), - %% Create a sub-directory. - Dir2 = 'CosFileTransfer_FileTransferSession':create_directory(FS, - TEST_DIR_LEVEL2), - ?match( #any{value=1}, - 'CosPropertyService_PropertySet':get_property_value(Dir1, "num_children")), - - ?match({ok, [_,_], {'IOP_IOR',[],[]}}, - 'CosFileTransfer_Directory':get_all_properties(Dir1, 2)), - {_,_,Iterator1} = ?match({ok, [_], _}, - 'CosFileTransfer_Directory':get_all_properties(Dir1, 1)), - ?match({false, [_]}, - 'CosPropertyService_PropertiesIterator':next_n(Iterator1,4)), - - {_,_,Iterator0} = ?match({ok, [], _}, - 'CosFileTransfer_Directory':get_all_properties(Dir1, 0)), - - ?match({false, [_, {'CosPropertyService_Property', - "num_children",{any,tk_long,1}}]}, - 'CosPropertyService_PropertiesIterator':next_n(Iterator0,4)), - - ?match({true, - [#'CosPropertyService_Property'{property_name = "num_children"}]}, - 'CosFileTransfer_Directory':get_properties(Dir1, ["num_children"])), - - %% The Top Directory is not emtpy any more and ... - {ok,[#'CosFileTransfer_FileWrapper'{the_file = DirRef}],_} = - ?matchnopr({ok,[{'CosFileTransfer_FileWrapper', _, ndirectory}],_}, - 'CosFileTransfer_Directory':list(Dir1, 1000)), - %% ... its name eq. to 'TEST_DIR_LEVEL2' - ?match(TEST_DIR_LEVEL2, - 'CosFileTransfer_Directory':'_get_complete_file_name'(DirRef)), - - #'CosFileTransfer_FileWrapper'{the_file = Dir3} = - ?matchnopr({'CosFileTransfer_FileWrapper', _, ndirectory}, - 'CosFileTransfer_FileTransferSession':get_file(FS, TEST_DIR_LEVEL1)), - - %% Must get the same result for the 'get_file' operation. - {ok,[#'CosFileTransfer_FileWrapper'{the_file = DirRef2}],_} = - ?matchnopr({ok,[{'CosFileTransfer_FileWrapper', _, ndirectory}],_}, - 'CosFileTransfer_Directory':list(Dir3,1000)), - ?match(TEST_DIR_LEVEL2, - 'CosFileTransfer_Directory':'_get_complete_file_name'(DirRef2)), - - %% Since the top directory isn't empty deleting it must fail. - ?match({'EXCEPTION', _}, - 'CosFileTransfer_FileTransferSession':delete(FS, Dir1)), - - %% Delete the sub-directory and ... - ?match(ok, 'CosFileTransfer_FileTransferSession':delete(FS, Dir2)), - %% ... see if the top directory realyy is empty. - ?match({ok,[],_}, 'CosFileTransfer_Directory':list(Dir1, 1000)), - - ?match(ok, 'CosFileTransfer_FileTransferSession':delete(FS, Dir1)), - %% Test if the top directory been removed as intended. - ?match({'EXCEPTION', {'CosFileTransfer_FileNotFoundException', _, _}}, - 'CosFileTransfer_FileTransferSession':get_file(FS, TEST_DIR_LEVEL1)), - - ?match(false, corba_object:non_existent(FS)), - ?match(ok, 'CosFileTransfer_FileTransferSession':logout(FS)), - %% To make sure Orber can remove it from mnesia. - timer:sleep(1000), - ?match(true, corba_object:non_existent(FS)), - ?match(ok, remote_apply(Node, ?MODULE, uninstall_data, [Name])), - stop_orber_remote(Node, normal), - ok - end. - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- -ftp_host(Config) -> - case ?config(ftp_remote_host, Config) of - undefined -> - {skipped, "The configuration parameter 'ftp_remote_host' not defined."}; - Host -> - Host - end. - -loop_files([]) -> - io:format("@@@ DONE @@@~n", []); -loop_files([#'CosFileTransfer_FileWrapper'{the_file = H}|T]) -> - FullName = 'CosFileTransfer_File':'_get_complete_file_name'(H), - Name = 'CosFileTransfer_File':'_get_name'(H), - io:format("FULL NAME: ~p SHORT NAME: ~p~n", [FullName, Name]), - loop_files(T). - - -create_file_on_source_node('FTP', _Config, Host, FileName, Path, Data) -> - io:format("<<<<<< CosFileTransfer Testing File >>>>>>~n",[]), - io:format("Host: ~p~nPath: ~p~nFile: ~p~n", [Host, Path, FileName]), - {ok, Pid} = ?match({ok, _}, inets:start(ftpc, [{host, Host}], stand_alone)), - ?match(ok, ftp:user(Pid, ?FTP_USER, ?FTP_PASS)), - ?match(ok, ftp:cd(Pid, Path)), - ?match(ok, ftp:send_bin(Pid, list_to_binary(Data), FileName)), - ?match(ok, inets:stop(ftpc, Pid)); -create_file_on_source_node({'NATIVE', _}, _Config, Host, FileName, Path, Data) -> - io:format("<<<<<< CosFileTransfer Testing File >>>>>>~n",[]), - io:format("Host: ~p~nPath: ~p~nFile: ~p~n", [Host, Path, FileName]), - ?match(ok, file:write_file(FileName, list_to_binary(Data))). - -create_name(Type) -> - Time = erlang:system_time(), - Unique = erlang:unique_integer([positive]), - lists:concat([Type, '_', Time, '_', Unique]). - - - - -%%------------------------------------------------------------ -%% function : create_node/4 -%% Arguments: Name - the name of the new node (atom()) -%% Port - which iiop_port (integer()) -%% Domain - which domain. -%% Type - if /4 used the types defines the extra arguments -%% to be used. -%% Returns : {ok, Node} | {error, _} -%% Effect : Starts a new slave-node with given (optinally) -%% extra arguments. If fails it retries 'Retries' times. -%%------------------------------------------------------------ -create_node(Name, Port, normal) -> - Args = basic_args(Name), - create_node(Name, Port, 10, normal, Args, []); -create_node(Name, {Port, _Depth}, ssl) -> - Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]), - Args = basic_args(Name), - {ok, Node} = create_node(list_to_atom(Name), Port, 10, ssl, Args, []), - %% Client - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_client_certfile, - filename:join([Dir, "client", "cert.pem"])]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_client_cacertfile, - filename:join([Dir, "client", "cacerts.pem"])]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_client_keyfile, - filename:join([Dir, "client", "key.pem"])]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_client_verify, 1]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_client_depth, 0]), - - %% Server - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_server_certfile, - filename:join([Dir, "server", "cert.pem"])]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_server_cacertfile, - filename:join([Dir, "server", "cacerts.pem"])]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_server_keyfile, - filename:join([Dir, "server", "key.pem"])]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_server_verify, 1]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_server_depth, 0]), - {ok, Node}. - -%create_node(Name, {Port, Depth}, ssl) -> -% TestLibs = filename:join(filename:dirname(code:which(?MODULE)), "ssl_data"), -% Args = basic_args(Name), -% SArgs = basic_ssl_args(TestLibs, Args), -% LArgs = level_based_ssl(Depth, TestLibs, SArgs), -% create_node(list_to_atom(Name), Port, 10, ssl, LArgs, [{sslpath, TestLibs}]). - -create_node(Name, Port, Retries, Type, Args, Options) -> - [_, Host] = ?match([_,_],string:tokens(atom_to_list(node()), [$@])), - case starter(Host, Name, Args) of - {ok, NewNode} -> - ?match(pong, net_adm:ping(NewNode)), - {ok, Cwd} = file:get_cwd(), - Path = code:get_path(), - ?match(ok, rpc:call(NewNode, file, set_cwd, [Cwd])), - true = rpc:call(NewNode, code, set_path, [Path]), - ?match(ok, start_orber_remote(NewNode, Type, Options, Port)), - spawn_link(NewNode, ?MODULE, slave_sup, []), - rpc:multicall([node() | nodes()], global, sync, []), - {ok, NewNode}; - {error, Reason} when Retries == 0-> - {error, Reason}; - {error, Reason} -> - io:format("Could not start slavenode ~p ~p retrying~n", - [{Host, Name, Args}, Reason]), - timer:sleep(500), - create_node(Name, Port, Retries - 1, Type, Args, Options) - end. - -starter(Host, Name, Args) -> - slave:start(Host, Name, Args). - -slave_sup() -> - process_flag(trap_exit, true), - receive - {'EXIT', _, _} -> - ignore - end. - - -%%------------------------------------------------------------ -%% function : destroy_node -%% Arguments: Node - which node to destroy. -%% Type - normal | ssl -%% Returns : -%% Effect : -%%------------------------------------------------------------ --ifdef(false). -destroy_node(Node, Type) -> - stopper(Node, Type). - -stopper(Node, Type) -> - catch stop_orber_remote(Node, Type), - slave:stop(Node). --endif. - -%%------------------------------------------------------------ -%% function : remote_apply -%% Arguments: N - Node, M - Module, -%% F - Function, A - Arguments (list) -%% Returns : -%% Effect : -%%------------------------------------------------------------ -remote_apply(N, M,F,A) -> - case rpc:call(N, M, F, A) of - {badrpc, Reason} -> - exit(Reason); - Other -> - Other - end. - -%%------------------------------------------------------------ -%% function : stop_orber_remote -%% Arguments: Node - which node to stop orber on. -%% Type - normal | ssl | light | ....... -%% Returns : ok -%% Effect : Stops orber on given node and, if specified, -%% other applications or programs. -%%------------------------------------------------------------ -stop_orber_remote(Node, ssl) -> - rpc:call(Node, ssl, stop, []), - rpc:call(Node, crypto, stop, []), - orb_rpc_blast(Node, ssl); -stop_orber_remote(Node, Type) -> - orb_rpc_blast(Node, Type). - -orb_rpc_blast(Node, _) -> - rpc:call(Node, cosFileTransferApp, stop, []), - rpc:call(Node, cosProperty, stop, []), - rpc:call(Node, cosFileTransferApp, uninstall, []), - rpc:call(Node, cosProperty, uninstall, []), - rpc:call(Node, orber, jump_stop, []). - -%%------------------------------------------------------------ -%% function : start_orber_remote -%% Arguments: Node - which node to start orber on. -%% Type - normal | ssl | light | ....... -%% Returns : ok -%% Effect : Starts orber on given node and, if specified, -%% other applications or programs. -%%------------------------------------------------------------ -start_orber_remote(Node, ssl, _Options, Port) -> - rpc:call(Node, ssl, start, []), - rpc:call(Node, crypto, start, []), - rpc:call(Node, ssl, seed, ["testing"]), - orb_rpc_setup(Node, ssl, Port); -start_orber_remote(Node, Type, _, Port) -> - orb_rpc_setup(Node, Type, Port). - -orb_rpc_setup(Node, _, Port) -> - rpc:call(Node, orber, jump_start, [Port]), - rpc:call(Node, cosProperty, install, []), - rpc:call(Node, cosProperty, start, []), - rpc:call(Node, cosFileTransferApp, install, []). - -%%--------------- MISC FUNCTIONS ----------------------------- -basic_args(_Name) -> - TestLibs = filename:dirname(code:which(?MODULE)), - " -orber orber_debug_level 10" ++ - " -pa " ++ - TestLibs ++ - " -pa " ++ - filename:join(TestLibs, "all_SUITE_data") ++ - " -pa " ++ - filename:dirname(code:which(cosFileTransferApp)). - --ifdef(false). -basic_ssl_args(TestLibs, Args) -> -% Args ++ -% " -cosFileTransfer ssl_client_certfile \\\"" ++ -% filename:join(TestLibs, "ssl_client_cert.pem") ++ -% "\\\" -cosFileTransfer ssl_server_certfile \\\""++ -% filename:join(TestLibs, "ssl_server_cert.pem")++"\\\"". - - io:format("<<<<<< SSL LIBS ~p >>>>>>~n",[TestLibs]), - NewArgs = Args ++ - " -cosFileTransfer ssl_client_certfile \\\"" ++ - filename:join(TestLibs, "ssl_client_cert.pem") ++ - "\\\" -cosFileTransfer ssl_server_certfile \\\""++ - filename:join(TestLibs, "ssl_server_cert.pem")++"\\\"", - io:format("<<<<<< SSL LIBS ARGS ~p >>>>>>~n",[NewArgs]), - NewArgs. - -level_based_ssl(1, _TestLibs, Args) -> - Args; -level_based_ssl(2, _TestLibs, Args) -> - Args.% ++ -% " -cosFileTransfer ssl_server_depth 2 " ++ -% " -cosFileTransfer ssl_client_depth 2 " ++ -% " -cosFileTransfer ssl_server_verify " ++ -% " -cosFileTransfer ssl_client_verify " ++ -% " -cosFileTransfer ssl_server_cacertfile " ++ -% " -cosFileTransfer ssl_client_cacertfile " ++ - --endif. - -install_data(Protocol, {WhichType, Host, Name}) -> - io:format("<<<<<< Starting ~p/~p VFS at ~p/~p>>>>>>~n", - [Protocol, WhichType, Host, Name]), - %% Create a Virtual File System. - VFS = ?match({_,_,_,_,_,_}, - cosFileTransferApp:create_VFS(WhichType, [], Host, ?FTP_PORT, - [{protocol, Protocol}])), - NS = corba:resolve_initial_references("NameService"), - NC1 = lname_component:set_id(lname_component:create(), Name), - N = lname:insert_component(lname:create(), 1, NC1), - 'CosNaming_NamingContext':rebind(NS, N, VFS). - -uninstall_data(Name) -> - VFS = ?match({_,_,_,_,_,_}, - corba:string_to_object("corbaname:rir:/NameService#"++Name)), - ?match(ok, corba:dispose(VFS)), - ok. - - - -%%------------------- EOF MODULE----------------------------------- diff --git a/lib/cosFileTransfer/vsn.mk b/lib/cosFileTransfer/vsn.mk deleted file mode 100644 index 561f11fbb2..0000000000 --- a/lib/cosFileTransfer/vsn.mk +++ /dev/null @@ -1 +0,0 @@ -COSFILETRANSFER_VSN = 1.2.2 |