00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef DCMTRANS_H
00031 #define DCMTRANS_H
00032
00033 #include "dcmtk/config/osconfig.h"
00034 #include "dcmtk/ofstd/oftypes.h"
00035 #include "dcmtk/dcmnet/dcmlayer.h"
00036 #include "dcmtk/ofstd/ofstream.h"
00037
00038 #define INCLUDE_UNISTD
00039 #include "dcmtk/ofstd/ofstdinc.h"
00040
00045 class DcmTransportConnection
00046 {
00047 public:
00048
00054 DcmTransportConnection(int openSocket);
00055
00058 virtual ~DcmTransportConnection();
00059
00065 virtual DcmTransportLayerStatus serverSideHandshake() = 0;
00066
00072 virtual DcmTransportLayerStatus clientSideHandshake() = 0;
00073
00080 virtual DcmTransportLayerStatus renegotiate(const char *newSuite) = 0;
00081
00088 virtual ssize_t read(void *buf, size_t nbyte) = 0;
00089
00096 virtual ssize_t write(void *buf, size_t nbyte) = 0;
00097
00102 virtual void close() = 0;
00103
00108 virtual unsigned long getPeerCertificateLength() = 0;
00109
00110
00111
00112
00113
00114
00115
00116
00117 virtual unsigned long getPeerCertificate(void *buf, unsigned long bufLen) = 0;
00118
00125 virtual OFBool networkDataAvailable(int timeout) = 0;
00126
00130 virtual OFBool isTransparentConnection() = 0;
00131
00136 virtual OFString& dumpConnectionParameters(OFString& str) = 0;
00137
00143 void dumpConnectionParameters(STD_NAMESPACE ostream& out);
00144
00149 virtual const char *errorString(DcmTransportLayerStatus code) = 0;
00150
00165 static OFBool selectReadableAssociation(DcmTransportConnection *connections[], int connCount, int timeout);
00166
00167 protected:
00168
00172 int getSocket() { return theSocket; }
00173
00177 void setSocket(int socket) { theSocket = socket; }
00178
00179 private:
00180
00182 DcmTransportConnection(const DcmTransportConnection&);
00183
00185 DcmTransportConnection& operator=(const DcmTransportConnection&);
00186
00203 static OFBool safeSelectReadableAssociation(DcmTransportConnection *connections[], int connCount, int timeout);
00204
00221 static OFBool fastSelectReadableAssociation(DcmTransportConnection *connections[], int connCount, int timeout);
00222
00224 int theSocket;
00225 };
00226
00227
00230 class DcmTCPConnection: public DcmTransportConnection
00231 {
00232 public:
00233
00239 DcmTCPConnection(int openSocket);
00240
00243 virtual ~DcmTCPConnection();
00244
00250 virtual DcmTransportLayerStatus serverSideHandshake();
00251
00257 virtual DcmTransportLayerStatus clientSideHandshake();
00258
00265 virtual DcmTransportLayerStatus renegotiate(const char *newSuite);
00266
00273 virtual ssize_t read(void *buf, size_t nbyte);
00274
00281 virtual ssize_t write(void *buf, size_t nbyte);
00282
00287 virtual void close();
00288
00293 virtual unsigned long getPeerCertificateLength();
00294
00295
00296
00297
00298
00299
00300
00301
00302 virtual unsigned long getPeerCertificate(void *buf, unsigned long bufLen);
00303
00309 virtual OFBool networkDataAvailable(int timeout);
00310
00314 virtual OFBool isTransparentConnection();
00315
00320 virtual OFString& dumpConnectionParameters(OFString& str);
00321
00326 virtual const char *errorString(DcmTransportLayerStatus code);
00327
00328 private:
00329
00331 DcmTCPConnection(const DcmTCPConnection&);
00332
00334 DcmTCPConnection& operator=(const DcmTCPConnection&);
00335
00336 };
00337
00338 #endif
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381