Classes | |
| class | Base |
| Base class of all gdcm classes Contains the Print related methods : -Print -SetPrintLevel / GetPrintLevel. More... | |
| class | BinEntry |
| Any Dicom Document (File or DicomDir) contains a set of DocEntry - Dicom entries - BinEntry is an elementary DocEntry (i.e. a ContentEntry, as opposite to SeqEntry) whose content is non std::string representable BinEntry is a specialisation of ContentEntry. More... | |
| struct | Element |
| structure, for internal use only More... | |
| class | ContentEntry |
| Any Dicom Document (File or DicomDir) contains a set of DocEntry - Dicom entries - (when successfuly parsed against a given Dicom dictionary) ContentEntry is an elementary DocEntry (as opposed to SeqEntry). Depending on the type of its content, ContentEntry is specialized as a ValEntry or a BinEntry. More... | |
| class | Debug |
| Debug is an object for debugging in program. It has 2 debugging modes : -error : for bad library use, seriously wrong DICOM -debug : for information/debug messages -warning : for warning about DICOM quality (kosher). More... | |
| class | DicomDir |
| DicomDir defines an object representing a DICOMDIR in memory as a tree-like structure DicomDirPatient -> DicomDirStudy -> DicomDirSerie -> DicomDirImage. More... | |
| class | DicomDirElement |
| Represents elements contained in a DicomDir class for the chained lists from the file 'Dicts/DicomDir.dic'. More... | |
| class | DicomDirImage |
| describes an IMAGE within a SERIE (DicomDirSerie) of a given DICOMDIR (DicomDir) More... | |
| class | DicomDirMeta |
| Meta Elements (group 0002) of a DicomDir. More... | |
| class | DicomDirObject |
| Parent object for DicomDirPatient, DicomDirStudy, DicomDirSerie, DicomDirImage, of a DicomDir. More... | |
| class | DicomDirPatient |
| describes a PATIENT within a DICOMDIR (DicomDir) More... | |
| class | DicomDirSerie |
| describes a SERIE within a within a STUDY (DicomDirStudy) of a given DICOMDIR (DicomDir) More... | |
| class | DicomDirStudy |
| describes a STUDY within a within a PATIENT (DicomDirPatient) of a given DICOMDIR (DicomDir) More... | |
| class | Dict |
| Dict acts a memory representation of a dicom dictionary i.e. it is a container for a collection of dictionary entries. The dictionary is loaded from in an ascii file. There should be a single public dictionary (THE dictionary of the actual DICOM v3) but as many shadow dictionaries as imagers combined with all software versions... More... | |
| class | DictEntry |
| the DictEntry in an element contained by the Dict. It contains : -the key referenced by the DICOM norm or the constructor (for private keys) i.e. the Group number the Element number -the VR (Value Representation) -the VM (Value Multplicity) -the corresponding name in english More... | |
| class | DictSet |
| Container for managing a set of loaded dictionaries (Dict). More... | |
| class | DirList |
| List containing the file headers of all the gdcm readable files found by exploring recursively a root directory. More... | |
| class | DocEntry |
| The dicom header of a Dicom file contains a set of such entries (when successfuly parsed against a given Dicom dictionary). More... | |
| class | DocEntryArchive |
| Container It's goal is to change the File header correctly. At this time, the change is only made for the first level of the Document. In the future, it might consider Dicom Sequences (SeqEntry, within any SQItem). The change is made by replacing a DocEntry by an other that is created outside the class. The old value is kept. When we restore the File status, the added DocEntry is deleted and replaced by the old value. More... | |
| class | DocEntrySet |
| DocEntrySet is an abstract base class for ElementSet and SQItem which are both containers for DocEntries. ElementSet is based on the STL map<> container (see ElementSet::TagHT), as opposed to SQItem which is based on an STL list container (see ListDocEntry). Since the syntax for adding a new element to a map<> or a list<> differ, DocEntrySet is designed as an adapter to unify the interfaces of DocEntrySet and ElementSet. As an illustration of this design, please refer to the implementation of AddEntry (or any pure virtual method) in both derived classes. This adapter unification of interfaces enables the parsing of a DICOM header containing (optionaly heavily nested) sequences to be written recursively [see Document::ParseDES which calls Document::ParseSQ, which in turns calls Document::ParseDES ]. More... | |
| class | Document |
| Derived by both gdcm::File and gdcm::DicomDir. More... | |
| class | ElementSet |
| ElementSet is based on the STL map<> container (see ElementSet::TagHT), as opposed to SQItem which is based on an STL list container (see ListDocEntry). It contains the 'zero-level- DocEntry (out of any Dicom Sequence) More... | |
| class | Exception |
| Any exception thrown in the gdcm library. More... | |
| class | FileError |
| File error exception thrown in the gdcm library. More... | |
| class | FormatUnexpected |
| Unexpected file format exception. More... | |
| class | FormatError |
| Invalid file format exception. More... | |
| class | File |
| DICOM elements and their corresponding values (and additionaly the corresponding DICOM dictionary entry) of the header of a DICOM file. More... | |
| class | FileHelper |
| In addition to Dicom header exploration, this class is designed for accessing the image/volume content. One can also use it to write Dicom/ACR-NEMA/RAW files. More... | |
| class | Global |
| This class contains all globals elements that might be instanciated only once (singletons). More... | |
| class | JPEGFragment |
| *very* internal class . Shouldn't appear here ! Utility class for summerizing the informations of a JPEG fragment of an "Encapsulated JPEG Compressed Image". This information is a mix of: -the fragment offset -the fragment length More... | |
| class | JPEGFragmentsInfo |
| Utility class for gathering the informations of the collection of JPEG fragment[s] (see JPEGFragment) when handling "Encapsulated JPEG Compressed Images". The informations on each frame are obtained during the pixel parsing of a gdcm::File (refer to File::ComputeJPEGFragmentInfo() ). They shall be used when (if necessary) decoding the fragments. More... | |
| class | PixelReadConvert |
| Utility container for gathering the various forms the pixel data migth take during the user demanded processes. More... | |
| class | PixelWriteConvert |
| Utility container for gathering the various forms the pixel data migth take during the user demanded processes. More... | |
| class | RLEFrame |
| Utility class for summerizing the informations of a SINGLE RLE frame of an "Encapsulated RLE Compressed Image" (refer to PS 3.5-2003 annex G). This information is a mix of: -the RLE Header (see PS 3.5-2003 section G5) and -the lengths of each RLE segment [ which can be decuded from both the above RLE Header and the itemlength of the frame). More... | |
| class | RLEFramesInfo |
| Utility class for gathering the informations of the collection of RLE frame[s] (see RLEFrame) when handling "Encapsulated RLE Compressed Images" (see PS 3.5-2003 annex G). Note: a classical image can be considered as the degenerated case of a multiframe image. In this case the collection is limited to a single individual frame. The informations on each frame are obtained during the pixel parsing of a gdcm::File (refer to File::ComputeRLEInfo() ). They shall be used when (if necessary) decoding the frames. More... | |
| class | SeqEntry |
| a SeqEntry (as opposed to a ValEntry) is a non elementary DocEntry. It is composed by a set of SQItems. Each SQItem is composed by a set of DocEntry A DocEntry may be a SeqEntry ... and so forth More... | |
| class | SerieHelper |
| -This class should be used for a stack of 2D dicom images. It allows to explore (recursively or not) a directory and makes a set of 'Coherent Files' list (coherent : same Serie UID) It allows to sort any of the Coherent File list on the image postion More... | |
| class | SQItem |
| a SeqEntry is composed by a set of SQItems. Each SQItem is composed by a set of DocEntry A DocEntry may be a SeqEntry ... and so forth More... | |
| class | Util |
| Here are some utility functions, belonging to the Util class, dealing with strings, file names... that can be called from anywhere by whomsoever they can help. More... | |
| class | ValEntry |
| Any Dicom Document (File or DicomDir) contains a set of DocEntry - Dicom entries - ValEntry is an elementary DocEntry (i.e. a ContentEntry, as opposed to SeqEntry) whose content is 'std::string representable' : characters, or integers (loaded in memory as a std::string) ValEntry is a specialisation of ContentEntry. More... | |
| class | VR |
| Container for dicom Value Representation Hash Table. More... | |
Typedefs | |
| typedef std::string | TagKey |
TagKey is made to hold an "universal" (as in URL, Universal Ressource Locator) key to a DocEntry i.e. a dicom tag. A dicom tag always has a group and an elem, but a set of tags embeded in various (optionally nested) sequences and sharing the same group and elem all share the same (group, elem) "identifier". Hence the (group, elem) cannot be used as an identifier (in gdcm we shall refer to a "TagKey") of a tag. In order to construct a proper tag identifier (i.e. a key) we consider the following definition of a TagKey:
| |
| typedef std::string | TagName |
| typedef std::list< DicomDirPatient * > | ListDicomDirPatient |
| typedef std::vector< Document * > | VectDocument |
| typedef std::list< Element > | ListDicomDirElem |
| typedef std::list< Element > | ListDicomDirMetaElem |
| typedef std::list< Element > | ListDicomDirPatientElem |
| typedef std::list< Element > | ListDicomDirStudyElem |
| typedef std::list< Element > | ListDicomDirSerieElem |
| typedef std::list< Element > | ListDicomDirImageElem |
| typedef std::list< DicomDirObject * > | ListContent |
| typedef std::list< DicomDirStudy * > | ListDicomDirStudy |
| typedef std::list< DicomDirImage * > | ListDicomDirImage |
| typedef std::list< DicomDirSerie * > | ListDicomDirSerie |
| typedef std::string | DictKey |
| typedef std::map< TagKey, DictEntry > | TagKeyHT |
| typedef std::map< DictKey, Dict * > | DictSetHT |
| typedef std::vector< std::string > | DirListType |
| typedef std::string | BaseTagKey |
| typedef std::map< TagKey, DocEntry * > | TagDocEntryHT |
| typedef std::list< SQItem * > | ListSQItem |
| typedef std::vector< File * > | GdcmFileList |
| typedef std::list< DocEntry * > | ListDocEntry |
| typedef std::string | VRKey |
| typedef std::string | VRAtr |
| typedef std::map< VRKey, VRAtr > | VRHT |
| Value Representation Hash Table. | |
Enumerations | |
| enum | FileType { Unknown = 0, ExplicitVR, ImplicitVR, ACR, ACR_LIBIDO } |
| enum | DicomDirType { DD_UNKNOWN = 0, DD_META, DD_PATIENT, DD_STUDY, DD_SERIE, DD_IMAGE } |
| enum | ModalityType { Unknow, AU, AS, BI, CF, CP, CR, CS, CT, DD, DF, DG, DM, DS, DX, ECG, EPS, ES, FA, FS, HC, HD, LP, LS, MA, MR, NM, OT, PT, RF, RG, RTDOSE, RTIMAGE, RTPLAN, RTSTRUCT, SM, ST, TG, US, VF, XA, XC } |
Functions | |
| void | FillDefaultDIRDict (DicomDirElement *dde) |
| void | FillDefaultDataDict (Dict *d) |
| std::ostream & | operator<< (std::ostream &os, const Exception &e) |
| Exception::operator <<. | |
| bool | gdcm_read_JPEG2000_file (std::ifstream *, void *) |
| routine for JPEG decompression | |
| bool | gdcm_read_JPEGLS_file (std::ifstream *fp, void *image_buffer) |
| routine for JPEG decompression | |
| int | GetMacAddrSys (unsigned char *addr) |
| int | getlastdigit (unsigned char *data) |
| template<class T> std::ostream & | binary_write (std::ostream &os, const T &val) |
| std::ostream & | binary_write (std::ostream &os, const uint16_t &val) |
| binary_write binary_write | |
| std::ostream & | binary_write (std::ostream &os, const uint32_t &val) |
| binary_write binary_write | |
| std::ostream & | binary_write (std::ostream &os, const char *val) |
| binary_write binary_write | |
| std::ostream & | binary_write (std::ostream &os, std::string const &val) |
| void | FillDefaultVRDict (VRHT &vr) |
Variables | |
| GDCM_EXPORT const std::string | GDCM_UNKNOWN = "gdcm::Unknown" |
| GDCM_EXPORT const std::string | GDCM_UNFOUND = "gdcm::Unfound" |
| GDCM_EXPORT const std::string | GDCM_BINLOADED = "gdcm::Binary data loaded" |
| GDCM_EXPORT const std::string | GDCM_NOTLOADED = "gdcm::NotLoaded" |
| GDCM_EXPORT const std::string | GDCM_UNREAD = "gdcm::UnRead" |
| bool | DebugFlag = false |
| bool | DebugToFile = false |
| std::ofstream | DebugFile |
| Global | Glob |
| Global container. | |
|
|
Definition at line 34 of file gdcmDocEntrySet.h. Referenced by gdcm::SQItem::GetBaseTagKey(), and gdcm::SQItem::SetBaseTagKey(). |
|
|
Definition at line 33 of file gdcmDict.h. Referenced by gdcm::DictSet::AppendDict(), gdcm::DictSet::GetDict(), gdcm::DictSet::LoadDictFromFile(), and gdcm::Document::SetShaDict(). |
|
|
Definition at line 30 of file gdcmDictSet.h. |
|
|
Definition at line 31 of file gdcmDirList.h. Referenced by gdcm::DicomDir::CreateDicomDirChainedList(), gdcm::DirList::GetFilenames(), and gdcm::SerieHelper::SetDirectory(). |
|
|
|
Definition at line 34 of file gdcmDicomDirObject.h. |
|
|
Definition at line 31 of file gdcmDicomDirElement.h. Referenced by gdcm::DicomDir::SetElement(). |
|
|
Definition at line 28 of file gdcmDicomDirSerie.h. |
|
|
Definition at line 36 of file gdcmDicomDirElement.h. Referenced by gdcm::DicomDirImage::DicomDirImage(), and gdcm::DicomDirElement::GetDicomDirImageElements(). |
|
|
Definition at line 32 of file gdcmDicomDirElement.h. Referenced by gdcm::DicomDirObject::FillObject(), and gdcm::DicomDirElement::GetDicomDirMetaElements(). |
|
|
Definition at line 38 of file gdcmDicomDir.h. |
|
|
Definition at line 33 of file gdcmDicomDirElement.h. Referenced by gdcm::DicomDirElement::GetDicomDirPatientElements(). |
|
|
Definition at line 28 of file gdcmDicomDirStudy.h. |
|
|
Definition at line 35 of file gdcmDicomDirElement.h. Referenced by gdcm::DicomDirSerie::DicomDirSerie(), and gdcm::DicomDirElement::GetDicomDirSerieElements(). |
|
|
Definition at line 29 of file gdcmDicomDirPatient.h. |
|
|
Definition at line 34 of file gdcmDicomDirElement.h. Referenced by gdcm::DicomDirMeta::DicomDirMeta(), gdcm::DicomDirPatient::DicomDirPatient(), gdcm::DicomDirStudy::DicomDirStudy(), and gdcm::DicomDirElement::GetDicomDirStudyElements(). |
|
|
Definition at line 32 of file gdcmSQItem.h. |
|
|
Definition at line 30 of file gdcmSeqEntry.h. |
|
|
Definition at line 34 of file gdcmElementSet.h. |
|
|
TagKey is made to hold an "universal" (as in URL, Universal Ressource Locator) key to a DocEntry i.e. a dicom tag. A dicom tag always has a group and an elem, but a set of tags embeded in various (optionally nested) sequences and sharing the same group and elem all share the same (group, elem) "identifier". Hence the (group, elem) cannot be used as an identifier (in gdcm we shall refer to a "TagKey") of a tag. In order to construct a proper tag identifier (i.e. a key) we consider the following definition of a TagKey:
Definition at line 128 of file gdcmCommon.h. Referenced by gdcm::ElementSet::AddEntry(), gdcm::Dict::AddEntry(), gdcm::ElementSet::GetDocEntry(), gdcm::Dict::GetEntry(), gdcm::ElementSet::RemoveEntry(), gdcm::Dict::RemoveEntry(), gdcm::ElementSet::RemoveEntryNoDestroy(), gdcm::DocEntry::SetKey(), and gdcm::DictEntry::TranslateToKey(). |
|
|
Definition at line 34 of file gdcmDict.h. |
|
|
|
Definition at line 39 of file gdcmDicomDir.h. Referenced by gdcm::DicomDir::CreateDicomDirChainedList(), and gdcm::DicomDir::SetElements(). |
|
|
Definition at line 32 of file gdcmVR.h. Referenced by gdcm::VR::VR(). |
|
|
Value Representation Hash Table.
|
|
|
|
Definition at line 139 of file gdcmCommon.h. Referenced by gdcm::DicomDirElement::DicomDirElement().
00139 {
00140 DD_UNKNOWN = 0,
00141 DD_META,
00142 DD_PATIENT,
00143 DD_STUDY,
00144 DD_SERIE,
00145 DD_IMAGE
00146 };
|
|
|
Definition at line 131 of file gdcmCommon.h. Referenced by gdcm::Document::GetFileType(), and gdcm::FileHelper::GetWriteType().
00131 {
00132 Unknown = 0,
00133 ExplicitVR, // DicomDir is in this case. Except when it's ImplicitVR !...
00134 ImplicitVR,
00135 ACR,
00136 ACR_LIBIDO
00137 };
|
|
|
Definition at line 31 of file gdcmFile.h. Referenced by gdcm::File::GetModality().
00031 {
00032 Unknow,
00033 AU, // Voice Audio
00034 AS, // Angioscopy
00035 BI, // Biomagnetic Imaging
00036 CF, // Cinefluorography
00037 CP, // Culposcopy
00038 CR, // Computed Radiography
00039 CS, // Cystoscopy
00040 CT, // Computed Tomography
00041 DD, // Duplex Dopler
00042 DF, // Digital Fluoroscopy
00043 DG, // Diaphanography
00044 DM, // Digital Microscopy
00045 DS, // Digital Substraction Angiography
00046 DX, // Digital Radiography
00047 ECG, // Echocardiography
00048 EPS, // Basic Cardiac EP
00049 ES, // Endoscopy
00050 FA, // Fluorescein Angiography
00051 FS, // Fundoscopy
00052 HC, // Hard Copy
00053 HD, // Hemodynamic
00054 LP, // Laparoscopy
00055 LS, // Laser Surface Scan
00056 MA, // Magnetic Resonance Angiography
00057 MR, // Magnetic Resonance
00058 NM, // Nuclear Medicine
00059 OT, // Other
00060 PT, // Positron Emission Tomography
00061 RF, // Radio Fluoroscopy
00062 RG, // Radiographic Imaging
00063 RTDOSE, // Radiotherapy Dose
00064 RTIMAGE, // Radiotherapy Image
00065 RTPLAN, // Radiotherapy Plan
00066 RTSTRUCT, // Radiotherapy Structure Set
00067 SM, // Microscopic Imaging
00068 ST, // Single-photon Emission Computed Tomography
00069 TG, // Thermography
00070 US, // Ultrasound
00071 VF, // Videofluorography
00072 XA, // X-Ray Angiography
00073 XC // Photographic Imaging
00074 };
|
|
||||||||||||
|
Definition at line 871 of file gdcmUtil.cxx.
00872 {
00873 return os.write(val.c_str(), val.size());
00874 }
|
|
||||||||||||
|
binary_write binary_write
Definition at line 861 of file gdcmUtil.cxx.
00862 {
00863 return os.write(val, strlen(val));
00864 }
|
|
||||||||||||
|
binary_write binary_write
Definition at line 844 of file gdcmUtil.cxx.
00845 {
00846 #ifdef GDCM_WORDS_BIGENDIAN
00847 uint32_t swap;
00848 swap = ( ((val<<24) & 0xff000000) | ((val<<8) & 0x00ff0000) |
00849 ((val>>8) & 0x0000ff00) | ((val>>24) & 0x000000ff) );
00850 return os.write(reinterpret_cast<const char*>(&swap), 4);
00851 #else
00852 return os.write(reinterpret_cast<const char*>(&val), 4);
00853 #endif //GDCM_WORDS_BIGENDIAN
00854 }
|
|
||||||||||||
|
binary_write binary_write
Definition at line 828 of file gdcmUtil.cxx.
00829 {
00830 #ifdef GDCM_WORDS_BIGENDIAN
00831 uint16_t swap;
00832 swap = ((( val << 8 ) & 0xff00 ) | (( val >> 8 ) & 0x00ff ) );
00833 return os.write(reinterpret_cast<const char*>(&swap), 2);
00834 #else
00835 return os.write(reinterpret_cast<const char*>(&val), 2);
00836 #endif //GDCM_WORDS_BIGENDIAN
00837 }
|
|
||||||||||||||||
|
Definition at line 818 of file gdcmUtil.cxx. Referenced by gdcm::ValEntry::WriteContent(), gdcm::SQItem::WriteContent(), gdcm::SeqEntry::WriteContent(), gdcm::DocEntry::WriteContent(), and gdcm::DicomDir::WriteDicomDir().
00819 {
00820 return os.write(reinterpret_cast<const char*>(&val), sizeof val);
00821 }
|
|
|
Referenced by gdcm::Dict::Dict(). |
|
|
Referenced by gdcm::DicomDirElement::DicomDirElement(). |
|
|
Referenced by gdcm::VR::VR(). |
|
||||||||||||
|
routine for JPEG decompression
Definition at line 36 of file gdcmJpeg2000.cxx. References gdcmWarningMacro.
00037 {
00038 gdcmWarningMacro( "Sorry JPEG 2000 File not yet taken into account" );
00039 return false;
00040 }
|
|
||||||||||||
|
routine for JPEG decompression
Definition at line 37 of file gdcmJpegLS.cxx. References gdcmWarningMacro.
00038 {
00039 (void)fp;
00040 (void)image_buffer;
00041 gdcmWarningMacro( "Sorry JPEG-LS File not yet taken into account" );
00042 return false;
00043 }
|
|
|
Mini function to return the last digit from a number express in base 256 pre condition data contain an array of 6 unsigned char post condition carry contain the last digit Definition at line 706 of file gdcmUtil.cxx. Referenced by gdcm::Util::GetMACAddress().
00707 {
00708 int extended, carry = 0;
00709 for(int i=0;i<6;i++)
00710 {
00711 extended = (carry << 8) + data[i];
00712 data[i] = extended / 10;
00713 carry = extended % 10;
00714 }
00715 return carry;
00716 }
|
|
|
Definition at line 441 of file gdcmUtil.cxx. Referenced by gdcm::Util::GetMACAddress().
00442 {
00443 #ifdef _WIN32
00444 WSADATA WinsockData;
00445 if (WSAStartup(MAKEWORD(2, 0), &WinsockData) != 0)
00446 {
00447 std::cerr << "This program requires Winsock 2.x!" << std::endl;
00448 return -1;
00449 }
00450
00451 HANDLE PollForTrapEvent;
00452 AsnObjectIdentifier SupportedView;
00453 UINT OID_ifEntryType[] = { 1, 3, 6, 1, 2, 1, 2, 2, 1, 3 };
00454 UINT OID_ifEntryNum[] = { 1, 3, 6, 1, 2, 1, 2, 1 };
00455 UINT OID_ipMACEntAddr[] = { 1, 3, 6, 1, 2, 1, 2, 2, 1, 6 };
00456 AsnObjectIdentifier MIB_ifMACEntAddr = {
00457 sizeof(OID_ipMACEntAddr) / sizeof(UINT), OID_ipMACEntAddr };
00458 AsnObjectIdentifier MIB_ifEntryType = {
00459 sizeof(OID_ifEntryType) / sizeof(UINT), OID_ifEntryType };
00460 AsnObjectIdentifier MIB_ifEntryNum = {
00461 sizeof(OID_ifEntryNum) / sizeof(UINT), OID_ifEntryNum };
00462 RFC1157VarBindList varBindList;
00463 RFC1157VarBind varBind[2];
00464 AsnInteger errorStatus;
00465 AsnInteger errorIndex;
00466 AsnObjectIdentifier MIB_NULL = { 0, 0 };
00467 int ret;
00468 int dtmp;
00469 int j = 0;
00470
00471 // Load the SNMP dll and get the addresses of the functions necessary
00472 HINSTANCE m_hInst = LoadLibrary("inetmib1.dll");
00473 if (m_hInst < (HINSTANCE) HINSTANCE_ERROR)
00474 {
00475 return -1;
00476 }
00477 pSnmpExtensionInit m_Init =
00478 (pSnmpExtensionInit) GetProcAddress(m_hInst, "SnmpExtensionInit");
00479 pSnmpExtensionQuery m_Query =
00480 (pSnmpExtensionQuery) GetProcAddress(m_hInst, "SnmpExtensionQuery");
00481 m_Init(GetTickCount(), &PollForTrapEvent, &SupportedView);
00482
00483 /* Initialize the variable list to be retrieved by m_Query */
00484 varBindList.list = varBind;
00485 varBind[0].name = MIB_NULL;
00486 varBind[1].name = MIB_NULL;
00487
00488 // Copy in the OID to find the number of entries in the
00489 // Inteface table
00490 varBindList.len = 1; // Only retrieving one item
00491 SNMP_oidcpy(&varBind[0].name, &MIB_ifEntryNum);
00492 m_Query(ASN_RFC1157_GETNEXTREQUEST, &varBindList, &errorStatus,
00493 &errorIndex);
00494 // printf("# of adapters in this system : %i\n",
00495 // varBind[0].value.asnValue.number);
00496 varBindList.len = 2;
00497
00498 // Copy in the OID of ifType, the type of interface
00499 SNMP_oidcpy(&varBind[0].name, &MIB_ifEntryType);
00500
00501 // Copy in the OID of ifPhysAddress, the address
00502 SNMP_oidcpy(&varBind[1].name, &MIB_ifMACEntAddr);
00503
00504 do
00505 {
00506 // Submit the query. Responses will be loaded into varBindList.
00507 // We can expect this call to succeed a # of times corresponding
00508 // to the # of adapters reported to be in the system
00509 ret = m_Query(ASN_RFC1157_GETNEXTREQUEST, &varBindList, &errorStatus,
00510 &errorIndex);
00511 if (!ret)
00512 {
00513 ret = 1;
00514 }
00515 else
00516 {
00517 // Confirm that the proper type has been returned
00518 ret = SNMP_oidncmp(&varBind[0].name, &MIB_ifEntryType,
00519 MIB_ifEntryType.idLength);
00520 }
00521 if (!ret)
00522 {
00523 j++;
00524 dtmp = varBind[0].value.asnValue.number;
00525
00526 // Type 6 describes ethernet interfaces
00527 if (dtmp == 6)
00528 {
00529 // Confirm that we have an address here
00530 ret = SNMP_oidncmp(&varBind[1].name, &MIB_ifMACEntAddr,
00531 MIB_ifMACEntAddr.idLength);
00532 if ( !ret && varBind[1].value.asnValue.address.stream != NULL )
00533 {
00534 if ( (varBind[1].value.asnValue.address.stream[0] == 0x44)
00535 && (varBind[1].value.asnValue.address.stream[1] == 0x45)
00536 && (varBind[1].value.asnValue.address.stream[2] == 0x53)
00537 && (varBind[1].value.asnValue.address.stream[3] == 0x54)
00538 && (varBind[1].value.asnValue.address.stream[4] == 0x00) )
00539 {
00540 // Ignore all dial-up networking adapters
00541 std::cerr << "Interface #" << j << " is a DUN adapter\n";
00542 continue;
00543 }
00544 if ( (varBind[1].value.asnValue.address.stream[0] == 0x00)
00545 && (varBind[1].value.asnValue.address.stream[1] == 0x00)
00546 && (varBind[1].value.asnValue.address.stream[2] == 0x00)
00547 && (varBind[1].value.asnValue.address.stream[3] == 0x00)
00548 && (varBind[1].value.asnValue.address.stream[4] == 0x00)
00549 && (varBind[1].value.asnValue.address.stream[5] == 0x00) )
00550 {
00551 // Ignore NULL addresses returned by other network
00552 // interfaces
00553 std::cerr << "Interface #" << j << " is a NULL address\n";
00554 continue;
00555 }
00556 memcpy( addr, varBind[1].value.asnValue.address.stream, 6);
00557 }
00558 }
00559 }
00560 } while (!ret);
00561
00562 // Free the bindings
00563 SNMP_FreeVarBind(&varBind[0]);
00564 SNMP_FreeVarBind(&varBind[1]);
00565 return 0;
00566 #endif //Win32 version
00567
00568
00569 // implementation for POSIX system
00570 #ifdef __sun
00571 //The POSIX version is broken anyway on Solaris, plus would require full
00572 //root power
00573 struct arpreq parpreq;
00574 struct sockaddr_in *psa;
00575 struct hostent *phost;
00576 char hostname[MAXHOSTNAMELEN];
00577 char **paddrs;
00578 int sock, status=0;
00579
00580 if(gethostname(hostname, MAXHOSTNAMELEN) != 0)
00581 {
00582 perror("gethostname");
00583 return -1;
00584 }
00585 phost = gethostbyname(hostname);
00586 paddrs = phost->h_addr_list;
00587
00588 sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
00589 if(sock == -1)
00590 {
00591 perror("sock");
00592 return -1;
00593 }
00594 memset(&parpreq, 0, sizeof(struct arpreq));
00595 psa = (struct sockaddr_in *) &parpreq.arp_pa;
00596
00597 memset(psa, 0, sizeof(struct sockaddr_in));
00598 psa->sin_family = AF_INET;
00599 memcpy(&psa->sin_addr, *paddrs, sizeof(struct in_addr));
00600
00601 status = ioctl(sock, SIOCGARP, &parpreq);
00602 if(status == -1)
00603 {
00604 perror("SIOCGARP");
00605 return -1;
00606 }
00607 memcpy(addr, parpreq.arp_ha.sa_data, 6);
00608
00609 return 0;
00610 #else
00611 #ifdef CMAKE_HAVE_NET_IF_H
00612 int sd;
00613 struct ifreq ifr, *ifrp;
00614 struct ifconf ifc;
00615 char buf[1024];
00616 int n, i;
00617 unsigned char *a;
00618 #if defined(AF_LINK) && (!defined(SIOCGIFHWADDR) && !defined(SIOCGENADDR))
00619 struct sockaddr_dl *sdlp;
00620 #endif
00621
00622 //
00623 // BSD 4.4 defines the size of an ifreq to be
00624 // max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len
00625 // However, under earlier systems, sa_len isn't present, so the size is
00626 // just sizeof(struct ifreq)
00627 // We should investiage the use of SIZEOF_ADDR_IFREQ
00628 //
00629 #ifdef HAVE_SA_LEN
00630 #ifndef max
00631 #define max(a,b) ((a) > (b) ? (a) : (b))
00632 #endif
00633 #define ifreq_size(i) max(sizeof(struct ifreq),\
00634 sizeof((i).ifr_name)+(i).ifr_addr.sa_len)
00635 #else
00636 #define ifreq_size(i) sizeof(struct ifreq)
00637 #endif // HAVE_SA_LEN
00638
00639 if( (sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0 )
00640 {
00641 return -1;
00642 }
00643 memset(buf, 0, sizeof(buf));
00644 ifc.ifc_len = sizeof(buf);
00645 ifc.ifc_buf = buf;
00646 if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0)
00647 {
00648 close(sd);
00649 return -1;
00650 }
00651 n = ifc.ifc_len;
00652 for (i = 0; i < n; i+= ifreq_size(*ifrp) )
00653 {
00654 ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i);
00655 strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ);
00656 #ifdef SIOCGIFHWADDR
00657 if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0)
00658 continue;
00659 a = (unsigned char *) &ifr.ifr_hwaddr.sa_data;
00660 #else
00661 #ifdef SIOCGENADDR
00662 // In theory this call should also work on Sun Solaris, but apparently
00663 // SIOCGENADDR is not implemented properly thus the call
00664 // ioctl(sd, SIOCGENADDR, &ifr) always returns errno=2
00665 // (No such file or directory)
00666 // Furthermore the DLAPI seems to require full root access
00667 if (ioctl(sd, SIOCGENADDR, &ifr) < 0)
00668 continue;
00669 a = (unsigned char *) ifr.ifr_enaddr;
00670 #else
00671 #ifdef AF_LINK
00672 sdlp = (struct sockaddr_dl *) &ifrp->ifr_addr;
00673 if ((sdlp->sdl_family != AF_LINK) || (sdlp->sdl_alen != 6))
00674 continue;
00675 a = (unsigned char *) &sdlp->sdl_data[sdlp->sdl_nlen];
00676 #else
00677 perror("No way to access hardware");
00678 close(sd);
00679 return -1;
00680 #endif // AF_LINK
00681 #endif // SIOCGENADDR
00682 #endif // SIOCGIFHWADDR
00683 if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5]) continue;
00684
00685 if (addr)
00686 {
00687 memcpy(addr, a, 6);
00688 close(sd);
00689 return 0;
00690 }
00691 }
00692 close(sd);
00693 #endif
00694 // Not implemented platforms
00695 perror("There was a configuration problem on your plateform");
00696 memset(addr,0,6);
00697 return -1;
00698 #endif //__sun
00699 }
|
|
||||||||||||
|
Exception::operator <<.
Definition at line 127 of file gdcmException.cxx. References gdcm::Exception::getError(), and gdcm::Exception::getName().
00128 {
00129 try
00130 {
00131 os << "Exception " << e.getName() << " thrown: " << e.getError() << std::endl;
00132 }
00133 catch(...)
00134 {
00135 Exception::fatal("operator<<(std::ostream &, const Exception&)");
00136 }
00137 return os;
00138 }
|
|
|
Definition at line 28 of file gdcmDebug.cxx. Referenced by gdcm::Debug::GetDebugFile(), gdcm::Debug::SetDebugFilename(), and gdcm::Debug::~Debug(). |
|
|
Definition at line 26 of file gdcmDebug.cxx. Referenced by gdcm::Debug::GetDebugFlag(), gdcm::Debug::SetDebugFilename(), and gdcm::Debug::SetDebugFlag(). |
|
|
Definition at line 27 of file gdcmDebug.cxx. Referenced by gdcm::Debug::GetDebugToFile(), gdcm::Debug::SetDebugFilename(), and gdcm::Debug::SetDebugToFile(). |
|
|
Definition at line 38 of file gdcmGlobal.cxx. Referenced by gdcm::Document::LoadDocEntry(), gdcm::DocEntrySet::SetBinEntry(), gdcm::FileHelper::SetWriteToRaw(), and gdcm::FileHelper::SetWriteToRGB(). |
|
|
Definition at line 39 of file gdcmGlobal.cxx. Referenced by gdcm::Document::GetTransferSyntaxName(), gdcm::Document::LoadDocEntry(), and gdcm::ValEntry::Print(). |
|
|
|
|
Definition at line 40 of file gdcmGlobal.cxx. Referenced by gdcm::Document::LoadDocEntry(). |
|
|
Global container.
Definition at line 52 of file gdcmGlobal.cxx. |
1.3.6