OFFIS DCMTK  Version 3.6.0
dcuserid.h
1 /*
2  *
3  * Copyright (C) 2008-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Author: Michael Onken
15  *
16  * Module: dcmnet
17  *
18  * Purpose:
19  * User Identity Negotiation for A-ASSOCIATE (Supp. 99)
20  *
21  * Last Update: $Author: joergr $
22  * Update Date: $Date: 2010-10-14 13:17:22 $
23  * CVS/RCS Revision: $Revision: 1.7 $
24  * Status: $State: Exp $
25  *
26  * CVS/RCS Log at end of file
27  *
28  */
29 
30 #ifndef DCUSERID_H
31 #define DCUSERID_H
32 
33 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
34 #include "dcmtk/ofstd/ofcond.h"
35 
37 #define DUL_TYPENEGOTIATIONOFUSERIDENTITY (unsigned char)0x58
38 
40 enum T_ASC_UserIdentityNegotiationMode
41 {
42  ASC_USER_IDENTITY_NONE = 0,
43  ASC_USER_IDENTITY_USER = 1,
44  ASC_USER_IDENTITY_USER_PASSWORD = 2,
45  ASC_USER_IDENTITY_KERBEROS = 3,
46  ASC_USER_IDENTITY_SAML = 4,
47  ASC_USER_IDENTITY_UNKNOWN
48 };
49 
50 
54 
55 public:
56 
60 
65  virtual unsigned char pduType() const =0;
66 
70  virtual unsigned char getItemType() const {return m_itemType;}
71 
76  virtual unsigned char getReserved() const {return m_reserved;}
77 
82  virtual OFCondition streamedLength(unsigned long& length) const = 0;
83 
92  virtual OFCondition parseFromBuffer(unsigned char *readBuffer,
93  unsigned long& bytesRead,
94  unsigned long availData) =0;
95 
101  virtual OFCondition stream(unsigned char *targetBuffer,
102  unsigned long& lengthWritten) const =0;
103 
107  virtual void clear() =0;
108 
113  virtual void dump(STD_NAMESPACE ostream& outstream) const =0;
114 
118 
119 private:
120 
123  const unsigned char m_itemType;
124 
126  const unsigned char m_reserved;
127 
128 };
129 
130 
134 
135 public:
136 
140 
144  unsigned char pduType() const;
145 
149  virtual void clear();
150 
156  void setIdentityType(const T_ASC_UserIdentityNegotiationMode& mode);
157 
162  T_ASC_UserIdentityNegotiationMode getIdentityType();
163 
169  void setPrimField(const char *buffer,
170  const Uint16& length);
171 
177  void setSecField(const char *buffer,
178  const Uint16& length);
179 
187  Uint16 getPrimField(char*& resultBuf,
188  Uint16& resultLen) const;
189 
197  Uint16 getSecField(char*& resultBuf,
198  Uint16& resultLen) const;
199 
204  void setReqPosResponse(const OFBool& reqPosRsp);
205 
206 
211  {
212  return (m_posRspRequested != 0) ? OFTrue: OFFalse;
213  }
214 
221  OFCondition stream(unsigned char *targetBuffer,
222  unsigned long& lengthWritten) const;
223 
228  OFCondition streamedLength(unsigned long& length) const;
229 
238  OFCondition parseFromBuffer(unsigned char *readBuffer,
239  unsigned long &bytesRead,
240  unsigned long availData);
241 
246  void dump(STD_NAMESPACE ostream& outstream) const;
247 
253 
259 
263 
264 private:
265 
267  T_ASC_UserIdentityNegotiationMode m_userIdentityType;
269  unsigned char m_posRspRequested;
271  char* m_primField;
275  char* m_secField;
278 };
279 
280 
282 
283 public:
284 
288 
292  unsigned char pduType() const;
293 
297  virtual void clear();
298 
304  void setServerResponse(const char* rsp,
305  const Uint16& rspLen);
306 
314  Uint16 getServerResponse(char*& targetBuffer,
315  Uint16& resultLen) const;
316 
321  OFCondition streamedLength(unsigned long& length) const;
322 
328  OFCondition stream(unsigned char *targetBuffer,
329  unsigned long& lengthWritten) const;
330 
339  OFCondition parseFromBuffer(unsigned char *readBuffer,
340  unsigned long &bytesRead,
341  unsigned long availData);
342 
347  void dump(STD_NAMESPACE ostream& outstream) const;
348 
354 
360 
364 
365 private:
366 
368  char* m_serverRsp;
370  Uint16 m_rspLength;
371 
372 };
373 
374 #endif // DCUSERID_H
375 
376 /*
377 ** CVS/RCS Log:
378 ** $Log: dcuserid.h,v $
379 ** Revision 1.7 2010-10-14 13:17:22 joergr
380 ** Updated copyright header. Added reference to COPYRIGHT file.
381 **
382 ** Revision 1.6 2010-10-05 11:01:04 uli
383 ** Removed a unused copy-constructor and a unused operator=.
384 **
385 ** Revision 1.5 2010-09-14 11:42:14 uli
386 ** Verify the length fields in the PDUs that we receive.
387 **
388 ** Revision 1.4 2009-09-29 14:34:16 uli
389 ** Include only the needed headers in dcuserid.h and not dctk.h.
390 **
391 ** Revision 1.3 2008-10-07 09:08:13 onken
392 ** Fixed possible memory leak in user identity classes and added code for
393 ** accessing user identity from the server's side. Thanks to "Pim"
394 **
395 ** Revision 1.2 2008-04-17 16:09:32 onken
396 ** Added some const definitions to functions.
397 **
398 ** Revision 1.1 2008-04-17 15:28:33 onken
399 ** Reworked and extended User Identity Negotiation code.
400 **
401 */


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2