Esempio n. 1
0
CONDITION
SRV_RegisterSOPClass(const char *SOPClass, DUL_SC_ROLE role,
		     DUL_ASSOCIATESERVICEPARAMETERS * params)
{
  DUL_PRESENTATIONCONTEXTID contextID = 1;
  CTNBOOLEAN found = FALSE;
  CONDITION cond;
  DUL_PRESENTATIONCONTEXT* ctx;

  if (params->requestedPresentationContext == NULL) {
    params->requestedPresentationContext = LST_Create();
    if (params->requestedPresentationContext == NULL) {
      return COND_PushCondition(SRV_LISTFAILURE,
		   SRV_Message(SRV_LISTFAILURE), "SRV_RegisterSOPClass");
    }
  }
  ctx = LST_Head(&params->requestedPresentationContext);
  if (ctx != NULL)
    (void) LST_Position(&params->requestedPresentationContext, ctx);
  while (ctx != NULL) {
    contextID += 2;
    if (strcmp(SOPClass, ctx->abstractSyntax) == 0)
      return SRV_NORMAL;

    ctx = LST_Next(&params->requestedPresentationContext);
  }

  cond = DUL_MakePresentationCtx(&ctx, role, DUL_SC_ROLE_DEFAULT,
				       contextID, 0, SOPClass, "",
				       DICOM_TRANSFERLITTLEENDIAN, NULL);
  if (cond != DUL_NORMAL) {
    return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR,
				  SRV_Message(SRV_PRESENTATIONCONTEXTERROR),
				      "SRV_RegisterSOPClass");
  }

  cond = LST_Enqueue(&params->requestedPresentationContext, ctx);
  if (cond != LST_NORMAL) {
    return COND_PushCondition(SRV_LISTFAILURE,
		   SRV_Message(SRV_LISTFAILURE), "SRV_RegisterSOPClass");
  }

  return SRV_NORMAL;
}
Esempio n. 2
0
CONDITION
SRV_ProposeSOPClassWithXfer(const char*SOPClass, DUL_SC_ROLE role, char** xferSyntaxes, int xferSyntaxCount, int isStorageClass,  DUL_ASSOCIATESERVICEPARAMETERS* params)
{
  DUL_PRESENTATIONCONTEXTID 	contextID = 1;
  CONDITION 					cond;
  DUL_PRESENTATIONCONTEXT* 		ctx;
  char** 						xferSyntaxesLocal = 0;
  char* 						prefix = "PROPOSE/XFER";
  int 							singleMode = 1;

  if (params->requestedPresentationContext == NULL) {
	  params->requestedPresentationContext = LST_Create();
	  if (params->requestedPresentationContext == NULL) return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE), "SRV_ProposeSOPClassWithXfer");
  }

  ctx = LST_Head(&params->requestedPresentationContext);
  if (ctx != NULL) (void) LST_Position(&params->requestedPresentationContext, ctx);
  while (ctx != NULL) {
	  contextID += 2;
	  if (strcmp(SOPClass, ctx->abstractSyntax) == 0) return SRV_NORMAL;
	  ctx = LST_Next(&params->requestedPresentationContext);
  }

  if (xferSyntaxCount == 0) {
	  if (isStorageClass) prefix = "PROPOSE/XFER/STORAGE";
	  xferSyntaxesLocal = mapProposedSOPToXferSyntax(SOPClass, prefix, &xferSyntaxCount, &singleMode);
  }else{
	  xferSyntaxesLocal = xferSyntaxes;
	  singleMode = 1;
  }

  if (singleMode == 1) {
	  cond = DUL_AddSinglePresentationCtx(params, role, DUL_SC_ROLE_DEFAULT, contextID,	0, SOPClass, xferSyntaxesLocal,	xferSyntaxCount);
  }else{
	  cond = DUL_AddMultiplePresentationCtx(params, role, DUL_SC_ROLE_DEFAULT, contextID, 0, SOPClass, xferSyntaxesLocal, xferSyntaxCount);
  }
  if (xferSyntaxesLocal != xferSyntaxes) CTN_FREE(xferSyntaxesLocal);
  if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_ProposeSOPClassWithXfer");
  if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_ProposeSOPClassWithXfer");

  return SRV_NORMAL;
}
Esempio n. 3
0
static DUL_TRANSFERSYNTAX*
matchProposedXferSyntax(DUL_PRESENTATIONCONTEXT* requestedCtx, const char* prefix, char** xferSyntaxes, int xferSyntaxCount)
{
  char** 				xferSyntaxesLocal = 0;
  DUL_TRANSFERSYNTAX* 	transfer;
  int 					found = 0;
  int 					idx;

  if (xferSyntaxCount == 0) {
	  char* paramValue;
	  char paramName[1024] = "";
	  strcpy(paramName, prefix);
	  strcat(paramName, "/");
	  strcat(paramName, requestedCtx->abstractSyntax);

	  paramValue = UTL_GetConfigParameter(paramName);
	  if (paramValue == NULL) paramValue = DICOM_TRANSFERLITTLEENDIAN;

	  xferSyntaxesLocal = UTL_ExpandToPointerArray(paramValue, ";", &xferSyntaxCount);
  }else{
	  xferSyntaxesLocal = xferSyntaxes;
  }

  for (idx = 0; (idx < xferSyntaxCount) && !found; idx++) {
	  transfer = (DUL_TRANSFERSYNTAX*)LST_Head(&requestedCtx->proposedTransferSyntax);
	  (void) LST_Position(&requestedCtx->proposedTransferSyntax, transfer);

	  while (transfer != NULL) {
		  if (strcmp(transfer->transferSyntax, xferSyntaxesLocal[idx]) == 0) {
			  found = 1;
			  break;
		  }else{
			  transfer = LST_Next(&requestedCtx->proposedTransferSyntax);
		  }
	  }
  }

  if (xferSyntaxesLocal != xferSyntaxes) CTN_FREE(xferSyntaxesLocal);

  return transfer;
}
char* UTL_GetConfigParameter(const char* paramName)
{
  CONDITION cond;
  char nameCopy[256];
  CONFIG_ITEM* item;
  int idx;

  cond = UTL_ReadConfigFile( );
  if (cond != UTL_NORMAL)
    return NULL;

  item = LST_Head(&UTL_configList);
  if (item == NULL)
    return NULL;

  (void) LST_Position(&UTL_configList, item);
  while(item != NULL) {
    if (strcmp(item->pName, paramName) == 0)
      return item->pValue;

    item = LST_Next(&UTL_configList);
  }

  strcpy(nameCopy, paramName);
  idx = strlen(nameCopy) - 1;
  while (idx > 0) {
    if (nameCopy[idx] == '/') {
      nameCopy[idx] = '\0';
      idx = -1;
      break;
    } else {
      idx--;
    }
  }

  if (idx < 0) {
    return UTL_GetConfigParameter(nameCopy);
  } else {
    return NULL;
  }
}
Esempio n. 5
0
/* findPresentationCtx
**
** Purpose:
**	Find the presentation context in the service parameters using the
**	context ID
**
** Parameter Dictionary:
**	params		Service parameters
**	ctxid		Context ID using which the presentation context
**			is to be returned
**
** Return Values:
**	Handle to the presentation context, if found, else NULL.
**
** Notes:
**
** Algorithm:
**	Description of the algorithm (optional) and any other notes.
*/
static DUL_PRESENTATIONCONTEXT
*
findPresentationCtx(DUL_ASSOCIATESERVICEPARAMETERS * params,
		    DUL_PRESENTATIONCONTEXTID ctxid)
{
    DUL_PRESENTATIONCONTEXT
    * ctx;

    if (params->acceptedPresentationContext == NULL)
	return NULL;
    ctx = LST_Head(&params->acceptedPresentationContext);
    if (ctx == NULL)
	return NULL;
    (void) LST_Position(&params->acceptedPresentationContext, ctx);
    while (ctx != NULL) {
	if (ctx->presentationContextID == ctxid)	/* context id found */
	    break;
	ctx = LST_Next(&params->acceptedPresentationContext);
    }

    return ctx;
}
Esempio n. 6
0
CONDITION
extractTitles(LST_HEAD * src, char *group, LST_HEAD * dst)
{
    DMAN_GROUPNAMES
	* s,
	*p;

    s = LST_Head(&src);
    if (s != NULL)
	(void) LST_Position(&src, s);

    while (s != NULL) {
	if (strcmp(s->GroupName, group) == 0) {
	    p = malloc(sizeof(*p));
	    if (p == NULL)
		return 0;
	    *p = *s;
	    (void) LST_Enqueue(&dst, p);
	}
	s = LST_Next(&src);
    }
    return 1;
}
Esempio n. 7
0
/* harvestChildrenProcesses
**
** Purpose:
**	The purpose of this function is to make sure that the exiting
**	child processes do not become zombies. Secondly, we also remove
**	the entry of the exiting process from the list we maintain.
**
** Parameter Dictionary:
**	list		Handle to the list of processes
**
** Return Values:
**	APP_NORMAL
**
** Notes:
**
** Algorithm:
**	Description of the algorithm (optional) and any other notes.
*/
static CONDITION
harvestChildrenProcesses(LST_HEAD ** list)
{
#ifndef _MSC_VER
    int
        pid;
    int
        statusp;
    PROCESS_ELEMENT
	* e;

    /* Continue as long as status is available from any of the child proceses */
    while ((pid = waitpid(-1, &statusp, WNOHANG)) > 0) {
	e = LST_Head(list);
	if (e != NULL)
	    (void) LST_Position(list, e);
	while (e != NULL) {
	    if (e->pid == pid) {
		printf("\n\n");
		printf("***Child Exit Status*****************************\n");
		printf("\tProcess ID #%d\n", pid);
		printf("\tCalling APP Title : %s\n", e->callingAPTitle);
		printf("\tCalled APP Title : %s\n", e->calledAPTitle);
		printf("\tExit status : %s\n", (statusp ? "ERROR" : "SUCCESS"));
		printf("*************************************************\n");
		printf("\n\n");
		(void) LST_Remove(list, LST_K_BEFORE);
		free(e);
		e = NULL;
	    } else {
		e = LST_Next(list);
	    }
	}
    }
#endif
    return APP_NORMAL;
}
Esempio n. 8
0
CONDITION
SRV_AcceptServiceClassWithOneXferSyntax(DUL_PRESENTATIONCONTEXT * requestedCtx,
		  DUL_SC_ROLE role, DUL_ASSOCIATESERVICEPARAMETERS * params,
		  const char* singleXferSyntax)
{
    int
        index;
    CTNBOOLEAN
	abstractFound = FALSE,
	transferFound = FALSE;

    CONDITION
	cond,
	rtnCond = SRV_NORMAL;
    DUL_PRESENTATIONCONTEXT
	* ctx;
    DUL_TRANSFERSYNTAX
	* transfer;

    if (params->acceptedPresentationContext == NULL) {
	params->acceptedPresentationContext = LST_Create();
	if (params->acceptedPresentationContext == NULL) {
	    return COND_PushCondition(SRV_LISTFAILURE,
		    SRV_Message(SRV_LISTFAILURE), "SRV_AcceptServiceClass");
	}
    }
    for (index = 0; index < (int) DIM_OF(syntaxList) && !abstractFound; index++) {
	if (strcmp(requestedCtx->abstractSyntax, syntaxList[index]) == 0) {
	    abstractFound = TRUE;
	}
    }
    if (abstractFound) {
#if 0
	char* xferSyntaxes[] =
	{ "1.2.840.10008.1.2.4.50",	/* JPEG Baseline Process 1 */
	"1.2.840.10008.1.2.4.51",	/* JPEG Extended Process 2 & 4 */
	"1.2.840.10008.1.2.1",		/* Explicit VR Little Endian */
	"1.2.840.10008.1.2.1.99",	/* Deflated Explicit VR Little Endian */
	"1.2.840.10008.1.2.2",		/* Explicit VR Big Endian Endian */
	DICOM_TRANSFERLITTLEENDIAN };
#endif

	transfer = matchProposedXferSyntax(requestedCtx,
			"ACCEPT/XFER", &singleXferSyntax, 1);
	if (transfer == NULL) {
	  cond = DUL_MakePresentationCtx(&ctx,
				       requestedCtx->proposedSCRole,
				       DUL_SC_ROLE_DEFAULT,
				       requestedCtx->presentationContextID,
				    DUL_PRESENTATION_REJECT_TRANSFER_SYNTAX,
				       requestedCtx->abstractSyntax,
	      DICOM_TRANSFERLITTLEENDIAN, DICOM_TRANSFERLITTLEENDIAN, NULL);
	  if (cond != DUL_NORMAL)
	    return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR,
				  SRV_Message(SRV_PRESENTATIONCONTEXTERROR),
				      "SRV_AcceptServiceClass");
	  (void) COND_PushCondition(SRV_UNSUPPORTEDSERVICE,
				  SRV_Message(SRV_UNSUPPORTEDSERVICE),
		    requestedCtx->abstractSyntax, "SRV_AcceptServiceClass");
	  rtnCond = COND_PushCondition(SRV_PRESENTATIONCTXREJECTED,
				   SRV_Message(SRV_PRESENTATIONCTXREJECTED),
		    requestedCtx->abstractSyntax, "SRV_AcceptServiceClass");
	} else {
	    cond = DUL_MakePresentationCtx(&ctx,
					 requestedCtx->proposedSCRole, role,
					requestedCtx->presentationContextID,
					   DUL_PRESENTATION_ACCEPT,
					   requestedCtx->abstractSyntax,
					   transfer->transferSyntax,
					   transfer->transferSyntax,
					   NULL);
	    if (cond != DUL_NORMAL)
		return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR,
				  SRV_Message(SRV_PRESENTATIONCONTEXTERROR),
					  "SRV_AcceptServiceClass");
	}
