001/* 002 * jPOS Project [http://jpos.org] 003 * Copyright (C) 2000-2026 jPOS Software SRL 004 * 005 * This program is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU Affero General Public License as 007 * published by the Free Software Foundation, either version 3 of the 008 * License, or (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU Affero General Public License for more details. 014 * 015 * You should have received a copy of the GNU Affero General Public License 016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 017 */ 018 019package org.jpos.iso; 020 021import java.io.IOException; 022 023/** 024 * allows the transmision and reception of ISO 8583 Messages 025 * 026 * @author <a href="mailto:apr@cs.com.uy">Alejandro P. Revilla</a> 027 * @author <a href="mailto:alwynschoeman@yahoo.com">Alwyn Schoeman</a> 028 * @version $Revision$ $Date$ 029 */ 030public interface ISOChannel extends ISOSource { 031 int CONNECT = 0; 032 int TX = 1; 033 int RX = 2; 034 int SIZEOF_CNT = 3; 035 036 /** 037 * Associate a packager with this channel 038 * @param p an ISOPackager 039 */ 040 void setPackager(ISOPackager p); 041 042 /** 043 * Connects ISOChannel 044 * @exception IOException 045 */ 046 void connect() throws IOException; 047 048 /** 049 * disconnects ISOChannel 050 * @exception IOException 051 */ 052 void disconnect() throws IOException; 053 054 /** 055 * Reconnect channel 056 * @exception IOException 057 */ 058 void reconnect() throws IOException; 059 060 /** 061 * @return true if Channel is connected and usable 062 */ 063 boolean isConnected(); 064 065 /** 066 * Receives an ISOMsg 067 * @return the Message received 068 * @exception IOException 069 * @exception ISOException 070 */ 071 ISOMsg receive() throws IOException, ISOException; 072 073 /** 074 * sends an ISOMsg over the TCP/IP session 075 * @param m the Message to be sent 076 * @exception IOException 077 * @exception ISOException 078 */ 079 void send(ISOMsg m) throws IOException, ISOException; 080 081 /** 082 * sends a byte[] over the TCP/IP session 083 * @param b the byte array to be sent 084 * @exception IOException 085 * @exception ISOException 086 */ 087 void send(byte[] b) throws IOException, ISOException; 088 089 /** 090 * @param b - usable state 091 */ 092 void setUsable(boolean b); 093 094 /** 095 * associates this ISOChannel with a name on NameRegistrar 096 * @param name name to register 097 * @see org.jpos.util.NameRegistrar 098 */ 099 void setName(String name); 100 101 /** 102 * @return this ISOChannel's name ("" if no name was set) 103 */ 104 String getName(); 105 106 /** 107 * @return current packager 108 */ 109 ISOPackager getPackager(); 110 111 /** 112 * Expose channel clonning interface 113 */ 114 Object clone(); 115 116} 117