#if 0
	if ((transfer = LST_Head(&requestedCtx->proposedTransferSyntax)) == NULL)
	    return COND_PushCondition(SRV_LISTFAILURE,
		    SRV_Message(SRV_LISTFAILURE), "SRV_AcceptServiceClass");
	(void) LST_Position(&requestedCtx->proposedTransferSyntax, transfer);
	while (!transferFound && (transfer != NULL)) {
	    if (strcmp(transfer->transferSyntax, DICOM_TRANSFERLITTLEENDIAN) == 0)
		transferFound = TRUE;
	    else
		transfer = LST_Next(&requestedCtx->proposedTransferSyntax);
	}
	if (transferFound) {
	    cond = DUL_MakePresentationCtx(&ctx,
					 requestedCtx->proposedSCRole, role,
					requestedCtx->presentationContextID,
					   DUL_PRESENTATION_ACCEPT,
					   requestedCtx->abstractSyntax,
	      DICOM_TRANSFERLITTLEENDIAN, DICOM_TRANSFERLITTLEENDIAN, NULL);
	    if (cond != DUL_NORMAL)
		return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR,
				  SRV_Message(SRV_PRESENTATIONCONTEXTERROR),
					  "SRV_AcceptServiceClass");
	} else {
	    cond = DUL_MakePresentationCtx(&ctx,
					   requestedCtx->proposedSCRole,
					   DUL_SC_ROLE_DEFAULT,
					requestedCtx->presentationContextID,
				    DUL_PRESENTATION_REJECT_TRANSFER_SYNTAX,
					   requestedCtx->abstractSyntax,
	      DICOM_TRANSFERLITTLEENDIAN, DICOM_TRANSFERLITTLEENDIAN, NULL);
	    if (cond != DUL_NORMAL)
		return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR,
				  SRV_Message(SRV_PRESENTATIONCONTEXTERROR),
					  "SRV_AcceptServiceClass");

	    (void) COND_PushCondition(SRV_UNSUPPORTEDTRANSFERSYNTAX,
				 SRV_Message(SRV_UNSUPPORTEDTRANSFERSYNTAX),
		    requestedCtx->abstractSyntax, "SRV_AcceptServiceClass");
	    rtnCond = COND_PushCondition(SRV_PRESENTATIONCTXREJECTED,
				   SRV_Message(SRV_PRESENTATIONCTXREJECTED),
		    requestedCtx->abstractSyntax, "SRV_AcceptServiceClass");
	}
#endif
    } else {
	cond = DUL_MakePresentationCtx(&ctx,
				       requestedCtx->proposedSCRole,
				       DUL_SC_ROLE_DEFAULT,
				       requestedCtx->presentationContextID,
				    DUL_PRESENTATION_REJECT_ABSTRACT_SYNTAX,
				       requestedCtx->abstractSyntax,
	      DICOM_TRANSFERLITTLEENDIAN, DICOM_TRANSFERLITTLEENDIAN, NULL);
	if (cond != DUL_NORMAL)
	    return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR,
				  SRV_Message(SRV_PRESENTATIONCONTEXTERROR),
				      "SRV_AcceptServiceClass");
	(void) COND_PushCondition(SRV_UNSUPPORTEDSERVICE,
				  SRV_Message(SRV_UNSUPPORTEDSERVICE),
		    requestedCtx->abstractSyntax, "SRV_AcceptServiceClass");
	rtnCond = COND_PushCondition(SRV_PRESENTATIONCTXREJECTED,
				   SRV_Message(SRV_PRESENTATIONCTXREJECTED),
		    requestedCtx->abstractSyntax, "SRV_AcceptServiceClass");
    }
    cond = LST_Enqueue(&params->acceptedPresentationContext, ctx);
    if (cond != LST_NORMAL)
	return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE),
				  "SRV_AcceptServiceClass");

/*    pdvList.count = 0; */

    return rtnCond;
}
Esempio n. 9
0
static void
browseSelectionCB_scrolledList3(
				Widget wgt,
				XtPointer cd,
				XtPointer cb)
{
    Widget UxWidget = wgt;
    XtPointer UxClientData = cd;
    XtPointer UxCallbackArg = cb;
    {
	/*
	 * scrolledList3 *
	 * 
	 * Purpose: *   This subroutine lists the description of the selected
	 * attribute *   in the text widgets. *
	 * 
	 * Parameter Dictinary: *      cbs            input, pointer to the
	 * selected attribute *
	 * 
	 * Return Value: *      Description of the element *
	 * 
	 * Notes: *
	 * 
	 * Algorithm: *      Description of the algorithm (optional) and any
	 * other notes. *
	 * 
	 */

	XmListCallbackStruct *cbs;

	char *atname;
	int i;
	char buf2[64],
	    buf1[64];

	CONDITION cond;

	unsigned short gg,
	    ee;

	cbs = (XmListCallbackStruct *) UxCallbackArg;

	if ((atname = (char *) malloc(64)) == NULL)
	    printf(" malloc atname failed\n");

	XmStringGetLtoR(cbs->item, XmSTRING_DEFAULT_CHARSET, &atname);


	if (strlen(XmTextGetString(text1)) != 0)
	    XmTextSetString(text1, NULL);
	if (strlen(XmTextGetString(text2)) != 0)
	    XmTextSetString(text2, NULL);

	ieAttr = LST_Head(&attr_head);
	(void) LST_Position(&attr_head, ieAttr);
	for (i = 2; i <= cbs->item_position; i++)
	    ieAttr = LST_Next(&attr_head);

	cond = DCM_LookupElement(&ieAttr->element);
	if (cond != DCM_NORMAL) {
	    (void) COND_ExtractConditions(errorstackP);
	    copyWtext(info);
	    (void) COND_PopCondition(clearStack);
	    free(info);
	}
	sprintf(buf1, " %s", atname);
	XmTextSetString(text1, buf1);

	if (ieAttr->element.length == 0) {
	    strcpy(buf2, "<None>");
	    XmTextSetString(text2, buf2);
	} else {
	    switch (ieAttr->element.representation) {

	    case DCM_AS:	/* Age String */
	    case DCM_CS:	/* control string */
	    case DCM_DA:	/* date */
	    case DCM_DS:	/* decimal string */
	    case DCM_IS:	/* integer string */
	    case DCM_LO:	/* long string */
	    case DCM_LT:	/* long text */
	    case DCM_ST:	/* short text */
	    case DCM_SH:	/* short string */
	    case DCM_TM:	/* time */
	    case DCM_UI:	/* uid */
	    case DCM_PN:	/* person name */

		gg = DCM_TAG_GROUP(ieAttr->element.tag);
		ee = DCM_TAG_ELEMENT(ieAttr->element.tag);

		sprintf(buf2, "%04x,  %04x,   %s", gg, ee, ieAttr->element.d.string);
		XmTextSetString(text2, buf2);

		break;

	    case DCM_SS:	/* signed short */
		gg = DCM_TAG_GROUP(ieAttr->element.tag);
		ee = DCM_TAG_ELEMENT(ieAttr->element.tag);
		sprintf(buf2, "%04x,  %04x,  %d", gg, ee, *(ieAttr->element.d.us));
		XmTextSetString(text2, buf2);
		break;

	    case DCM_SL:	/* signed long */
		gg = DCM_TAG_GROUP(ieAttr->element.tag);
		ee = DCM_TAG_ELEMENT(ieAttr->element.tag);
		sprintf(buf2, " %04x,  %04x,  %d", gg, ee, *(ieAttr->element.d.sl));
		XmTextSetString(text2, buf2);
		break;

	    case DCM_US:	/* unsigned short */
		gg = DCM_TAG_GROUP(ieAttr->element.tag);
		ee = DCM_TAG_ELEMENT(ieAttr->element.tag);
		sprintf(buf2, " %04x, %04x, %d", gg, ee, *(ieAttr->element.d.us));
		XmTextSetString(text2, buf2);
		break;

	    case DCM_UL:	/* unsigned long */
		gg = DCM_TAG_GROUP(ieAttr->element.tag);
		ee = DCM_TAG_ELEMENT(ieAttr->element.tag);
		sprintf(buf2, " %04x, %04x, %d", gg, ee, *(ieAttr->element.d.ul));
		XmTextSetString(text2, buf2);
		break;

	    default:
		break;
	    }
	}
	free(atname);

    }
}
Esempio n. 10
0
static void
browseSelectionCB_scrolledList2(
				Widget wgt,
				XtPointer cd,
				XtPointer cb)
{
    Widget UxWidget = wgt;
    XtPointer UxClientData = cd;
    XtPointer UxCallbackArg = cb;
    {
	/*
	 * scrolledList2 *
	 * 
	 * Purpose: *   This subroutine examines the selected module, finds a
	 * pointer *   to the atrribute-list structure and loads the list of
	 * attributes *   in scrolledList3(window) *
	 * 
	 * Parameter Dictinary: *      cbs            input, pointer to the
	 * selected module structure *
	 * 
	 * Return Value: *      list of attributes loaded in scrolledList3 *
	 * 
	 * Notes: *
	 * 
	 * Algorithm: *      Description of the algorithm (optional) and any
	 * other notes. *
	 * 
	 */
	XmListCallbackStruct *cbs;

	char *modname;
	char buff[80];
	int i;
	int cnt = 0;
	XmString *strlist;

	CONDITION cond;

	cbs = (XmListCallbackStruct *) UxCallbackArg;

	/* clear scrolledlist3 */
	XtVaGetValues(scrolledList3,
		      XmNitemCount, &cnt,
		      XmNitems, &strlist,
		      NULL);
	if (cnt != 0) {
	    XmListDeleteAllItems(scrolledList3);
	    /* lint -e64 */
	    XtFree(strlist);
	    /* lint +e64 */
	}
	if (strlen(XmTextGetString(text1)) != 0)
	    XmTextSetString(text1, NULL);
	if (strlen(XmTextGetString(text2)) != 0)
	    XmTextSetString(text2, NULL);

	/* if any previous module structure is open, free it */
	if (ieModule != NULL) {
	    cond = IE_Free((void **) &ieModule);
	    if (cond != IE_NORMAL) {
		(void) COND_ExtractConditions(errorstackP);
		copyWtext(info);
		(void) COND_PopCondition(clearStack);
		free(info);
	    }
	}
	free(ieModule);

	/* load scrolledList3 with attributeList */

	ieModule = LST_Head(&mod_head);
	(void) LST_Position(&mod_head, ieModule);
	for (i = 2; i <= cbs->item_position; i++)
	    ieModule = LST_Next(&mod_head);

	cond = IE_ExamineModule(&queryObject, ieIE->ieType, ieModule->moduleType, &ieModule);
	if (cond != IE_NORMAL) {
	    (void) COND_ExtractConditions(errorstackP);
	    copyWtext(info);
	    (void) COND_PopCondition(clearStack);
	    free(info);
	}
	attr_head = ieModule->attributeList;

	MUT_LoadList(scrolledList3, ieModule->attributeList, formatattrieList, buff);


    }
}
Esempio n. 11
0
static void
browseSelectionCB_scrolledList1(
				Widget wgt,
				XtPointer cd,
				XtPointer cb)
{
    Widget UxWidget = wgt;
    XtPointer UxClientData = cd;
    XtPointer UxCallbackArg = cb;
    {
	/*
	 * scrolledList1 *
	 * 
	 * Purpose: *   This subrouitne examines the selected information
	 * entity(IE), *   finds a pointer to module-list structure and loads
	 * the list of *   modules in scrolledList2(window). *
	 * 
	 * Parameter Dictionary: *      cbs             input, pointer to the
	 * selected IE structure *
	 * 
	 * Return Value: *      list of modules loaded in the scrolledList2 *
	 * 
	 * Notes: *
	 * 
	 * Algorithm: *      Description of the algorithm (optional) and any
	 * other notes. *
	 * 
	 */
	XmListCallbackStruct *cbs;

	char *iename;
	int i;
	char buff[80];

	CONDITION cond;

	int cnt3 = 0;
	XmString *strlist3;

	cbs = (XmListCallbackStruct *) UxCallbackArg;


	/* if selected a new item from List1(IE), then clear list3 */

	XtVaGetValues(scrolledList2,
		      XmNitemCount, &cnt3,
		      XmNitems, &strlist3,
		      NULL);

	if (cnt3 != 0) {
	    XmListDeleteAllItems(scrolledList2);
	    /* lint -e64 */
	    XtFree(strlist3);
	    /* lint +e64 */
	}
	XtVaGetValues(scrolledList3,
		      XmNitemCount, &cnt3,
		      XmNitems, &strlist3,
		      NULL);

	if (cnt3 != 0) {
	    XmListDeleteAllItems(scrolledList3);
	    /* lint -e64 */
	    XtFree(strlist3);
	    /* lint +e64 */
	}
	/* clear any previosly open structure IE */
	if (ieIE != NULL) {
	    cond = IE_Free((void **) &ieIE);
	    if (cond != IE_NORMAL) {
		(void) COND_ExtractConditions(errorstackP);
		copyWtext(info);
		(void) COND_PopCondition(clearStack);
		free(info);
	    }
	}
	free(ieIE);

	/* clear text widgets */
	if (strlen(XmTextGetString(text1)) != 0)
	    XmTextSetString(text1, NULL);
	if (strlen(XmTextGetString(text2)) != 0)
	    XmTextSetString(text2, NULL);

	/* pointer to the head-end of the list, ieList */
	ieIE = LST_Head(&ie_head);
	/* makes current the node */
	(void) LST_Position(&ie_head, ieIE);

	/* pointer to the next item  */
	for (i = 2; i <= cbs->item_position; i++)
	    ieIE = LST_Next(&ie_head);

	cond = IE_ExamineInformationEntity(&queryObject, ieIE->ieType, &ieIE);
	if (cond != IE_NORMAL) {
	    (void) COND_ExtractConditions(errorstackP);
	    copyWtext(info);
	    (void) COND_PopCondition(clearStack);
	    free(info);
	}
	mod_head = ieIE->moduleList;

	MUT_LoadList(scrolledList2, ieIE->moduleList, formatmodieList, buff);



    }
}
Esempio n. 12
0
static CONDITION
getSCSeriesRecord(PRIVATE_HANDLE * h,
   FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList,
		  FIS_SCSERIESRECORD * r, long *count)
{
    CONDITION cond;
    TBL_CRITERIA criteria[2];
    FIS_SCSERIESRECORD *p;

    static TBL_FIELD fields[] = {
	{TBL_FIELD_STRING("SerInsUID", scSeries.SerInsUID)},
	{TBL_FIELD_STRING("StuComUID", scSeries.StuComUID)},
	{TBL_FIELD_STRING("SerDat", scSeries.SerDat)},
	{TBL_FIELD_STRING("SerTim", scSeries.SerTim)},
	{TBL_FIELD_STRING("RetAETit", scSeries.RetAETit)},
	{TBL_FIELD_STRING("StoMedFilSetID", scSeries.StoMedFilSetID)},
	{TBL_FIELD_STRING("StoMedFilSetUID", scSeries.StoMedFilSetUID)},
	{NULL},
    };

    criteria[0].FieldName = criteria[1].FieldName = NULL;
    if (uid != NULL) {
	if (uid[0] != '\0') {
	    if (criteriaType == FIS_K_STUDYCOMPONENT) {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "StuComUID", uid, TBL_STRING, TBL_EQUAL);
	    } else {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "SerInsUID", uid, TBL_STRING, TBL_EQUAL);
	    }
	}
    }
    (void) memset(&scSeries, 0, sizeof(scSeries));
    scSeries.Type = FIS_K_SCSERIES;
    cond = TBL_Select(&h->studyComponentSeriesHandle, criteria, fields, count,
		      scSeriesCallback, getList);
    if (cond != TBL_NORMAL)
	return COND_PushCondition(FIS_COND(FIS_STUDYGETFAILED),
				  "(FIS)getSCSeriesRecord");

    if (r != NULL)
	*r = scSeries;


    if (listFlag & FIS_K_SCSERIES_IMAGELIST) {
	if (getList != NULL) {
	    p = LST_Head(&getList);
	    (void) LST_Position(&getList, p);
	} else
	    p = r;
	while (p != NULL) {
	    p->ImageList = LST_Create();
	    cond = getSCImageRecord(h, FIS_K_SCSERIES, p->SerInsUID, 0,
				    p->ImageList, NULL, NULL);
	    if (cond != FIS_NORMAL)
		return cond;
	    if (getList != NULL)
		p = LST_Next(&getList);
	    else
		p = NULL;
	}
    }
    return FIS_NORMAL;
}
Esempio n. 13
0
static CONDITION
selectStudyRecord(PRIVATE_HANDLE * h,
		  FIS_CRITERIA_TYPE criteriaType, const char *criteriaString,
		  long listFlag, LST_HEAD * getList,
		  FIS_STUDYRECORD * r, long *count)
{
    CONDITION cond = FIS_NORMAL;
    TBL_CRITERIA criteria[2];
    char localString[1024];
    FIS_STUDYRECORD *p;

    static TBL_FIELD fields[] = {
	{TBL_FIELD_STRING("PatUID", study.PatUID)},
	{TBL_FIELD_STRING("StuInsUID", study.StuInsUID)},
	{TBL_FIELD_STRING("VisUID", study.VisUID)},
	{TBL_FIELD_STRING("AccNum", study.AccNum)},
	{TBL_FIELD_STRING("StuID", study.StuID)},
	{"SchStuStaDat", TBL_SIGNED4, sizeof(studyDate), sizeof(studyDate),
	0, (void *) &studyDate},
	{"SchStuStaTim", TBL_FLOAT4, sizeof(studyTime), sizeof(studyTime),
	0, (void *) &studyTime},
	{TBL_FIELD_STRING("SchStuLoc", study.SchStuLoc)},
	{TBL_FIELD_STRING("ProDes", study.ProDes)},
	{TBL_FIELD_STRING("StuStaID", study.StuStaID)},
	{NULL},
    };

    criteria[0].FieldName = criteria[1].FieldName = NULL;
    strcpy(localString, criteriaString);
    switch (criteriaType) {
    case FIS_K_ACCESSION:
	TBL_CRITERIA_LOAD_BYTE(criteria[0], "AccNum", localString, TBL_STRING, TBL_EQUAL);
	break;
    default:
	cond = 0;		/* Repair */
    }

    if (cond != FIS_NORMAL)
	return cond;

    (void) memset(&study, 0, sizeof(study));
    study.Type = FIS_K_STUDY;
    cond = TBL_Select(&h->studyHandle, criteria, fields, count, studyCallback,
		      getList);
    if (cond != TBL_NORMAL)
	return COND_PushCondition(FIS_COND(FIS_STUDYGETFAILED),
				  "(FIS)getStudyRecord");

    if (r != NULL)
	*r = study;

    if (listFlag & FIS_K_STU_STUDYCOMPONENTLIST) {
	if (getList != NULL) {
	    p = LST_Head(&getList);
	    (void) LST_Position(&getList, p);
	} else
	    p = r;
	while (p != NULL) {
	    p->StudyComponentList = LST_Create();
	    p->Flag |= FIS_K_STU_STUDYCOMPONENTLIST;
	    cond = getStudyComponentRecord(h, FIS_K_STUDY, p->StuInsUID,
				      0, p->StudyComponentList, NULL, NULL);
	    if (cond != FIS_NORMAL)
		return cond;
	    if (getList != NULL)
		p = LST_Next(&getList);
	    else
		p = NULL;
	}
    }
    if (listFlag & FIS_K_STU_RESULTSLIST) {
	if (getList != NULL) {
	    p = LST_Head(&getList);
	    (void) LST_Position(&getList, p);
	} else
	    p = r;
	while (p != NULL) {
	    p->ResultsList = LST_Create();
	    p->Flag |= FIS_K_STU_RESULTSLIST;
	    cond = getResultsRecord(h, FIS_K_STUDY, p->StuInsUID, 0,
				    p->ResultsList, NULL, NULL);
	    if (cond != FIS_NORMAL)
		return cond;
	    if (getList != NULL)
		p = LST_Next(&getList);
	    else
		p = NULL;
	}
    }
    return FIS_NORMAL;
}
Esempio n. 14
0
CONDITION
nextAssociationRequest(char *node, DUL_NETWORKKEY ** network,
	     DUL_ASSOCIATESERVICEPARAMETERS * service, unsigned long maxPDU,
		  CTNBOOLEAN forgiveFlag, DUL_ASSOCIATIONKEY ** association,
		       PROCESS_ELEMENT * processElement)
{
    CTNBOOLEAN
	drop,
	acceptFlag,
	acceptPresentationContext,
	readAccess = FALSE,
	writeAccess = FALSE;
    CONDITION
	cond,
	rtnCond = APP_NORMAL;
    DUL_PRESENTATIONCONTEXT
	* requestedCtx;
    int
        classCount;
    DUL_SC_ROLE
	scRole;
    DUL_ABORTITEMS
	abortItems;
    DMAN_HANDLE
	* manageHandle;
    DMAN_APPLICATIONENTITY ae;

    cond = DMAN_Open(controlDatabase, "", "", &manageHandle);
    if (cond != DMAN_NORMAL) {
	rtnCond = COND_PushCondition(APP_ERROR(APP_ASSOCIATIONRQFAILED));
	goto Exit;
    }
    (void) memset(service, 0, sizeof(*service));
    service->maxPDU = maxPDU;
    strcpy(service->calledImplementationClassUID,
	   MIR_IMPLEMENTATIONCLASSUID);
    strcpy(service->calledImplementationVersionName,
	   MIR_IMPLEMENTATIONVERSIONNAME);
    cond = DUL_ReceiveAssociationRQ(network, DUL_BLOCK,
				    service, association);
    if (cond != DUL_NORMAL) {
	rtnCond = COND_PushCondition(APP_ERROR(APP_ASSOCIATIONRQFAILED));
	goto Exit;
    }
    acceptFlag = TRUE;
    drop = FALSE;
    memset(processElement, 0, sizeof(*processElement));
    strcpy(processElement->callingAPTitle, service->callingAPTitle);
    strcpy(processElement->calledAPTitle, service->calledAPTitle);
    cond = DMAN_LookupApplication(&manageHandle, service->callingAPTitle, &ae);
    if (cond == DMAN_NORMAL && (ae.Flag & DMAN_K_APPLICATION_ORGANIZATION))
	strcpy(processElement->organization, ae.Organization);

    if (acceptFlag) {

	cond = associationCheck(node, service, &manageHandle, forgiveFlag,
				&abortItems);
	if (CTN_ERROR(cond)) {
	    acceptFlag = FALSE;
	    fprintf(stderr, "Incorrect Association Request\n");
	    (void) DUL_RejectAssociationRQ(association, &abortItems);
	    rtnCond = COND_PushCondition(APP_ERROR(APP_ASSOCIATIONRQFAILED));
	} else if (!CTN_SUCCESS(cond)) {
	    COND_DumpConditions();
	}
	if (acceptFlag) {
	    cond = DMAN_StorageAccess(&manageHandle, service->callingAPTitle,
			 service->calledAPTitle, &readAccess, &writeAccess);
	    if (cond != DMAN_NORMAL) {
		readAccess = writeAccess = FALSE;
		COND_DumpConditions();
	    }
	}
    }
    if (acceptFlag) {
	if (verboseDUL)
	    DUL_DumpParams(service);


	requestedCtx = LST_Head(&service->requestedPresentationContext);
	if (requestedCtx != NULL)
	    (void) LST_Position(&service->requestedPresentationContext,
				requestedCtx);
	classCount = 0;
	while (requestedCtx != NULL) {
	    ACCESS_MAP *p;
	    int i,
	        grantedAccess;

	    acceptPresentationContext = FALSE;
	    for (p = map, i = 0; i < DIM_OF(map) && !acceptPresentationContext; i++) {
		if (strcmp(p->SOPClassUID, requestedCtx->abstractSyntax) == 0)
		    acceptPresentationContext = TRUE;
		else
		    p++;
	    }
	    if (acceptPresentationContext) {
		if ((p->accessRights & ACCESS_WRITE)) {
		    if (!writeAccess)
			acceptPresentationContext = FALSE;
		}
		if ((p->accessRights & ACCESS_READ)) {
		    if (!readAccess)
			acceptPresentationContext = FALSE;
		}
	    }
	    if (acceptPresentationContext) {
		switch (requestedCtx->proposedSCRole) {
		case DUL_SC_ROLE_DEFAULT:
		    scRole = DUL_SC_ROLE_DEFAULT;
		    break;
		case DUL_SC_ROLE_SCU:
		    acceptPresentationContext = FALSE;
		    break;
		case DUL_SC_ROLE_SCP:
		    scRole = DUL_SC_ROLE_SCP;
		    break;
		case DUL_SC_ROLE_SCUSCP:
		    scRole = DUL_SC_ROLE_SCUSCP;
		    break;
		default:
		    acceptPresentationContext = FALSE;
		    break;
		}
	    }
	    if (acceptPresentationContext) {
		cond = SRV_AcceptServiceClass(requestedCtx, scRole,
					      service);
		if (cond == SRV_NORMAL) {
		    classCount++;
		} else {
		    printf("SRV Facility rejected SOP Class: %s\n",
			   requestedCtx->abstractSyntax);
		    COND_DumpConditions();
		}
	    } else {
		if (!silent)
		    printf("Simple server rejects: %s\n",
			   requestedCtx->abstractSyntax);
		cond = SRV_RejectServiceClass(requestedCtx,
				     DUL_PRESENTATION_REJECT_USER, service);
		if (cond != SRV_NORMAL) {
		    drop = TRUE;
		}
	    }
	    requestedCtx = LST_Next(&service->requestedPresentationContext);
	}
	if (!silent)
	    printf("Supported classes: %d\n", classCount);

	if (drop) {
	    (void) DUL_DropAssociation(association);
	    rtnCond = COND_PushCondition(APP_ERROR(APP_ASSOCIATIONRQFAILED));
	} else {
/*	    The acknowledgment is done by the person who called this function.
**	    We don't do it here any more.
*/
	}
    }
Exit:
    (void) DMAN_Close(&manageHandle);
    return rtnCond;
}
Esempio n. 15
0
CONDITION
SRV_RequestServiceClass(const char *SOPClass, DUL_SC_ROLE role,
			DUL_ASSOCIATESERVICEPARAMETERS * params)
{
    DUL_PRESENTATIONCONTEXTID
	contextID = 1;
    int
        index;
    CTNBOOLEAN
	found = FALSE;
    CONDITION
	cond;
    DUL_PRESENTATIONCONTEXT
	* ctx;

    if (params->requestedPresentationContext == NULL) {
	params->requestedPresentationContext = LST_Create();
	if (params->requestedPresentationContext == NULL) {
	    return COND_PushCondition(SRV_LISTFAILURE,
		   SRV_Message(SRV_LISTFAILURE), "SRV_RequestServiceClass");
	}
    }
    ctx = LST_Head(&params->requestedPresentationContext);
    if (ctx != NULL)
	(void) LST_Position(&params->requestedPresentationContext, ctx);
    while (ctx != NULL) {
	contextID += 2;
	if (strcmp(SOPClass, ctx->abstractSyntax) == 0)
	    return SRV_NORMAL;

	ctx = LST_Next(&params->requestedPresentationContext);
    }

    for (index = 0; index < (int) DIM_OF(syntaxList) && !found; index++) {
	if (strcmp(SOPClass, syntaxList[index]) == 0) {
	    found = TRUE;
	}
    }
    if (found) {
	char **xferSyntaxes;

	int singleMode = 1;
	int xferSyntaxCount = 0;

	xferSyntaxes = mapProposedSOPToXferSyntax(SOPClass,
		"PROPOSE/XFER", &xferSyntaxCount, &singleMode);

	if (singleMode == 1) {
	    cond = DUL_AddSinglePresentationCtx(params,
			role, DUL_SC_ROLE_DEFAULT, contextID,
			0, SOPClass, (const char**)xferSyntaxes,
			xferSyntaxCount);
	} else {
	    cond = DUL_AddMultiplePresentationCtx(params,
			role, DUL_SC_ROLE_DEFAULT, contextID,
			0, SOPClass, (const char**)xferSyntaxes,
			xferSyntaxCount);
	}
	if (cond != DUL_NORMAL) {
	    return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR,
			SRV_Message(SRV_PRESENTATIONCONTEXTERROR),
			"SRV_RequestServiceClass");
	}
/* Legacy version removed 1/3/2001, smm
	    cond = DUL_MakePresentationCtx(&ctx, role, DUL_SC_ROLE_DEFAULT,
				       contextID, 0, SOPClass, "",
				       DICOM_TRANSFERLITTLEENDIAN, NULL);
	if (cond != DUL_NORMAL)
	    return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR,
				  SRV_Message(SRV_PRESENTATIONCONTEXTERROR),
				      "SRV_RequestServiceClass");
	else {
	    cond = LST_Enqueue(&params->requestedPresentationContext, ctx);
	    if (cond != LST_NORMAL)
		return COND_PushCondition(SRV_LISTFAILURE,
		   SRV_Message(SRV_LISTFAILURE), "SRV_RequestServiceClass");

	    contextID += 2;
	}
*/

    } else
	return COND_PushCondition(SRV_UNSUPPORTEDSERVICE,
			      SRV_Message(SRV_UNSUPPORTEDSERVICE), SOPClass,
				  "SRV_RequestServiceClass");

    return SRV_NORMAL;
}
Esempio n. 16
0
static DUL_TRANSFERSYNTAX*
matchProposedXferSyntax(DUL_PRESENTATIONCONTEXT* requestedCtx,
			const char* prefix,
			char** xferSyntaxes, int xferSyntaxCount)
{
  char** xferSyntaxesLocal = 0;
  int singleMode = 0;
  DUL_TRANSFERSYNTAX* transfer;
  int found = 0;
  int idx;

  if (xferSyntaxCount == 0) {
    char* paramValue;
    char paramName[1024] = "";
    strcpy(paramName, prefix);
    strcat(paramName, "/");
    strcat(paramName, requestedCtx->abstractSyntax);

    paramValue = UTL_GetConfigParameter(paramName);
    if (paramValue == NULL)
      paramValue = DICOM_TRANSFERLITTLEENDIAN;

    xferSyntaxesLocal = UTL_ExpandToPointerArray(paramValue, ";", &xferSyntaxCount);
  } else {
    xferSyntaxesLocal = xferSyntaxes;
  }

  for (idx = 0; (idx < xferSyntaxCount) && !found; idx++) {
    transfer = (DUL_TRANSFERSYNTAX*)LST_Head(&requestedCtx->proposedTransferSyntax);
    (void) LST_Position(&requestedCtx->proposedTransferSyntax, transfer);
    while (transfer != NULL) {
//	  COND_PushCondition(0, "%s %s", transfer->transferSyntax, xferSyntaxesLocal[idx]); /*repair*/
      if (strcmp(transfer->transferSyntax, xferSyntaxesLocal[idx]) == 0) {
	found = 1;
	break;
      }
      else
	transfer = LST_Next(&requestedCtx->proposedTransferSyntax);
    }
  }

  if (!found) {
	  DUL_TRANSFERSYNTAX* x;
	  x = (DUL_TRANSFERSYNTAX*)LST_Head(&requestedCtx->proposedTransferSyntax);
	  (void)LST_Position(&requestedCtx->proposedTransferSyntax, x);
	  while (x != NULL) {
		  COND_PushCondition(SRV_REQUESTEDXFER, "SRV REQUESTED transfer syntax: %s",
			  x->transferSyntax);
		  x = (DUL_TRANSFERSYNTAX*)LST_Next(&requestedCtx->proposedTransferSyntax);
	  }
	  for (idx = 0; (idx < xferSyntaxCount) && !found; idx++) {
		  COND_PushCondition(SRV_SUPPORTEDXFER, "SRV Supported transfer syntax: %s",
			  xferSyntaxesLocal[idx]);
	  }
	  transfer = 0;
  }

  if (xferSyntaxesLocal != xferSyntaxes) {
    CTN_FREE(xferSyntaxesLocal);
  }
  return transfer;
}
Esempio n. 17
0
CONDITION
nextAssociationRequest(char *node, DUL_NETWORKKEY ** network,
	     DUL_ASSOCIATESERVICEPARAMETERS * service, unsigned long maxPDU,
		  CTNBOOLEAN forgiveFlag, DUL_ASSOCIATIONKEY ** association)
{
    CTNBOOLEAN
	drop,
	acceptFlag,
	acceptPresentationContext,
	readAccess,
	writeAccess;
    CONDITION
	cond,
	rtnCond = APP_NORMAL;
    DUL_PRESENTATIONCONTEXT
	* requestedCtx;
    int
        classCount;
    DUL_SC_ROLE
	scRole = DUL_SC_ROLE_DEFAULT;
    DUL_ABORTITEMS
	abortItems;
    DMAN_HANDLE
	* manageHandle;

    (void) memset(service, 0, sizeof(*service));
    service->maxPDU = maxPDU;
    strcpy(service->calledImplementationClassUID,
	   MIR_IMPLEMENTATIONCLASSUID);
    strcpy(service->calledImplementationVersionName,
	   MIR_IMPLEMENTATIONVERSIONNAME);
    cond = DUL_ReceiveAssociationRQ(network, DUL_BLOCK,
				    service, association);
    if (cond != DUL_NORMAL)
	return COND_PushCondition(APP_ERROR(APP_ASSOCIATIONRQFAILED));

    acceptFlag = TRUE;
    drop = FALSE;

    cond = DMAN_Open(controlDatabase, service->callingAPTitle,
		     service->calledAPTitle, &manageHandle);
    if (cond != DMAN_NORMAL) {
	acceptFlag = FALSE;
	rtnCond = COND_PushCondition(APP_ERROR(APP_ASSOCIATIONRQFAILED));
    }
    if (acceptFlag) {

	cond = associationCheck(node, service, &manageHandle, forgiveFlag,
				&abortItems);
	if (CTN_ERROR(cond)) {
	    acceptFlag = FALSE;
	    fprintf(stderr, "Incorrect Association Request\n");
	    (void) DUL_RejectAssociationRQ(association, &abortItems);
	    rtnCond = COND_PushCondition(APP_ERROR(APP_ASSOCIATIONRQFAILED));
	} else if (!CTN_SUCCESS(cond)) {
	    COND_DumpConditions();
	}
    }
    if (acceptFlag) {
	if (verboseDUL)
	    DUL_DumpParams(service);

	requestedCtx = LST_Head(&service->requestedPresentationContext);
	if (requestedCtx != NULL)
	    (void) LST_Position(&service->requestedPresentationContext,
				requestedCtx);
	classCount = 0;
	while (requestedCtx != NULL) {
	    int i;

	    acceptPresentationContext = FALSE;
	    for (i = 0; i < DIM_OF(supportedSOPClasses); i++) {
		if (strcmp(supportedSOPClasses[i], requestedCtx->abstractSyntax) == 0)
		    acceptPresentationContext = TRUE;
	    }
	    if (acceptPresentationContext) {
		switch (requestedCtx->proposedSCRole) {
		case DUL_SC_ROLE_DEFAULT:
		    scRole = DUL_SC_ROLE_DEFAULT;
		    break;
		case DUL_SC_ROLE_SCU:
		    scRole = DUL_SC_ROLE_SCU;
		    break;
		case DUL_SC_ROLE_SCP:
		    acceptPresentationContext = FALSE;
		    break;
		case DUL_SC_ROLE_SCUSCP:
		    scRole = DUL_SC_ROLE_SCU;
		    break;
		default:
		    scRole = DUL_SC_ROLE_DEFAULT;
		    break;
		}
	    }
	    if (acceptPresentationContext) {
		cond = SRV_AcceptServiceClass(requestedCtx, scRole,
					      service);
		if (cond == SRV_NORMAL) {
		    classCount++;
		} else {
		    printf("SRV Facility rejected SOP Class: %s\n",
			   requestedCtx->abstractSyntax);
		    COND_DumpConditions();
		}
	    } else {
		printf("Simple server rejects: %s\n",
		       requestedCtx->abstractSyntax);
		cond = SRV_RejectServiceClass(requestedCtx,
				     DUL_PRESENTATION_REJECT_USER, service);
		if (cond != SRV_NORMAL) {
		    drop = TRUE;
		}
	    }
	    requestedCtx = LST_Next(&service->requestedPresentationContext);
	}
	printf("Supported classes: %d\n", classCount);

	if (drop) {
	    (void) DUL_DropAssociation(association);
	    rtnCond = COND_PushCondition(APP_ERROR(APP_ASSOCIATIONRQFAILED));
	} else {
/*	    cond = DUL_AcknowledgeAssociationRQ(association, service);
	    if (cond != DUL_NORMAL) {
		rtnCond = COND_PushCondition(APP_ERROR(APP_ASSOCIATIONRQFAILED));
	    }
	    if (verboseDUL)
		DUL_DumpParams(service);
*/
	}
    }
    (void) DMAN_Close(&manageHandle);
    return rtnCond;
}
Esempio n. 18
0
static void handleSeriesQueries(DUL_ASSOCIATIONKEY** association,
				DUL_ASSOCIATESERVICEPARAMETERS* params,
				MSG_C_FIND_REQ* patientRequest,
				LST_HEAD* patientList,
				const char* queryLevel)
{
  ITEM* item;
  ITEM* studyItem;
  CONDITION cond;
  MSG_C_FIND_RESP response;

  item = (ITEM*)LST_Head(&patientList);
  (void)LST_Position(&patientList, item);
  while (item != 0) {
    char* patientName;
    char* patientID;
    char* studyInstanceUID;
    char* charSet;

    patientName = getString(item->obj, DCM_PATNAME);
    patientID = getString(item->obj, DCM_PATID);
    charSet = getString(patientRequest->identifier, DCM_IDSPECIFICCHARACTER);

    printf("%s %s\n", patientID, patientName);

    studyItem = (ITEM*)LST_Head(&item->lst);
    (void)LST_Position(&item->lst, studyItem);
    while (studyItem != NULL) {
      DCM_OBJECT* q;
      MSG_C_FIND_REQ seriesRequest;

      seriesRequest = *patientRequest;
      seriesRequest.identifier = 0;
      DCM_CreateObject(&q, 0);

      studyInstanceUID = getString(studyItem->obj, DCM_RELSTUDYINSTANCEUID);

      addString(q, DCM_PATID, patientID);
      addString(q, DCM_IDSPECIFICCHARACTER, charSet);
      addString(q, DCM_IDQUERYLEVEL, "SERIES");
      addString(q, DCM_RELSTUDYINSTANCEUID, studyInstanceUID);
      addString(q, DCM_IDMODALITY, "");
      addString(q, DCM_RELSERIESNUMBER, "");
      addString(q, DCM_ACQBODYPARTEXAMINED, "");
      addString(q, DCM_ACQVIEWPOSITION, "");

      seriesRequest.identifier = q;
      seriesRequest.messageID = SRV_MessageIDOut();

      studyItem->lst = LST_Create();

      cond = SRV_CFindRequest(association, params,
			      &seriesRequest, &response,
			      queryCallback, studyItem->lst, "");
      if (!(CTN_SUCCESS(cond))) {
	(void) printf("C-Find Request unsuccessful\n");
	COND_DumpConditions();
      } else {
	
      }

      studyItem = LST_Next(&item->lst);
    }
    item = LST_Next(&patientList);
  }
}
Esempio n. 19
0
/* exitApplication
**
** Purpose:
**	Exit the application in presence of some errors. Before exiting,
**	free all the handles which were allocated to the application
**
** Parameter Dictionary:
**	cond	The condition that caused the app to exit
**
** Return Values:
**	None
**
** Notes:
**
** Algorithm:
**	Description of the algorithm (optional) and any other notes.
*/
void
exitApplication(CONDITION cond)
{
    CONDITION
    rtnCond;

    fprintf(stderr, "Freeing all handles\n");
    /* free all handles here */
#ifdef ASG
    if (appHandles.gqID != -1) {
	rtnCond = kill_queue(appHandles.gqID);
	if (CTN_ERROR(rtnCond)) {
	    fprintf(stderr, "APP Error freeing generalized queue\n");
	    COND_DumpConditions();
	}
    }
#endif
    if (appHandles.network) {
	rtnCond = DUL_DropNetwork(&appHandles.network);
	if (CTN_ERROR(rtnCond)) {
	    fprintf(stderr, "APP Error freeing network key\n");
	    COND_DumpConditions();
	}
    }
    if (appHandles.association) {
	rtnCond = DUL_DropAssociation(&appHandles.association);
	if (CTN_ERROR(rtnCond)) {
	    fprintf(stderr, "APP Error freeing association key\n");
	    COND_DumpConditions();
	}
    }
    if (appHandles.service) {
	rtnCond = DUL_ClearServiceParameters(appHandles.service);
	if (CTN_ERROR(rtnCond)) {
	    fprintf(stderr, "APP Error clearing service parameters\n");
	    COND_DumpConditions();
	}
    }
    if (appHandles.processList) {
	PROCESS_ELEMENT
	    * e = NULL;
	e = LST_Head(&appHandles.processList);
	if (e != NULL)
	    (void) LST_Position(&appHandles.processList, e);
	while (e != NULL) {
	    free(e);
	    e = LST_Dequeue(&appHandles.processList);
	}
	rtnCond = LST_Destroy(&appHandles.processList);
	if (CTN_ERROR(rtnCond)) {
	    fprintf(stderr, "APP Error freeing Process List\n");
	    COND_DumpConditions();
	}
    }
    /* Now the final exit */
    if (CTN_ERROR(cond)) {
	fprintf(stderr, "\n\n");
	fprintf(stderr, "APP Abnormal Exit\n");
	COND_DumpConditions();
	fprintf(stderr, "\n\n");
	exit(1);		/* error exit status */
    }
    fprintf(stderr, "\n\n");
    exit(0);			/* normal exit */
}
Esempio n. 20
0
CONDITION
SRV_AcceptServiceClass(DUL_PRESENTATIONCONTEXT * requestedCtx, DUL_SC_ROLE role, DUL_ASSOCIATESERVICEPARAMETERS * params)
{
    int		        			index;
    CTNBOOLEAN					abstractFound = FALSE;
    CONDITION					cond, rtnCond = SRV_NORMAL;
    DUL_PRESENTATIONCONTEXT		* ctx;
    DUL_TRANSFERSYNTAX			* transfer;

    if (params->acceptedPresentationContext == NULL) {
    	params->acceptedPresentationContext = LST_Create();
    	if (params->acceptedPresentationContext == NULL) return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE), "SRV_AcceptServiceClass");
	}

    for (index = 0; index < (int) DIM_OF(syntaxList) && !abstractFound; index++) {
    	if (strcmp(requestedCtx->abstractSyntax, syntaxList[index]) == 0) abstractFound = TRUE;
	}

    if (abstractFound){
    	char* xferSyntaxes[] = { DICOM_TRANSFERLITTLEENDIAN };
    	transfer = matchProposedXferSyntax(requestedCtx, "ACCEPT/XFER", xferSyntaxes, 1);
    	if (transfer == NULL) {
    		cond = DUL_MakePresentationCtx(&ctx, requestedCtx->proposedSCRole, DUL_SC_ROLE_DEFAULT, requestedCtx->presentationContextID, DUL_PRESENTATION_REJECT_TRANSFER_SYNTAX,
										   requestedCtx->abstractSyntax, DICOM_TRANSFERLITTLEENDIAN, DICOM_TRANSFERLITTLEENDIAN, NULL);
    		if (cond != DUL_NORMAL)	return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_AcceptServiceClass");

    		(void) COND_PushCondition(SRV_UNSUPPORTEDSERVICE, SRV_Message(SRV_UNSUPPORTEDSERVICE), requestedCtx->abstractSyntax, "SRV_AcceptServiceClass");
    		rtnCond = COND_PushCondition(SRV_PRESENTATIONCTXREJECTED, SRV_Message(SRV_PRESENTATIONCTXREJECTED), requestedCtx->abstractSyntax, "SRV_AcceptServiceClass");
	} else {
			cond = DUL_MakePresentationCtx(&ctx, requestedCtx->proposedSCRole, role, requestedCtx->presentationContextID, DUL_PRESENTATION_ACCEPT,
										   requestedCtx->abstractSyntax, transfer->transferSyntax, transfer->transferSyntax, NULL);
			if (cond != DUL_NORMAL)	return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_AcceptServiceClass");
	}
#if 0
	if ((transfer = LST_Head(&requestedCtx->proposedTransferSyntax)) == NULL)
		return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE), "SRV_AcceptServiceClass");
		(void) LST_Position(&requestedCtx->proposedTransferSyntax, transfer);

		while (!transferFound && (transfer != NULL)) {
			if (strcmp(transfer->transferSyntax, DICOM_TRANSFERLITTLEENDIAN) == 0){
				transferFound = TRUE;
			}else{
				transfer = LST_Next(&requestedCtx->proposedTransferSyntax);
			}
		}
		if (transferFound) {
			cond = DUL_MakePresentationCtx(&ctx, requestedCtx->proposedSCRole, role, requestedCtx->presentationContextID, DUL_PRESENTATION_ACCEPT,
										   requestedCtx->abstractSyntax, DICOM_TRANSFERLITTLEENDIAN, DICOM_TRANSFERLITTLEENDIAN, NULL);
			if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_AcceptServiceClass");
		}else{
			cond = DUL_MakePresentationCtx(&ctx, requestedCtx->proposedSCRole, DUL_SC_ROLE_DEFAULT, requestedCtx->presentationContextID, DUL_PRESENTATION_REJECT_TRANSFER_SYNTAX,
										   requestedCtx->abstractSyntax, DICOM_TRANSFERLITTLEENDIAN, DICOM_TRANSFERLITTLEENDIAN, NULL);
			if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_AcceptServiceClass");

			(void) COND_PushCondition(SRV_UNSUPPORTEDTRANSFERSYNTAX, SRV_Message(SRV_UNSUPPORTEDTRANSFERSYNTAX), requestedCtx->abstractSyntax, "SRV_AcceptServiceClass");
			rtnCond = COND_PushCondition(SRV_PRESENTATIONCTXREJECTED, SRV_Message(SRV_PRESENTATIONCTXREJECTED), requestedCtx->abstractSyntax, "SRV_AcceptServiceClass");
		}
#endif
    }else{
    	cond = DUL_MakePresentationCtx(&ctx, requestedCtx->proposedSCRole, DUL_SC_ROLE_DEFAULT, requestedCtx->presentationContextID, DUL_PRESENTATION_REJECT_ABSTRACT_SYNTAX,
									   requestedCtx->abstractSyntax, DICOM_TRANSFERLITTLEENDIAN, DICOM_TRANSFERLITTLEENDIAN, NULL);
    	if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_AcceptServiceClass");

    	(void) COND_PushCondition(SRV_UNSUPPORTEDSERVICE, SRV_Message(SRV_UNSUPPORTEDSERVICE), requestedCtx->abstractSyntax, "SRV_AcceptServiceClass");
    	rtnCond = COND_PushCondition(SRV_PRESENTATIONCTXREJECTED, SRV_Message(SRV_PRESENTATIONCTXREJECTED), requestedCtx->abstractSyntax, "SRV_AcceptServiceClass");
    }
    cond = LST_Enqueue(&params->acceptedPresentationContext, ctx);
    if (cond != LST_NORMAL)	return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE), "SRV_AcceptServiceClass");

/*    pdvList.count = 0; */

    return rtnCond;
}
Esempio n. 21
0
static void
iterateThroughElements(DCM_OBJECT** obj, size_t NL)
{
  CONDITION cond;
  DCM_ELEMENT	*e;
	DCM_SEQUENCE_ITEM *sq;

  cond = DCM_GetFirstElement(obj, &e);
  if (cond != DCM_NORMAL) {
    COND_DumpConditions();
    return;
  }

	if(e->representation == DCM_SQ){
		indentXML(NL);
		startXMLTag(e, NL);
		printf("\n");
		sq = (DCM_SEQUENCE_ITEM*)LST_Head(&e->d.sq);
		if (sq != NULL)
			(void)LST_Position(&e->d.sq, sq);

		while (sq != NULL) {
			iterateThroughElements(&sq->object, NL+1);
			sq = (DCM_SEQUENCE_ITEM*)LST_Next(&e->d.sq);
		}

		indentXML(NL);
		endXMLTag(e);
		printf("\n");
	}
	else{
		startXMLTag(e, NL);
		dumpElement(e);
		endXMLTag(e);
		printf("\n");
	}

  while (cond == DCM_NORMAL) {
    cond = DCM_GetNextElement(obj, &e);
    if (cond == DCM_NORMAL) {
			if(e->representation == DCM_SQ){
				indentXML(NL);
				startXMLTag(e, NL);
				printf("\n");
				sq = (DCM_SEQUENCE_ITEM*)LST_Head(&e->d.sq);
				if (sq != NULL)
					(void)LST_Position(&e->d.sq, sq);

				while (sq != NULL) {
					iterateThroughElements(&sq->object, NL+1);
					sq = (DCM_SEQUENCE_ITEM*)LST_Next(&e->d.sq);
				}

				indentXML(NL);
				endXMLTag(e);
				printf("\n");
			}
			else{
				startXMLTag(e, NL);
				dumpElement(e);
				endXMLTag(e);
				printf("\n");
			}
    }
  }
  if (cond != DCM_GETNEXTELEMENTCOMPLETE) {
    fprintf(stderr, "Unable to get all elements\n");
  }
}
Esempio n. 22
0
static CONDITION
getPatientRecord(PRIVATE_HANDLE * h,
   FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList,
		 FIS_PATIENTRECORD * r, long *count)
{
    CONDITION
    cond;
    TBL_CRITERIA
	criteria[2];
    FIS_PATIENTRECORD
	* p;

    static TBL_FIELD fields[] = {
	{"PatID", TBL_STRING, sizeof(patient.PatID), sizeof(patient.PatID),
	0, (void *) &patient.PatID[0]},
	{"PatUID", TBL_STRING, sizeof(patient.PatUID), sizeof(patient.PatUID),
	0, (void *) &patient.PatUID[0]},
	{"PatNam", TBL_STRING, sizeof(patient.PatNam), sizeof(patient.PatNam),
	0, (void *) &patient.PatNam[0]},
	{"PatSex", TBL_STRING, sizeof(patient.PatSex), sizeof(patient.PatSex),
	0, (void *) &patient.PatSex[0]},
	{"PatBirDat", TBL_SIGNED4, sizeof(patientBD), sizeof(patientBD),
	0, (void *) &patientBD},
	{NULL},
    };

    criteria[0].FieldName = criteria[1].FieldName = NULL;
    if (uid != NULL) {
	if (uid[0] != '\0') {
	    TBL_CRITERIA_LOAD_BYTE(criteria[0], "PatUID", uid, TBL_STRING, TBL_EQUAL);
	}
    }
    memset(&patient, 0, sizeof(patient));
    patient.Type = FIS_K_PATIENT;
    cond = TBL_Select(&h->patientHandle, criteria, fields, count, patientCallback,
		      getList);
    if (cond != TBL_NORMAL)
	return COND_PushCondition(FIS_COND(FIS_PATIENTGETFAILED),
				  "(FIS)getPatientRecord");

    if (r != NULL)
	*r = patient;

    if (listFlag & FIS_K_PAT_STUDYLIST) {
	if (getList != NULL) {
	    p = LST_Head(&getList);
	    (void) LST_Position(&getList, p);
	} else
	    p = r;
	while (p != NULL) {
	    p->StudyList = LST_Create();
	    p->Flag |= FIS_K_PAT_STUDYLIST;
	    cond = getStudyRecord(h, FIS_K_PATIENT, p->PatUID, 0, p->StudyList, NULL, NULL);
	    if (cond != FIS_NORMAL)
		return cond;
	    if (getList != NULL)
		p = LST_Next(&getList);
	    else
		p = NULL;
	}
    }
/*
    if (listFlag & FIS_K_PAT_VISITLIST) {
	if (getList != NULL) {
	    p = LST_Head(&getList);
	    (void) LST_Position(&getList, p);
	} else
	    p = r;
	while (p != NULL) {
	    p->VisitList = LST_Create();
	    p->Flag |= FIS_K_PAT_VISITLIST;
	    cond = getVisitRecord(h, FIS_K_PATIENT, p->PatUID, 0, p->VisitList, NULL, NULL);
	    if (cond != FIS_NORMAL)
		return cond;
	    if (getList != NULL)
		p = LST_Next(&getList);
	    else
		p = NULL;
	}
    }
*/
    return FIS_NORMAL;
}
Esempio n. 23
0
File: set.c Progetto: nagyistge/ctn
/* nsetImageBoxCallback
**
** Purpose:
**	Call back routine called by SRV_NSetResponse used to build the
**	N-SET response message.
**
** Parameter Dictionary:
**	nsetRequest	Pointer to N-SET Request message
**	nsetResponse	Pointer to N-SET Response message
**	ctx		Pointer to context for this command.
**	pc		Presentation context that describes this SOP Class
**
** Return Values:
**	SRV_NORMAL under error free conditions.
**
**	SRV_CALLBACKABORTEDSERVICE
**	SRV_NORMAL
**
** Algorithm:
**	Description of the algorithm (optional) and any other notes.
*/
static CONDITION
nsetImageBoxCallback(MSG_N_SET_REQ * nsetRequest,
		     MSG_N_SET_RESP * nsetResponse,
		     void *sendBack, DUL_PRESENTATIONCONTEXT * pc)
{

    CONDITION
    cond;			/* condition code returned by various
				 * facilities */
    int
        index;			/* loop index */
    char
       *flagNameList = NULL;	/* holds attribute names that gave errors
				 * during verification process */
    BIB_NODE
	* bibNode;		/* pointer to instance of Image Box */
    char
       *fileName;		/* filename holding attributes of image */
    GQ_ELEM
	gqElement;		/* The GQ element that is to be enqueued */
    PRN_BASICIMAGEBOX
	bibAttrib,		/* structure holding attributes of image box */
	*bibPtr;		/* pointer to the above structure */
    CTNBOOLEAN
	flag = FALSE;		/* to check if the image is present */

    /*
     * For Image Position, we do a runtime check depending on the value of
     * Image Display Format specified by the Film Box attribute.
     */

    /* Now define a table of all supported attributes */
    static SUPPORTEDATTRIBUTES supportedAttributeList[] = {
	{PRN_BIB_K_IMAGEPOSITION, "BIB Image Position ", NULL, 0},
	{PRN_BIB_K_IMAGEMODULE, "BIB Preformatted Image Sequence ",
	NULL, 0},
	{PRN_BIB_K_POLARITY, "BIB Polarity ", bibPolarity,
	(int) DIM_OF(bibPolarity)},
	{PRN_BIB_K_MAGNIFICATIONTYPE, "BIB Magnification type ",
	bibMagnificationType, (int) DIM_OF(bibMagnificationType)},
#ifdef ASG
	{PRN_BIB_K_SMOOTHINGTYPE, "BIB Smooothing Type ",
	bibSmoothingType, (int) DIM_OF(bibSmoothingType)},
	{PRN_BIB_K_REQUESTEDIMAGESIZE, "BIB Requested Image Size ",
	bibRequestedImageSize, (int) DIM_OF(bibRequestedImageSize)}
#endif
    };

    /* we now build up the response message */
    nsetResponse->type = MSG_K_N_SET_RESP;
    nsetResponse->messageIDRespondedTo = nsetRequest->messageID;
    strcpy(nsetResponse->classUID, nsetRequest->classUID);
    strcpy(nsetResponse->instanceUID, nsetRequest->instanceUID);

    /* default */
    nsetResponse->dataSetType = DCM_CMDDATANULL;
#ifdef ASG
    nsetResponse->dataSet = NULL;	/* no data set is sent */
#endif

    bibPtr = &bibAttrib;
    bibPtr->bibAttributeFlag = 0x0;
    (void) strcpy(bibPtr->imageBoxSOPClassUID, nsetRequest->classUID);
    (void) strcpy(bibPtr->imageBoxSOPInstanceUID, nsetRequest->instanceUID);
    /* Parse the data set sent by the SCU */
    cond = PRN_ParseObject(&nsetRequest->dataSet, PRN_K_BASICGREYSCALEIMAGEBOX,
			   (void **) &bibPtr);
    if (cond != PRN_NORMAL) {
	cond = COND_PushCondition(APP_ERROR(APP_FAILURE), "PRN_ParseObject",
				  "nsetImageBoxCallback");
	updateOnProcessingFailure((void **) &nsetResponse,
				  APP_ERROR(APP_FAILURE), "PRN_ParseObject",
				  "nsetImageBoxCallback");
	goto ERROR_RETURN;
    }
    /* PRN_DumpAttributes(bibPtr, stdout); */
    cond = supportedAttributes(MSG_K_N_SET_REQ, bibPtr, supportedAttributeList,
			(int) DIM_OF(supportedAttributeList), &flagNameList,
			       (void **) &nsetResponse);
    if (cond != APP_NORMAL) {
	switch (cond) {
	case APP_MISSINGREQUIREDATTRIBUTE:
	    nsetResponse->status = MSG_K_MISSINGATTRIBUTE;
	    break;
	case APP_UNSUPPORTEDMANDATORYATTRIBUTE:
	case APP_UNSUPPORTEDOPTIONALATTRIBUTE:
	    nsetResponse->status = MSG_K_NOSUCHATTRIBUTE;
	    break;
	case APP_UNSUPPORTEDATTRIBUTEVALUE:
	    nsetResponse->status = MSG_K_INVALIDATTRIBUTEVALUE;
	    break;
	}
	cond = COND_PushCondition(APP_ERROR(cond), flagNameList,
				  "nsetImageBoxCallback");
	goto ERROR_RETURN;
    }
    /*
     * Now we update the hierarchy. We note here that attributes are set for
     * the image boxes belonging to the current BASIC FILM BOX instance which
     * is given by bfbInstance
     */
    bibNode = (BIB_NODE *) LST_Position(&bfbInstance->bibList,
					LST_Head(&bfbInstance->bibList));
    if (bibNode == NULL) {
	cond = COND_PushCondition(APP_ERROR(APP_MISSINGIMAGES),
				  "nsetImageBoxCallback");
	updateOnProcessingFailure((void **) &nsetResponse,
		      APP_ERROR(APP_MISSINGIMAGES), "nsetImageBoxCallback");
	goto ERROR_RETURN;
    }
    flag = FALSE;
    /*
     * go thru the list of Image SOP instance UIDs maintained by the Film Box
     * instance
     */
    for (index = 0; index < (int) LST_Count(&bfbInstance->bibList)
	 && !flag; index++) {
	/* now see if the instance UID matches */
	if (strcmp(nsetRequest->instanceUID, bibNode->bibInstanceUID) == 0) {
	    flag = TRUE;
	}
	if (!flag)
	    bibNode = (BIB_NODE *) LST_Next(&bfbInstance->bibList);
    }
    if (flag == FALSE) {
	cond = COND_PushCondition(APP_ERROR(APP_NOSUCHINSTANCE),
			  nsetRequest->instanceUID, "nsetImageBoxCallback");
	nsetResponse->status = MSG_K_NOSUCHOBJECTINSTANCE;
	goto ERROR_RETURN;
    }
    /* we now store the attributes of the image box */
    /*
     * To avoid copying so much data, we just make a pointer point to the
     * dataSet
     */
    bibNode->bibAttrib = nsetRequest->dataSet;
    nsetRequest->dataSet = NULL;/* remove the data set from the request
				 * message */

    /*
     * If the server's terminal has x-capability and wishes to enqueue the
     * image in the GQueue
     */
    if (gqueueFlag) {
	gqElement.prnMessage = PRN_NEWIMAGEBOX;
	(void) strcpy(gqElement.instanceUID, bibNode->bibInstanceUID);
	/* get a new file name to store the object */
	fileName = getNewFileName();
	(void) strcpy(gqElement.objFile, fileName);

	/* now write the object into the file and enqueue it */
	cond = DCM_WriteFile(&bibNode->bibAttrib, DCM_ORDERLITTLEENDIAN,
			     fileName);
	if (cond != DCM_NORMAL) {
	    unlink(gqElement.objFile);	/* delete the file before exiting */
	    cond = COND_PushCondition(APP_ERROR(APP_FAILURE),
				   "DCM_WriteFile", "nsetImageBoxCallback");
	    updateOnProcessingFailure((void **) &nsetResponse,
				    APP_ERROR(APP_FAILURE), "DCM_WriteFile",
				      "nsetImageBoxCallback");
	    goto ERROR_RETURN;
	}
	cond = GQ_Enqueue(gqID, (void *) &gqElement);
	if (cond != GQ_NORMAL) {
	    unlink(gqElement.objFile);
	    cond = COND_PushCondition(APP_ERROR(APP_FAILURE),
				      "GQ_Enqueue", "nsetImageBoxCallback");
	    updateOnProcessingFailure((void **) &nsetResponse,
				      APP_ERROR(APP_FAILURE), "GQ_Enqueue",
				      "nsetImageBoxCallback");
	    goto ERROR_RETURN;
	}
    }
    /* send attributes back, but do not send back the image pixel data */
    /* temporarily we reset the FLAG for the pixel data */
    nsetResponse->dataSetType = DCM_CMDDATAOTHER;
    bibPtr->bibAttributeFlag ^= PRN_BIB_K_IMAGEMODULE;
    cond = PRN_BuildObject((void *) bibPtr, &nsetResponse->dataSet);
    if (cond != PRN_NORMAL) {
	cond = COND_PushCondition(APP_ERROR(APP_FAILURE),
				  "PRN_BuildObject", "nsetImageBoxCallback");
	updateOnProcessingFailure((void **) &nsetResponse,
				  APP_ERROR(APP_FAILURE), "PRN_BuildObject",
				  "nsetImageBoxCallback");
	goto ERROR_RETURN;
    }
    /* set back the FLAG */
    bibPtr->bibAttributeFlag |= PRN_BIB_K_IMAGEMODULE;
    /* everything is successful */
    nsetResponse->status = MSG_K_SUCCESS;
    return SRV_NORMAL;

ERROR_RETURN:
    COND_DumpConditions();
    return SRV_CALLBACKABORTEDSERVICE;
}
Esempio n. 24
0
static CONDITION
getStudyComponentRecord(PRIVATE_HANDLE * h,
   FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList,
			FIS_STUDYCOMPONENTRECORD * r, long *count)
{
    CONDITION cond;
    TBL_CRITERIA criteria[2];
    FIS_STUDYCOMPONENTRECORD *p;

    static TBL_FIELD fields[] = {
	{TBL_FIELD_STRING("StuComUID", studyComponent.StuComUID)},
	{TBL_FIELD_STRING("StuInsUID", studyComponent.StuInsUID)},
	{TBL_FIELD_STRING("Mod", studyComponent.Mod)},
	{TBL_FIELD_STRING("StuDes", studyComponent.StuDes)},
	{TBL_FIELD_STRING("ProCodVal", studyComponent.ProCodVal)},
	{TBL_FIELD_STRING("ProCodSchDes", studyComponent.ProCodSchDes)},
	{TBL_FIELD_STRING("ProCodMea", studyComponent.ProCodMea)},
	{TBL_FIELD_STRING("StuComStaID", studyComponent.StuComStaID)},
	{TBL_FIELD_STRING("StuID", studyComponent.StuID)},
	{NULL},
    };

    criteria[0].FieldName = criteria[1].FieldName = NULL;
    if (uid != NULL) {
	if (uid[0] != '\0') {
	    if (criteriaType == FIS_K_STUDY) {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "StuInsUID", uid, TBL_STRING, TBL_EQUAL);
	    } else {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "StuComUID", uid, TBL_STRING, TBL_EQUAL);
	    }
	}
    }
    (void) memset(&studyComponent, 0, sizeof(studyComponent));
    studyComponent.Type = FIS_K_STUDYCOMPONENT;
    cond = TBL_Select(&h->studyComponentHandle, criteria, fields, count,
		      studyComponentCallback, getList);
    if (cond != TBL_NORMAL)
	return COND_PushCondition(FIS_COND(FIS_STUDYGETFAILED),
				  "(FIS)getStudyRecord");

    if (r != NULL)
	*r = studyComponent;

    if (listFlag & FIS_K_STUDYCOMP_SERIESLIST) {
	if (getList != NULL) {
	    p = LST_Head(&getList);
	    (void) LST_Position(&getList, p);
	} else
	    p = r;
	while (p != NULL) {
	    p->SeriesList = LST_Create();
	    p->Flag |= FIS_K_STUDYCOMP_SERIESLIST;
	    cond = getSCSeriesRecord(h, FIS_K_STUDYCOMPONENT, p->StuComUID,
				     FIS_K_SCSERIES_IMAGELIST, p->SeriesList,
				     NULL, NULL);
	    if (cond != FIS_NORMAL)
		return cond;
	    if (getList != NULL)
		p = LST_Next(&getList);
	    else
		p = NULL;
	}
    }
    return FIS_NORMAL;
}
Esempio n. 25
0
int
v_parseSequence(DCM_OBJECT ** object)
{

    DCM_ELEMENT e;
    LST_HEAD *l;
    CONDITION cond;
    int index;
    SQ_TYPE type;
    SQ_REFPATIENTSOPINSTANCEUID *patient;
    SQ_REFSTUDYSOPINSTANCEUID *study;
    SQ_REQPROCEDURECODE *code;
    void *pointer;

    static DCM_MAP_SQ sequences[] = {
	{DCM_IDREFERENCEDPATIENTSEQ, SQ_K_REFPATIENTSOPINSTANCEUID,
	HIS_K_VISRPSEQUENCE},
	{DCM_IDREFERENCEDSTUDYSEQ, SQ_K_REFSTUDYSOPINSTANCEUID,
	HIS_K_VISRSSEQUENCE},
	{DCM_IDADMITDIAGCODESEQUENCE, SQ_K_ADMITDIAGNOSISCODE,
	HIS_K_VISADCSEQUENCE},
	{DCM_VISDISCHARGEDIAGNOSISCODESEQ, SQ_K_DISCHARGEDIAGNOSISCODE,
	HIS_K_VISDDCSEQUENCE},
    };

    for (index = 0; index < (int) DIM_OF(sequences); index++) {
	e.tag = sequences[index].tag;
	cond = DCM_GetSequenceList(object, e.tag, &e.d.sq);
	if (cond != DCM_NORMAL) {
	    if (cond != DCM_ELEMENTNOTFOUND)
		return -1;
	} else {
	    cond = SQ_ParseSequence(&e, &type, &l);
	    if (cond != SQ_NORMAL || type != sequences[index].type)
		return -2;
	    p.Update_Flag |= sequences[index].his_field;
	    pointer = LST_Head(&l);
	    if (pointer != NULL)
		LST_Position(&l, pointer);
	    while (pointer != NULL) {
		switch (sequences[index].tag) {
		case DCM_IDREFERENCEDPATIENTSEQ:
		    patient = (SQ_REFPATIENTSOPINSTANCEUID *) pointer;
		    strcpy(p.RPSequence[p.RPSequenceCount],
			   patient->referencedSOPInstanceUID);
		    ++p.RPSequenceCount;
		    break;
		case DCM_IDREFERENCEDSTUDYSEQ:
		    study = (SQ_REFSTUDYSOPINSTANCEUID *) pointer;
		    strcpy(p.RSSequence[p.RSSequenceCount],
			   study->referencedSOPInstanceUID);
		    ++p.RSSequenceCount;
		    break;
		case DCM_IDADMITDIAGCODESEQUENCE:
		    code = (SQ_REQPROCEDURECODE *) pointer;
		    strcpy(p.ADCSequence[p.ADCSequenceCount].CodeValue,
			   code->codeValue);
		    strcpy(p.ADCSequence[p.ADCSequenceCount].
		      CodingSchemeDesignator, code->codingSchemeDesignator);
		    strcpy(p.ADCSequence[p.ADCSequenceCount].CodeMeaning,
			   code->codeMeaning);
		    p.ADCSequenceCount++;
		    break;
		case DCM_VISDISCHARGEDIAGNOSISCODESEQ:
		    code = (SQ_REQPROCEDURECODE *) pointer;
		    strcpy(p.DDCSequence[p.DDCSequenceCount].CodeValue,
			   code->codeValue);
		    strcpy(p.DDCSequence[p.DDCSequenceCount].
		      CodingSchemeDesignator, code->codingSchemeDesignator);
		    strcpy(p.DDCSequence[p.DDCSequenceCount].CodeMeaning,
			   code->codeMeaning);
		    p.DDCSequenceCount++;
		    break;
		}
		pointer = LST_Next(&l);
	    }
	}
    }
    return 0;

/*
    e[0].tag = DCM_IDREFERENCEDPATIENTSEQ;
    e[1].tag = DCM_IDREFERENCEDSTUDYSEQ;

    for (index = 0; index < (int) DIM_OF(e); index++) {
	cond = DCM_GetSequenceList(object, e[index].tag, &e[index].d.sq);
	if (cond == DCM_ELEMENTNOTFOUND)
	    continue;
	else if (cond != DCM_NORMAL)
	    return -1;

	cond = SQ_ParseSequence(&e[index], &type, &l);
	if (cond != SQ_NORMAL)
	    return -2;

	if (type == SQ_K_REFPATIENTSOPINSTANCEUID) {
	    p.Update_Flag |= HIS_K_VISRPSEQUENCE;
	    patient = LST_Head(&l);
	    if (patient != NULL)
		LST_Position(&l, patient);
	    while (patient != NULL) {
		strcpy(p.RPSequence[p.RPSequenceCount],
		       patient->referencedSOPInstanceUID);
		++p.RPSequenceCount;
		patient = LST_Next(&l);
	    }
	}
	if (type == SQ_K_REFSTUDYSOPINSTANCEUID) {
	    p.Update_Flag |= HIS_K_VISRSSEQUENCE;
	    study = LST_Head(&l);
	    if (study != NULL)
		LST_Position(&l, study);
	    while (study != NULL) {
		strcpy(p.RSSequence[p.RSSequenceCount],
		       study->referencedSOPInstanceUID);
		++p.RSSequenceCount;
		study = LST_Next(&l);
	    }
	}
    }

    return 0;
*/
}
Esempio n. 26
0
static CONDITION
getResultsRecord(PRIVATE_HANDLE * h,
   FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList,
		 FIS_RESULTSRECORD * r, long *count)
{
    CONDITION cond;
    TBL_CRITERIA criteria[2];
    FIS_RESULTSRECORD *p;

    static TBL_FIELD fields[] = {
	{"ResUID", TBL_STRING, sizeof(results.ResUID), sizeof(results.ResUID),
	0, (void *) &results.ResUID[0]},
	{"StuInsUID", TBL_STRING, sizeof(results.StuInsUID),
	sizeof(results.StuInsUID), 0, (void *) &results.StuInsUID[0]},
	{"ResID", TBL_STRING, sizeof(results.ResID), sizeof(results.ResID),
	0, (void *) &results.ResID[0]},
	{"Imp", TBL_TEXT, sizeof(results.Imp), sizeof(results.Imp),
	0, (void *) &results.Imp[0]},
	{"InsCreDat", TBL_STRING, sizeof(results.InsCreDat),
	sizeof(results.InsCreDat), 0, (void *) &results.InsCreDat[0]},
	{"InsCreTim", TBL_STRING, sizeof(results.InsCreTim),
	sizeof(results.InsCreTim), 0, (void *) &results.InsCreTim[0]},
	{"InsCreUID", TBL_STRING, sizeof(results.InsCreUID),
	sizeof(results.InsCreUID), 0, (void *) &results.InsCreUID},
	{NULL}
    };

    criteria[0].FieldName = criteria[1].FieldName = NULL;
    if (uid != NULL) {
	if (uid[0] != '\0') {
	    if (criteriaType == FIS_K_STUDY) {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "StuInsUID", uid, TBL_STRING, TBL_EQUAL);
	    } else {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "ResUID", uid, TBL_STRING, TBL_EQUAL);
	    }
	}
    }
    (void) memset(&results, 0, sizeof(results));
    results.Type = FIS_K_RESULTS;
    cond = TBL_Select(&h->resultsHandle, criteria, fields, count,
		      resultsCallback, getList);
    if (cond != TBL_NORMAL)
	return FIS_GETFAILED;

    if (r != NULL)
	*r = results;

    if (listFlag & FIS_K_RESULTS_INTERPRETATIONLIST) {
	if (getList != NULL) {
	    p = LST_Head(&getList);
	    (void) LST_Position(&getList, p);
	} else
	    p = r;
	while (p != NULL) {
	    p->InterpretationList = LST_Create();
	    p->Flag |= FIS_K_RESULTS_INTERPRETATIONLIST;
	    cond = getInterpretationRecord(h, FIS_K_RESULTS, p->ResUID,
				      0, p->InterpretationList, NULL, NULL);
	    if (cond != FIS_NORMAL)
		return cond;

	    if (getList != NULL)
		p = LST_Next(&getList);
	    else
		p = NULL;
	}
    }
    return FIS_NORMAL;
}
Esempio n. 27
0
CONDITION
serviceRequests(DUL_NETWORKKEY ** network, DUL_ASSOCIATIONKEY ** association,
		DUL_ASSOCIATESERVICEPARAMETERS * service)
{
    CONDITION
	cond;
    DUL_PRESENTATIONCONTEXT
	* ctx;
    DUL_PRESENTATIONCONTEXTID
	ctxID;
    void
       *message;
    MSG_TYPE
	messageType;
    CTNBOOLEAN
	networkLink = TRUE,
	commandServiced;
    DMAN_HANDLE
	* handle;
    DMAN_STORAGEACCESS
	storage;
    DMAN_FISACCESS fisAccess;

    cond = DMAN_Open(controlDatabase, service->callingAPTitle,
		     service->calledAPTitle, &handle);

    if (cond == DMAN_NORMAL) {
	cond = DMAN_LookupStorage(&handle, service->calledAPTitle,
				  &storage);
    }
    if (cond == DMAN_NORMAL)
	cond = IDB_Open(storage.DbKey, &IDBHandle);

    if (!CTN_ERROR(cond)) {
	cond = DMAN_LookupFISAccess(&handle, service->calledAPTitle, &fisAccess);
	if (!CTN_ERROR(cond))
	    cond = FIS_Open(fisAccess.DbKey, &fisHandle);
    }
    while ((networkLink == TRUE) && !CTN_ERROR(cond)) {
	cond = SRV_ReceiveCommand(association, service, DUL_BLOCK, 0, &ctxID,
				  NULL, &messageType, &message);
	if (cond == SRV_PEERREQUESTEDRELEASE) {
	    networkLink = FALSE;
	    (void) DUL_AcknowledgeRelease(association);
	    (void) DUL_DropAssociation(association);
	} else if (cond == SRV_PEERABORTEDASSOCIATION) {
	    networkLink = FALSE;
	    (void) DUL_DropAssociation(association);
	} else if (cond != SRV_NORMAL) {
	    (void) DUL_DropAssociation(association);
	    COND_DumpConditions();
	    cond = 2;
	} else {
	    ctx = LST_Head(&service->acceptedPresentationContext);
	    if (ctx != NULL)
		(void) LST_Position(&service->acceptedPresentationContext, ctx);
	    commandServiced = FALSE;
	    while (ctx != NULL && !commandServiced) {
		if (ctx->presentationContextID == ctxID) {
		    if (commandServiced) {
			if (!silent)
			    fprintf(stderr,
			      "Context ID Repeat in serviceRequests (%d)\n",
				    ctxID);
		    } else {
			cond = serviceThisCommand(network, association, ctx,
					     messageType, &message, service,
						  &handle);
			if (cond == SRV_OPERATIONCANCELLED) {
			    if (!silent)
				printf("Operation cancelled\n");
			    (void) COND_PopCondition(TRUE);
			} else if (cond != SRV_NORMAL)
			    COND_DumpConditions();
			commandServiced = TRUE;
		    }
		}
		ctx = LST_Next(&service->acceptedPresentationContext);
	    }
	    if (!commandServiced) {
		fprintf(stderr, "In serviceRequests, context ID %d not found\n",
			ctxID);
		(void) DUL_DropAssociation(association);
		networkLink = FALSE;
	    }
	}
    }
    (void) DMAN_Close(&handle);
    (void) IDB_Close(&IDBHandle);
    return cond;
}
Esempio n. 28
0
int
r_parseSequence(DCM_OBJECT ** object)
{

    DCM_ELEMENT e;
    LST_HEAD *l;
    CONDITION cond;
    int index;
    SQ_TYPE type;
    SQ_REFINTERPRETATIONSOPINSTANCEUID *interp;
    SQ_REFSTUDYSOPINSTANCEUID *study;
    void *pointer;

    static DCM_MAP_SQ sequences[] = {
	{DCM_IDREFERENCEDSTUDYSEQ, SQ_K_REFSTUDYSOPINSTANCEUID,
	HIS_K_RESRSSEQUENCE},
	{DCM_RESREFERENCEDINTERPSEQ, SQ_K_REFINTERPRETATIONSOPINSTANCEUID,
	HIS_K_RESRISEQUENCE},
    };

    for (index = 0; index < (int) DIM_OF(sequences); index++) {
	e.tag = sequences[index].tag;
	cond = DCM_GetSequenceList(object, e.tag, &e.d.sq);
	if (cond != DCM_NORMAL) {
	    if (cond != DCM_ELEMENTNOTFOUND)
		return -1;
	} else {
	    cond = SQ_ParseSequence(&e, &type, &l);
	    if (cond != SQ_NORMAL || type != sequences[index].type)
		return -2;
	    p.Update_Flag |= sequences[index].his_field;
	    pointer = LST_Head(&l);
	    if (pointer != NULL)
		LST_Position(&l, pointer);
	    while (pointer != NULL) {
		switch (sequences[index].tag) {
		case DCM_IDREFERENCEDSTUDYSEQ:
		    study = (SQ_REFSTUDYSOPINSTANCEUID *) pointer;
		    strcpy(p.RSSequence[p.RSSequenceCount],
			   study->referencedSOPInstanceUID);
		    ++p.RSSequenceCount;
		    break;
		case DCM_RESREFERENCEDINTERPSEQ:
		    interp = (SQ_REFINTERPRETATIONSOPINSTANCEUID *) pointer;
		    strcpy(p.RISequence[p.RISequenceCount],
			   interp->referencedSOPInstanceUID);
		    ++p.RISequenceCount;
		    break;
		}
		pointer = LST_Next(&l);
	    }
	}
    }
    return 0;
/*
    e[0].tag = DCM_RESREFERENCEDINTERPSEQ;
    e[1].tag = DCM_IDREFERENCEDSTUDYSEQ;

    for (index = 0; index < (int) DIM_OF(e); index++) {
	cond = DCM_GetSequenceList(object, e[index].tag, &e[index].d.sq);
	if (cond == DCM_ELEMENTNOTFOUND)
	    continue;
	else if (cond != DCM_NORMAL)
	    return -1;

	cond = SQ_ParseSequence(&e[index], &type, &l);
	if (cond != SQ_NORMAL)
	    return -2;

	if (type == SQ_K_REFINTERPRETATIONSOPINSTANCEUID) {
	    p.Update_Flag |= HIS_K_RESRISEQUENCE;
	    interp = LST_Head(&l);
	    if (interp != NULL)
		LST_Position(&l, interp);
	    while (interp != NULL) {
		strcpy(p.RISequence[p.RISequenceCount],
		       interp->referencedSOPInstanceUID);
		++p.RISequenceCount;
		interp = LST_Next(&l);
	    }
	}
	if (type == SQ_K_REFSTUDYSOPINSTANCEUID) {
	    p.Update_Flag |= HIS_K_RESRSSEQUENCE;
	    study = LST_Head(&l);
	    if (study != NULL)
		LST_Position(&l, study);
	    while (study != NULL) {
		strcpy(p.RSSequence[p.RSSequenceCount],
		       study->referencedSOPInstanceUID);
		++p.RSSequenceCount;
		study = LST_Next(&l);
	    }
	}
    }

    return 0;
*/
}
Esempio n. 29
0
int
i_parseSequence(DCM_OBJECT ** object)
{

    DCM_ELEMENT e;
    LST_HEAD *l;
    CONDITION cond;
    int index;
    SQ_TYPE type;
    SQ_REFRESULTSSOPINSTANCEUID *results;
    SQ_REQINTERPRETATIONAPPROVER *approver;
    SQ_REQPROCEDURECODE *diagnosis;
    void *pointer;

    static DCM_MAP_SQ sequences[] = {
	{DCM_IDREFERENCEDRESULTSSEQ, SQ_K_REFRESULTSSOPINSTANCEUID,
	HIS_K_INTRRSEQUENCE},
	{DCM_RESINTERPAPPROVERSEQUENCE, SQ_K_REQINTERPRETATIONAPPROVER,
	HIS_K_INTIAPPSEQUENCE},
	{DCM_RESDIAGNOSISCODESEQ, SQ_K_REQDIAGNOSISCODE,
	HIS_K_INTIDCSEQUENCE},
    };

    for (index = 0; index < (int) DIM_OF(sequences); index++) {
	e.tag = sequences[index].tag;
	cond = DCM_GetSequenceList(object, e.tag, &e.d.sq);
	if (cond != DCM_NORMAL) {
	    if (cond != DCM_ELEMENTNOTFOUND)
		return -1;
	} else {
	    cond = SQ_ParseSequence(&e, &type, &l);
	    if (cond != SQ_NORMAL || type != sequences[index].type)
		return -2;
	    p.Update_Flag |= sequences[index].his_field;
	    pointer = LST_Head(&l);
	    if (pointer != NULL)
		LST_Position(&l, pointer);
	    while (pointer != NULL) {
		switch (sequences[index].tag) {
		case DCM_IDREFERENCEDRESULTSSEQ:
		    strcpy(p.RRSequence[p.RRSequenceCount],
			   ((SQ_REFRESULTSSOPINSTANCEUID *)
			    pointer)->referencedSOPInstanceUID);
		    p.RRSequenceCount++;
		    break;
		case DCM_RESINTERPAPPROVERSEQUENCE:
		    strcpy(p.IApprover[p.IApprovalSequenceCount],
			   ((SQ_REQINTERPRETATIONAPPROVER *)
			    pointer)->physiciansApproving);
		    strcpy(p.IADates[p.IApprovalSequenceCount],
			   ((SQ_REQINTERPRETATIONAPPROVER *)
			    pointer)->approvalDates);
		    strcpy(p.IATimes[p.IApprovalSequenceCount],
			   ((SQ_REQINTERPRETATIONAPPROVER *)
			    pointer)->approvalTimes);
		    p.IApprovalSequenceCount++;
		    break;
		case DCM_RESDIAGNOSISCODESEQ:
		    strcpy(p.IDCSequence[p.IDCSequenceCount].
			   CodeValue,
			   ((SQ_REQPROCEDURECODE *) pointer)->codeValue);
		    strcpy(p.IDCSequence[p.IDCSequenceCount].
			   CodingSchemeDesignator,
			   ((SQ_REQPROCEDURECODE *) pointer)->codingSchemeDesignator);
		    strcpy(p.IDCSequence[p.IDCSequenceCount].
			   CodeMeaning,
			   ((SQ_REQPROCEDURECODE *) pointer)->codeMeaning);
		    p.IDCSequenceCount++;
		    break;
		}
		pointer = LST_Next(&l);
	    }
	}
    }
    return 0;
/*
    e.tag = DCM_IDREFERENCEDRESULTSSEQ;

    cond = DCM_GetSequenceList(object, e.tag, &e.d.sq);
    if (cond == DCM_ELEMENTNOTFOUND)
	return 0;
    else if (cond != DCM_NORMAL)
	return -1;

    cond = SQ_ParseSequence(&e, &type, &l);
    if (cond != SQ_NORMAL)
	return -2;
    if (type == SQ_K_REFRESULTSSOPINSTANCEUID) {
	p.Update_Flag |= HIS_K_INTRRSEQUENCE;
	results = LST_Head(&l);
	if (results != NULL)
	    LST_Position(&l, results);
	while (results != NULL) {
	    strcpy(p.RRSequence[p.RRSequenceCount],
		   results->referencedSOPInstanceUID);
	    ++p.RRSequenceCount;
	    results = LST_Next(&l);
	}
    }
*/
}