~ubuntu-branches/ubuntu/utopic/sblim-sfcc/utopic-proposed

« back to all changes in this revision

Viewing changes to backend/cimxml/cimXmlParser.c

  • Committer: Bazaar Package Importer
  • Author(s): Thierry Carrez
  • Date: 2009-08-19 14:41:55 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090819144155-jb46y5kmluacii70
Tags: 2.2.0-0ubuntu1
* New upstream version.
* debian/libcimcclient0.install: Ship missing libcmpisfcc library
* debian/control:
  - Switch to libcurl4-openssl-dev to match the rest of the SBLIM stack
  - Bump debhelper depend to >=5 to match debian/compat
  - Fix section names, add missing ${misc:Depends}
* debian/copyright: Add missing copyright notice
* debian/rules: Removed spurious DH_MAKESHLIBS argument

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
/*
3
3
 * cimXmlParser.c
4
4
 *
5
 
 * (C) Copyright IBM Corp. 2005
6
 
 * (C) Copyright Intel Corp. 2005
 
5
 * © Copyright IBM Corp. 2005, 2007
 
6
 * © Copyright Intel Corp. 2005
7
7
 *
8
8
 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
9
9
 * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
26
26
#include <cmcidt.h>
27
27
 
28
28
#include "cimXmlParser.h"
29
 
#include "cimXmlResp.h"
 
29
#include "grammar.h"
30
30
 
31
31
#ifdef DMALLOC
32
32
#include "dmalloc.h"
33
33
#endif
34
34
 
35
 
 
36
 
int yylex(YYSTYPE * lvalp, ParserControl * parm);
37
 
int yyerror(char *s);
 
35
#ifdef LARGE_VOL_SUPPORT
 
36
 
 
37
// New begin
 
38
#include <curl/curl.h>         // new
 
39
#include <pthread.h>           // new
 
40
#include <time.h>              // new
 
41
#include <sys/time.h>          // new
 
42
#include <setjmp.h>            // new
 
43
 
 
44
struct _CMCIConnectionFT;                           // new 
 
45
typedef struct _CMCIConnectionFT CMCIConnectionFT;  // new
 
46
 
 
47
char * getNextSection(struct _CMCIConnection * ) ;
 
48
int checkTag(char * , int ) ;
 
49
 
 
50
#include "cmci.h"
 
51
#include "utilStringBuffer.h"  // new
 
52
#include "cimXmlParser.h"      // new
 
53
#include "native.h"            // new
 
54
#include "esinfo.h"            // new
 
55
#include "conn.h"              // new
 
56
 
 
57
jmp_buf save_env ;
 
58
 
 
59
/*
 
60
 * response data helper functions.
 
61
 */
 
62
inline char * CURPTR (enumScanInfo * esi ){
 
63
 return(((char*)(esi->base)) + (esi->curoff)) ;
 
64
}
 
65
inline char * SSECPTR (enumScanInfo * esi ){
 
66
 return(((char*)(esi->base)) + (esi->ssecoff)) ;
 
67
}
 
68
inline char * LASTPTR (enumScanInfo * esi ){
 
69
 return(((char*)(esi->base)) + (esi->eodoff)) ;
 
70
}
 
71
inline void INCOFF (enumScanInfo * esi ){
 
72
 (esi->curoff)++ ;      
 
73
}
 
74
 
 
75
int sfccFreeSection(ParserControl * );
 
76
void * enumScanThrd(struct native_enum *);
 
77
int sfccLex(parseUnion * , ParserControl * );
 
78
char * getNextSection(struct _CMCIConnection * );
 
79
int checkTag(char * , int );
 
80
 
 
81
#endif /* endif LARGE_VOL_SUPPORT */
38
82
 
39
83
static int attrsOk(XmlBuffer * xb, const XmlElement * e, XmlAttr * r,
40
84
                   const char *tag, int etag);
41
85
static char *getValue(XmlBuffer * xb, const char *v);
42
 
extern int yyparse(void *);
43
86
 
44
87
typedef struct tags {
45
88
   const char *tag;
46
89
   const int tagLen;
47
 
   int (*process) (YYSTYPE *, ParserControl * parm);
 
90
   int (*process) (parseUnion *, ParserControl * parm);
48
91
   int etag;
49
92
} Tags;
50
93
 
60
103
static XmlBuffer *newXmlBuffer(const char *s)
61
104
{
62
105
   XmlBuffer *xb = (XmlBuffer *) malloc(sizeof(XmlBuffer));
63
 
   xb->base = xb->cur = (char *) strdup(s);
64
 
   xb->last = xb->cur + strlen(xb->cur);
 
106
   if(s){
 
107
      xb->base = xb->cur = (char *) strdup(s);
 
108
      xb->last = xb->cur + strlen(xb->cur);
 
109
   }
65
110
   xb->nulledChar = 0;
66
111
   xb->eTagFound = 0;
67
112
   xb->etag = 0;
70
115
 
71
116
static void releaseXmlBuffer(XmlBuffer *xb)
72
117
{
73
 
    free (xb->base);
 
118
          if(xb->base)
 
119
       free (xb->base);
74
120
    free (xb);
75
121
}
76
122
 
323
369
    return NULL;
324
370
}
325
371
 
326
 
//static XmlBuffer* xmb;
327
 
 
328
 
static int procXml(YYSTYPE * lvalp, ParserControl * parm)
 
372
static int procXml(parseUnion * lvalp, ParserControl * parm)
329
373
{
330
374
   static XmlElement elm[] = { {"version"},
331
375
   {"encoding"},
342
386
   return 0;
343
387
}
344
388
 
345
 
static int procCim(YYSTYPE * lvalp, ParserControl * parm)
 
389
static int procCim(parseUnion * lvalp, ParserControl * parm)
346
390
{
347
391
   static XmlElement elm[] = {
348
392
      {"CIMVERSION"},
353
397
 
354
398
   memset(attr, 0, sizeof(attr));
355
399
   if (tagEquals(parm->xmb, "CIM")) {
356
 
      if (attrsOk(parm->xmb, elm, attr, "CIM", ZTOK_CIM))
 
400
      if (attrsOk(parm->xmb, elm, attr, "CIM", ZTOK_CIM)){
357
401
         return XTOK_CIM;
 
402
      }
358
403
   }
359
404
   return 0;
360
405
}
361
406
 
362
 
static int procMessage(YYSTYPE * lvalp, ParserControl * parm)
 
407
static int procMessage(parseUnion * lvalp, ParserControl * parm)
363
408
{
364
409
   static XmlElement elm[] = {
365
410
      {"ID"},
379
424
   return 0;
380
425
}
381
426
 
382
 
static int procSimpleResp(YYSTYPE * lvalp, ParserControl * parm)
 
427
static int procSimpleResp(parseUnion * lvalp, ParserControl * parm)
383
428
{
384
429
   static XmlElement elm[] = {
385
430
      {NULL}
392
437
   return 0;
393
438
}
394
439
 
395
 
static int procIMethodResp(YYSTYPE * lvalp, ParserControl * parm)
 
440
static int procIMethodResp(parseUnion * lvalp, ParserControl * parm)
396
441
{
397
442
   static XmlElement elm[] = {
398
443
      {"NAME"},
403
448
   memset(attr, 0, sizeof(attr));
404
449
   if (tagEquals(parm->xmb, "IMETHODRESPONSE")) {
405
450
      if (attrsOk(parm->xmb, elm, attr, "IMETHODRESPONSE", ZTOK_IMETHODRESP)) {
406
 
         lvalp->xtokMessage.id = attr[0].attr;
 
451
         /*lvalp->xtokMessage.id = attr[0].attr;*/
407
452
         parm->respHdr.id = attr[0].attr;
408
453
         return XTOK_IMETHODRESP;
409
454
      }
411
456
   return 0;
412
457
}
413
458
 
414
 
static int procMethodResp(YYSTYPE * lvalp, ParserControl * parm)
 
459
static int procMethodResp(parseUnion * lvalp, ParserControl * parm)
415
460
{
416
461
   static XmlElement elm[] = {
417
462
      {"NAME"},
422
467
   memset(attr, 0, sizeof(attr));
423
468
   if (tagEquals(parm->xmb, "METHODRESPONSE")) {
424
469
      if (attrsOk(parm->xmb, elm, attr, "METHODRESPONSE", ZTOK_METHODRESP)) {
425
 
         lvalp->xtokMessage.id = attr[0].attr;
 
470
         memset(&lvalp->xtokMethodRespContent, 0, sizeof(XtokMethodRespContent));
 
471
         lvalp->xtokMethodRespContent.name = attr[0].attr;
426
472
         parm->respHdr.id = attr[0].attr;
427
473
         return XTOK_METHODRESP;
428
474
      }
431
477
   return 0;
432
478
}
433
479
 
434
 
static int procErrorResp(YYSTYPE * lvalp, ParserControl * parm)
 
480
static int procErrorResp(parseUnion * lvalp, ParserControl * parm)
435
481
{
436
482
   static XmlElement elm[] = {
437
483
      {"CODE"},
451
497
   return 0;
452
498
}
453
499
 
454
 
static int procIRetValue(YYSTYPE * lvalp, ParserControl * parm)
 
500
static int procIRetValue(parseUnion * lvalp, ParserControl * parm)
455
501
{
456
502
   if (tagEquals(parm->xmb, "IRETURNVALUE")) {
457
503
      static XmlElement elm[] = {
466
512
   return 0;
467
513
}
468
514
 
469
 
static int procRetValue(YYSTYPE * lvalp, ParserControl * parm)
 
515
static int procRetValue(parseUnion * lvalp, ParserControl * parm)
470
516
{
471
517
   if (tagEquals(parm->xmb, "RETURNVALUE")) {
472
518
      static XmlElement elm[] = {
473
519
         {"PARAMTYPE"},
 
520
         {"EMBEDDEDOBJECT"},
474
521
         {NULL}
475
522
      };
476
 
      XmlAttr attr[2];
 
523
      XmlAttr attr[3];
477
524
      int i;
478
525
      memset(attr, 0, sizeof(attr));
479
526
      if (attrsOk(parm->xmb, elm, attr, "RETURNVALUE", ZTOK_RETVALUE)) {
487
534
   return 0;
488
535
}
489
536
 
490
 
static int procLocalNameSpacePath(YYSTYPE * lvalp, ParserControl * parm)
 
537
static int procLocalNameSpacePath(parseUnion * lvalp, ParserControl * parm)
491
538
{
492
539
   static XmlElement elm[] = {
493
540
      {NULL}
497
544
      if (attrsOk
498
545
          (parm->xmb, elm, attr, "LOCALNAMESPACEPATH",
499
546
           ZTOK_LOCALNAMESPACEPATH)) {
 
547
         lvalp->xtokLocalNameSpacePath.value = NULL;
500
548
         return XTOK_LOCALNAMESPACEPATH;
501
549
      }
502
550
   }
503
551
   return 0;
504
552
}
505
553
 
506
 
static int procClassPath(YYSTYPE * lvalp, ParserControl * parm)
 
554
static int procClassPath(parseUnion * lvalp, ParserControl * parm)
507
555
{
508
556
   static XmlElement elm[] = {
509
557
      {NULL}
519
567
   return 0;
520
568
}
521
569
 
522
 
static int procLocalClassPath(YYSTYPE * lvalp, ParserControl * parm)
 
570
static int procLocalClassPath(parseUnion * lvalp, ParserControl * parm)
523
571
{
524
572
   static XmlElement elm[] = {
525
573
      {NULL}
535
583
   return 0;
536
584
}
537
585
 
538
 
static int procLocalInstancePath(YYSTYPE * lvalp, ParserControl * parm)
 
586
static int procLocalInstancePath(parseUnion * lvalp, ParserControl * parm)
539
587
{
540
588
   static XmlElement elm[] = {
541
589
      {NULL}
551
599
   return 0;
552
600
}
553
601
 
554
 
static int procObjectPath(YYSTYPE * lvalp, ParserControl * parm)
 
602
static int procObjectPath(parseUnion * lvalp, ParserControl * parm)
555
603
{
556
604
   static XmlElement elm[] = {
557
605
      {NULL}
560
608
   if (tagEquals(parm->xmb, "OBJECTPATH")) {
561
609
      if (attrsOk(parm->xmb, elm, attr, "OBJECTPATH",
562
610
           ZTOK_OBJECTPATH)) {
563
 
         lvalp->xtokValue.value = getContent(parm->xmb);
564
611
         return XTOK_OBJECTPATH;
565
612
      }
566
613
   }
567
614
   return 0;
568
615
}
569
616
 
570
 
static int procNameSpace(YYSTYPE * lvalp, ParserControl * parm)
 
617
static int procNameSpace(parseUnion * lvalp, ParserControl * parm)
571
618
{
572
619
   static XmlElement elm[] = {
573
620
      {"NAME"},
585
632
   return 0;
586
633
}
587
634
 
588
 
static int procParamValue(YYSTYPE * lvalp, ParserControl * parm)
 
635
static int procParamValue(parseUnion * lvalp, ParserControl * parm)
589
636
{
590
637
   static XmlElement elm[] = {
591
638
      {"NAME"},
592
639
      {"PARAMTYPE"},
 
640
      {"EMBEDDEDOBJECT"},
593
641
      {NULL}
594
642
   };
595
 
   XmlAttr attr[2];
 
643
   XmlAttr attr[3];
596
644
   int i, m;
597
645
 
598
646
   memset(attr, 0, sizeof(attr));
609
657
   return 0;
610
658
}
611
659
 
612
 
static int procClassName(YYSTYPE * lvalp, ParserControl * parm)
 
660
static int procClassName(parseUnion * lvalp, ParserControl * parm)
613
661
{
614
662
   static XmlElement elm[] = {
615
663
      {"NAME"},
620
668
   memset(attr, 0, sizeof(attr));
621
669
   if (tagEquals(parm->xmb, "CLASSNAME")) {
622
670
      if (attrsOk(parm->xmb, elm, attr, "CLASSNAME", ZTOK_CLASSNAME)) {
623
 
         lvalp->className = attr[0].attr;
 
671
         lvalp->xtokClassName.value = attr[0].attr;
624
672
         return XTOK_CLASSNAME;
625
673
      }
626
674
   }
627
675
   return 0;
628
676
}
629
677
 
630
 
static int procInstanceName(YYSTYPE * lvalp, ParserControl * parm)
 
678
static int procInstanceName(parseUnion * lvalp, ParserControl * parm)
631
679
{
632
680
   static XmlElement elm[] = {
633
681
      {"CLASSNAME"},
638
686
   memset(attr, 0, sizeof(attr));
639
687
   if (tagEquals(parm->xmb, "INSTANCENAME")) {
640
688
      if (attrsOk(parm->xmb, elm, attr, "INSTANCENAME", ZTOK_INSTANCENAME)) {
 
689
         memset(&lvalp->xtokInstanceName, 0, sizeof(XtokInstanceName));
641
690
         lvalp->xtokInstanceName.className = attr[0].attr;
642
691
         return XTOK_INSTANCENAME;
643
692
      }
645
694
   return 0;
646
695
}
647
696
 
648
 
static int procKeyBinding(YYSTYPE * lvalp, ParserControl * parm)
 
697
static int procKeyBinding(parseUnion * lvalp, ParserControl * parm)
649
698
{
650
699
   static XmlElement elm[] = {
651
700
      {"NAME"},
656
705
   memset(attr, 0, sizeof(attr));
657
706
   if (tagEquals(parm->xmb, "KEYBINDING")) {
658
707
      if (attrsOk(parm->xmb, elm, attr, "KEYBINDING", ZTOK_KEYBINDING)) {
659
 
         lvalp->xtokInstanceName.className = attr[0].attr;
 
708
         lvalp->xtokKeyBinding.name = attr[0].attr;
660
709
         return XTOK_KEYBINDING;
661
710
      }
662
711
   }
663
712
   return 0;
664
713
}
665
714
 
666
 
static int procInstance(YYSTYPE * lvalp, ParserControl * parm)
 
715
static int procInstance(parseUnion * lvalp, ParserControl * parm)
667
716
{
668
717
   static XmlElement elm[] = {
669
718
      {"CLASSNAME"},
674
723
   memset(attr, 0, sizeof(attr));
675
724
   if (tagEquals(parm->xmb, "INSTANCE")) {
676
725
      if (attrsOk(parm->xmb, elm, attr, "INSTANCE", ZTOK_INSTANCE)) {
 
726
         memset(&lvalp->xtokInstance, 0, sizeof(XtokInstance));
677
727
         lvalp->xtokInstance.className = attr[0].attr;
678
728
         return XTOK_INSTANCE;
679
729
      }
681
731
   return 0;
682
732
}
683
733
 
684
 
static int procClass(YYSTYPE * lvalp, ParserControl * parm)
 
734
static int procClass(parseUnion * lvalp, ParserControl * parm)
685
735
{
686
736
   static XmlElement elm[] = {
687
737
      {"NAME"},
693
743
   memset(attr, 0, sizeof(attr));
694
744
   if (tagEquals(parm->xmb, "CLASS")) {
695
745
      if (attrsOk(parm->xmb, elm, attr, "CLASS", ZTOK_CLASS)) {
 
746
         memset(&lvalp->xtokClass, 0, sizeof(XtokClass));
696
747
         lvalp->xtokClass.className = attr[0].attr;
697
748
         lvalp->xtokClass.superClass = attr[1].attr;
698
749
         return XTOK_CLASS;
701
752
   return 0;
702
753
}
703
754
 
704
 
static int procKeyValue(YYSTYPE * lvalp, ParserControl * parm)
 
755
static int procKeyValue(parseUnion * lvalp, ParserControl * parm)
705
756
{
706
757
   static XmlElement elm[] = {
707
758
      {"VALUETYPE"},
724
775
   return 0;
725
776
}
726
777
 
727
 
static int procHost(YYSTYPE * lvalp, ParserControl * parm)
 
778
static int procHost(parseUnion * lvalp, ParserControl * parm)
728
779
{
729
780
   static XmlElement elm[] = {
730
781
      {NULL}
739
790
   return 0;
740
791
}
741
792
 
742
 
static int procValue(YYSTYPE * lvalp, ParserControl * parm)
 
793
static int procValue(parseUnion * lvalp, ParserControl * parm)
743
794
{
744
795
   static XmlElement elm[] = {
745
796
      {NULL}
749
800
      char *v;
750
801
      if (attrsOk(parm->xmb, elm, attr, "VALUE", ZTOK_VALUE)) {
751
802
         v=getContent(parm->xmb);
752
 
         lvalp->xtokValue.value = v;
 
803
         lvalp->xtokValue.data.value = v;
753
804
         return XTOK_VALUE;
754
805
      }
755
806
   }
756
807
   return 0;
757
808
}
758
809
 
759
 
static int procValueArray(YYSTYPE * lvalp, ParserControl * parm)
 
810
static int procValueArray(parseUnion * lvalp, ParserControl * parm)
760
811
{
761
812
   static XmlElement elm[] = {
762
813
      {NULL}
765
816
   if (tagEquals(parm->xmb, "VALUE.ARRAY")) {
766
817
      if (attrsOk(parm->xmb, elm, attr, "VALUE.ARRAY",
767
818
           ZTOK_VALUEARRAY)) {
 
819
         lvalp->xtokValueArray.max = 16;
 
820
         lvalp->xtokValueArray.next = 0;
 
821
         lvalp->xtokValueArray.values = (char**)parser_malloc(parm->heap, (sizeof(char*) * lvalp->xtokValueArray.max));
768
822
         return XTOK_VALUEARRAY;
769
823
      }
770
824
   }
771
825
   return 0;
772
826
}
773
827
 
774
 
static int procValueNamedInstance(YYSTYPE * lvalp, ParserControl * parm)
 
828
static int procValueRefArray(parseUnion * lvalp, ParserControl * parm)
 
829
{
 
830
   static XmlElement elm[] = {
 
831
      {NULL}
 
832
   };
 
833
   XmlAttr attr[1];
 
834
   if (tagEquals(parm->xmb, "VALUE.REFARRAY")) {
 
835
      if (attrsOk(parm->xmb, elm, attr, "VALUE.REFARRAY",
 
836
           ZTOK_VALUEARRAY)) {
 
837
         lvalp->xtokValueRefArray.max = 16;
 
838
         lvalp->xtokValueRefArray.next = 0;
 
839
         lvalp->xtokValueRefArray.values = (XtokValueReference*)parser_malloc(parm->heap, (sizeof(XtokValueReference) * lvalp->xtokValueRefArray.max));
 
840
         return XTOK_VALUEREFARRAY;
 
841
      }
 
842
   }
 
843
   return 0;
 
844
}
 
845
 
 
846
static int procValueNamedInstance(parseUnion * lvalp, ParserControl * parm)
775
847
{
776
848
   static XmlElement elm[] = {
777
849
      {NULL}
780
852
   if (tagEquals(parm->xmb, "VALUE.NAMEDINSTANCE")) {
781
853
      if (attrsOk(parm->xmb, elm, attr, "VALUE.NAMEDINSTANCE",
782
854
           ZTOK_VALUENAMEDINSTANCE)) {
783
 
         lvalp->xtokValue.value = getContent(parm->xmb);
784
855
         return XTOK_VALUENAMEDINSTANCE;
785
856
      }
786
857
   }
787
858
   return 0;
788
859
}
789
860
 
790
 
static int procInstancePath(YYSTYPE * lvalp, ParserControl * parm)
 
861
static int procInstancePath(parseUnion * lvalp, ParserControl * parm)
791
862
{
792
863
   static XmlElement elm[] = {
793
864
      {NULL}
796
867
   if (tagEquals(parm->xmb, "INSTANCEPATH")) {
797
868
      if (attrsOk(parm->xmb, elm, attr, "INSTANCEPATH",
798
869
           ZTOK_INSTANCEPATH)) {
799
 
         lvalp->xtokValue.value = getContent(parm->xmb);
800
870
         return XTOK_INSTANCEPATH;
801
871
      }
802
872
   }
803
873
   return 0;
804
874
}
805
875
 
806
 
static int procNameSpacePath(YYSTYPE * lvalp, ParserControl * parm)
 
876
static int procNameSpacePath(parseUnion * lvalp, ParserControl * parm)
807
877
{
808
878
   static XmlElement elm[] = {
809
879
      {NULL}
812
882
   if (tagEquals(parm->xmb, "NAMESPACEPATH")) {
813
883
      if (attrsOk(parm->xmb, elm, attr, "NAMESPACEPATH",
814
884
           ZTOK_NAMESPACEPATH)) {
815
 
         lvalp->xtokValue.value = getContent(parm->xmb);
816
885
         return XTOK_NAMESPACEPATH;
817
886
      }
818
887
   }
819
888
   return 0;
820
889
}
821
890
 
822
 
static int procValueReference(YYSTYPE * lvalp, ParserControl * parm)
 
891
static int procValueReference(parseUnion * lvalp, ParserControl * parm)
823
892
{
824
893
   static XmlElement elm[] = {
825
894
      {NULL}
828
897
   if (tagEquals(parm->xmb, "VALUE.REFERENCE")) {
829
898
      if (attrsOk(parm->xmb, elm, attr, "VALUE.REFERENCE",
830
899
           ZTOK_VALUEREFERENCE)) {
831
 
         lvalp->xtokValue.value = getContent(parm->xmb);
832
900
         return XTOK_VALUEREFERENCE;
833
901
      }
834
902
   }
835
903
   return 0;
836
904
}
837
905
 
838
 
static int procValueObjectWithPath(YYSTYPE * lvalp, ParserControl * parm)
 
906
static int procValueObjectWithPath(parseUnion * lvalp, ParserControl * parm)
839
907
{
840
908
   static XmlElement elm[] = {
841
909
      {NULL}
850
918
   return 0;
851
919
}
852
920
 
853
 
static int procQualifier(YYSTYPE * lvalp, ParserControl * parm)
 
921
static int procQualifier(parseUnion * lvalp, ParserControl * parm)
854
922
{
855
923
   static XmlElement elm[] = { {"NAME"},
856
924
   {"TYPE"},
889
957
}
890
958
 
891
959
 
892
 
static int procProperty(YYSTYPE * lvalp, ParserControl * parm)
 
960
static int procProperty(parseUnion * lvalp, ParserControl * parm)
893
961
{
894
962
   static XmlElement elm[] = { {"NAME"},
895
963
   {"TYPE"},
896
964
   {"CLASSORIGIN"},
897
965
   {"PROPAGATED"},
 
966
   {"EMBEDDEDOBJECT"},
898
967
   {NULL}
899
968
   };
900
 
   XmlAttr attr[4];
 
969
   XmlAttr attr[5];
901
970
   int i, m;
902
971
 
903
972
   memset(attr, 0, sizeof(attr));
920
989
   return 0;
921
990
}
922
991
 
923
 
static int procPropertyArray(YYSTYPE * lvalp, ParserControl * parm)
 
992
static int procPropertyArray(parseUnion * lvalp, ParserControl * parm)
924
993
{
925
994
   static XmlElement elmPA[] = { {"NAME"},
926
995
   {"TYPE"},
927
996
   {"CLASSORIGIN"},
928
997
   {"PROPAGATED"},
929
998
   {"ARRAYSIZE"},
 
999
   {"EMBEDDEDOBJECT"},
930
1000
   {NULL}
931
1001
   };
932
 
   XmlAttr attr[5];
 
1002
   XmlAttr attr[6];
933
1003
   int i, m;
934
1004
 
935
1005
   memset(attr, 0, sizeof(attr));
936
1006
   if (tagEquals(parm->xmb, "PROPERTY.ARRAY")) {
937
1007
      if (attrsOk(parm->xmb, elmPA, attr, "PROPERTY.ARRAY", ZTOK_PROPERTYARRAY)) {
 
1008
         memset(&lvalp->xtokProperty, 0, sizeof(XtokProperty));
938
1009
         lvalp->xtokProperty.name = attr[0].attr;
939
1010
         lvalp->xtokProperty.valueType = CMPI_null;
940
1011
         if (attr[1].attr)
951
1022
   return 0;
952
1023
}
953
1024
 
954
 
static int procPropertyReference(YYSTYPE * lvalp, ParserControl * parm)
 
1025
static int procPropertyReference(parseUnion * lvalp, ParserControl * parm)
955
1026
{
956
1027
   static XmlElement elm[] = { {"NAME"},
957
1028
   {"REFERENCECLASS"},
979
1050
   return 0;
980
1051
}
981
1052
 
982
 
static int procMethod(YYSTYPE * lvalp, ParserControl * parm)
 
1053
static int procMethod(parseUnion * lvalp, ParserControl * parm)
983
1054
{
984
1055
   static XmlElement elm[] = { {"NAME"},
985
1056
   {"TYPE"},
1008
1079
   return 0;
1009
1080
}
1010
1081
 
1011
 
static int procParam(YYSTYPE * lvalp, ParserControl * parm)
 
1082
static int procParam(parseUnion * lvalp, ParserControl * parm)
1012
1083
{
1013
1084
   static XmlElement elm[] =
1014
1085
   { {"NAME"},
1034
1105
   return 0;
1035
1106
}
1036
1107
 
1037
 
static int procParamArray(YYSTYPE * lvalp, ParserControl * parm)
 
1108
static int procParamArray(parseUnion * lvalp, ParserControl * parm)
1038
1109
{
1039
1110
   static XmlElement elm[] =
1040
1111
   { {"NAME"},
1062
1133
   return 0;
1063
1134
}
1064
1135
 
1065
 
static int procParamRef(YYSTYPE * lvalp, ParserControl * parm)
 
1136
static int procParamRef(parseUnion * lvalp, ParserControl * parm)
1066
1137
{
1067
1138
   static XmlElement elm[] =
1068
1139
   { {"NAME"},
1086
1157
   return 0;
1087
1158
}
1088
1159
 
1089
 
static int procParamRefArray(YYSTYPE * lvalp, ParserControl * parm)
 
1160
static int procParamRefArray(parseUnion * lvalp, ParserControl * parm)
1090
1161
{
1091
1162
   static XmlElement elm[] =
1092
1163
   { {"NAME"},
1099
1170
   memset(attr, 0, sizeof(attr));
1100
1171
   if (tagEquals(parm->xmb, "PARAMETER.REFARRAY")) {
1101
1172
      attr[1].attr = NULL;
1102
 
      if (attrsOk(parm->xmb, elm, attr, "PARAMETER.REFARRAY", ZTOK_PARAM)) {
 
1173
      if (attrsOk(parm->xmb, elm, attr, "PARAMETER.REFARRAY", ZTOK_PARAMREFARRAY)) {
1103
1174
         memset(&lvalp->xtokParam, 0, sizeof(XtokParam));
1104
1175
         lvalp->xtokParam.pType = ZTOK_PARAMREFARRAY;
1105
1176
         lvalp->xtokParam.name = attr[0].attr;
1106
1177
         lvalp->xtokParam.refClass = attr[1].attr;
1107
1178
         lvalp->xtokParam.arraySize = attr[2].attr;
1108
1179
         lvalp->xtokParam.type = CMPI_refA;
1109
 
         return XTOK_PARAM;
1110
 
      }
1111
 
   }
1112
 
   return 0;
1113
 
}
1114
 
 
 
1180
         return XTOK_PARAMREFARRAY;
 
1181
      }
 
1182
   }
 
1183
   return 0;
 
1184
}
 
1185
 
 
1186
 
 
1187
static int procSimpleExpReq(parseUnion * lvalp, ParserControl * parm)
 
1188
{
 
1189
   static XmlElement elm[] = {
 
1190
      {NULL}
 
1191
   };
 
1192
   XmlAttr   attr[1];
 
1193
 
 
1194
   if (tagEquals(parm->xmb, "SIMPLEEXPREQ")) {
 
1195
      if (attrsOk(parm->xmb, elm, attr, "SIMPLEEXPREQ", ZTOK_SIMPLEEXPREQ))
 
1196
      {
 
1197
         return XTOK_SIMPLEEXPREQ;
 
1198
      }
 
1199
   }
 
1200
   return 0;
 
1201
}
 
1202
 
 
1203
static int procExportMethodCall(parseUnion * lvalp, ParserControl * parm)
 
1204
{
 
1205
   static XmlElement elm[] = {
 
1206
     {"NAME"},
 
1207
      {NULL}
 
1208
   };
 
1209
   XmlAttr   attr[1];
 
1210
 
 
1211
   memset(attr, 0, sizeof(attr));
 
1212
   if (tagEquals(parm->xmb, "EXPMETHODCALL")) {
 
1213
      if (attrsOk(parm->xmb, elm, attr, "EXPMETHODCALL", ZTOK_EXPMETHODCALL)) {
 
1214
         if (strcasecmp(attr[0].attr, "ExportIndication") == 0) {
 
1215
            return XTOK_EXPORTINDICATION;
 
1216
         }
 
1217
      }
 
1218
   }
 
1219
   return 0;
 
1220
}
 
1221
 
 
1222
static int procExParamValue(parseUnion * lvalp, ParserControl * parm)
 
1223
{
 
1224
   static XmlElement elm[] = {
 
1225
     {"NAME"},
 
1226
      {NULL}
 
1227
   };
 
1228
   XmlAttr   attr[1];
 
1229
 
 
1230
   memset(attr, 0, sizeof(attr));
 
1231
   if (tagEquals(parm->xmb, "EXPPARAMVALUE")) {
 
1232
      if (attrsOk(parm->xmb, elm, attr, "EXPPARAMVALUE", ZTOK_EXPPARAMVALUE)) {
 
1233
         if (strcasecmp(attr[0].attr, "NewIndication") == 0) {
 
1234
            return XTOK_EP_INSTANCE;
 
1235
         }
 
1236
      }
 
1237
   }
 
1238
   return 0;
 
1239
}
 
1240
 
 
1241
static int procCdata(parseUnion * lvalp, ParserControl * parm)
 
1242
{
 
1243
   static XmlElement elm[] = {
 
1244
      {NULL}
 
1245
   };
 
1246
   XmlAttr attr[1];
 
1247
   
 
1248
   if (tagEquals(parm->xmb, "![CDATA[")) {
 
1249
      parm->xmb->cur--;
 
1250
      parm->xmb->cur[0] = '>';      
 
1251
      char *v;
 
1252
      if (attrsOk(parm->xmb, elm, attr, "![CDATA[", ZTOK_CDATA)) {
 
1253
         
 
1254
         v=strstr(parm->xmb->cur, "]]>");
 
1255
         if(v) {
 
1256
            v[0] = '<';
 
1257
            v[1] = '/';
 
1258
         } else {
 
1259
            return 0;
 
1260
         }
 
1261
         return XTOK_CDATA;
 
1262
      }
 
1263
   }
 
1264
   return 0;
 
1265
}
1115
1266
 
1116
1267
static Tags tags[] = {
1117
1268
   {TAG("?xml"), procXml, ZTOK_XML},
1152
1303
   {TAG("OBJECTPATH"), procObjectPath, ZTOK_OBJECTPATH},
1153
1304
   {TAG("METHODRESPONSE"), procMethodResp, ZTOK_METHODRESP},
1154
1305
   {TAG("RETURNVALUE"), procRetValue, ZTOK_RETVALUE},
1155
 
   {TAG("CLASSPATH"), procClassPath, ZTOK_CLASSPATH}
 
1306
   {TAG("CLASSPATH"), procClassPath, ZTOK_CLASSPATH},
 
1307
   {TAG("SIMPLEEXPREQ"), procSimpleExpReq, ZTOK_SIMPLEEXPREQ},
 
1308
   {TAG("EXPMETHODCALL"), procExportMethodCall, ZTOK_EXPMETHODCALL},
 
1309
   {TAG("EXPPARAMVALUE"), procExParamValue, ZTOK_EXPPARAMVALUE},
 
1310
   {TAG("![CDATA["), procCdata, ZTOK_CDATA},
 
1311
   {TAG(""), procCdata, ZTOK_CDATA},
 
1312
   /* The last two lines are a hack for embedded instances. The CDATA
 
1313
    * construct does not have a <x> ... </x> form but rather something like
 
1314
    * <bla ....>, which is not a real tag. so the second line is necessary
 
1315
    * for our lexer to find the closing "tag" for that case, which is just
 
1316
    * an empty string */
1156
1317
};
1157
1318
#define TAGS_NITEMS     (int)(sizeof(tags)/sizeof(Tags))
1158
1319
 
1159
 
int yylex(YYSTYPE * lvalp, ParserControl * parm)
 
1320
#ifndef LARGE_VOL_SUPPORT
 
1321
 
 
1322
int sfccLex(parseUnion * lvalp, ParserControl * parm)
1160
1323
{
1161
1324
   int i, rc;
1162
1325
   char *next;
1198
1361
   }
1199
1362
   return 0;
1200
1363
}
1201
 
 
1202
 
int yyerror(char *s)
1203
 
{
1204
 
   printf("*-* yyerror: %s\n", s);
1205
 
   exit(5);
1206
 
}
 
1364
#endif
1207
1365
 
1208
1366
ResponseHdr scanCimXmlResponse(const char *xmlData, CMPIObjectPath *cop)
1209
1367
{
1210
1368
   ParserControl control;
1211
 
   XtokParamValue *outParam=NULL;
1212
 
   CMPIArgs *args = NULL;
1213
 
   CMPIValue value;
1214
1369
#if DEBUG
1215
1370
   extern int do_debug;
1216
1371
 
1225
1380
   control.respHdr.xmlBuffer = xmb;
1226
1381
 
1227
1382
   control.respHdr.rvArray=newCMPIArray(0,0,NULL);
1228
 
   control.da_nameSpace=(char*)getNameSpaceChars(cop);
 
1383
 
 
1384
   if(cop) {
 
1385
       control.da_nameSpace=(char*)getNameSpaceChars(cop);
 
1386
   }
1229
1387
 
1230
1388
   control.heap = parser_heap_init();
1231
1389
 
1232
 
   control.respHdr.rc = yyparse(&control);
1233
 
 
1234
 
   /* Process OUT parameters */
1235
 
   outParam = control.paramValues.first;
1236
 
 
1237
 
   if (outParam) { 
1238
 
 
1239
 
       args = newCMPIArgs(NULL);
1240
 
 
1241
 
       while (outParam) {
1242
 
 
1243
 
           /*value = (outParam->type == CMPI_ref) 
1244
 
               ? str2CMPIValue(outParam->type, NULL, &outParam->valueRef)
1245
 
               : str2CMPIValue(outParam->type, outParam->value.value, NULL);*/
1246
 
           value = str2CMPIValue(outParam->type, outParam->value.value, &outParam->valueRef);
1247
 
 
1248
 
           /* Add it to the args list */
1249
 
           args->ft->addArg ( args, outParam->name, &value, outParam->type);
1250
 
           native_release_CMPIValue(outParam->type,&value);
1251
 
           outParam = outParam->next;
1252
 
       }
1253
 
       control.respHdr.outArgs = args;
1254
 
       /* Note : Freeing of list will be done by
1255
 
        * parser_heap_term() routine.
1256
 
        */
1257
 
   }
 
1390
   control.respHdr.rc = startParsing(&control);
1258
1391
 
1259
1392
   parser_heap_term(control.heap);
1260
1393
 
1347
1480
  }
1348
1481
}
1349
1482
 
 
1483
#if LARGE_VOL_SUPPORT
 
1484
 
 
1485
/* **************************************************************************/
 
1486
/* **************************************************************************/
 
1487
/* **************************************************************************/
 
1488
/* **************************************************************************/
 
1489
/* **************************************************************************/
 
1490
/* **************************************************************************/
 
1491
/* **************************************************************************/
 
1492
int sfccFreeSection(ParserControl * parm)
 
1493
{
 
1494
   if(parm->econ->asynRCntl.escanInfo.section){                       
 
1495
            free(parm->econ->asynRCntl.escanInfo.section) ;
 
1496
                  parm->econ->asynRCntl.escanInfo.section = NULL ;
 
1497
   }    
 
1498
}
 
1499
#define TIMEDELAY 10 
 
1500
void * enumScanThrd(struct native_enum *NatEnum)
 
1501
{
 
1502
   CMCIConnection * con = NatEnum->econ ; /* enumeration */
 
1503
   CMPIObjectPath * cop = NatEnum->ecop ; /* enumeration */ 
 
1504
   
 
1505
   struct          timespec tp ;
 
1506
         int             rc = 0 ;
 
1507
   
 
1508
   ParserControl control;
 
1509
   struct native_enum  *local_enmp ;
 
1510
   
 
1511
   memset(&control,0,sizeof(control));
 
1512
  
 
1513
   /* 
 
1514
    * get the data array and save a copy of address in enumeration 
 
1515
    */
 
1516
    
 
1517
   XmlBuffer *xmb = newXmlBuffer(NULL);
 
1518
   control.xmb = xmb;
 
1519
   control.respHdr.xmlBuffer = xmb;
 
1520
    
 
1521
   control.respHdr.rvArray=newCMPIArray(0,0,NULL);
 
1522
 
 
1523
   local_enmp = con->asynRCntl.enmp ;
 
1524
   
 
1525
   local_enmp->data = control.respHdr.rvArray ;
 
1526
   
 
1527
   if(cop) {
 
1528
       control.da_nameSpace=(char*)getNameSpaceChars(cop);
 
1529
   }
 
1530
 
 
1531
   control.heap = parser_heap_init();
 
1532
 
 
1533
   control.econ = con ;
 
1534
     
 
1535
   if(rc = setjmp(save_env)) {
 
1536
      printf(" we had a timeout , we are going to exit from here \n") ;
 
1537
      con->asynRCntl.escanInfo.parsestate = PARSTATE_SERVER_TIMEOUT ;
 
1538
      con->asynRCntl.xfer_state = XFER_ERROR ;
 
1539
      return ;
 
1540
   }
 
1541
   
 
1542
   /*
 
1543
    * wait for first data block received or xfer complete
 
1544
    * we need to have some data before starting
 
1545
    */
 
1546
   while((con->asynRCntl.xfer_state != XFER_DATA_RECVD )&&
 
1547
         (con->asynRCntl.xfer_state != XFER_COMPLETE)){
 
1548
        usleep(100000) ;
 
1549
   }
 
1550
       
 
1551
   control.respHdr.rc = startParsing(&control);
 
1552
     
 
1553
   /*
 
1554
    * releaseXmlBuffer free's that last con->asynRCntl.escanInfo.section 
 
1555
    * we clear out that pointer just to be safe
 
1556
    */
 
1557
   releaseXmlBuffer(xmb);
 
1558
   
 
1559
   con->asynRCntl.escanInfo.section = 0 ;
 
1560
   
 
1561
   parser_heap_term(control.heap);
 
1562
   
 
1563
   con->asynRCntl.escanInfo.parsestate = PARSTATE_COMPLETE ;
 
1564
    
 
1565
}
 
1566
 
 
1567
int sfccLex(parseUnion * lvalp, ParserControl * parm)
 
1568
{
 
1569
   int i, rc;
 
1570
   char *next;
 
1571
   char *nextSection ;
 
1572
 
 
1573
   for (;;) {
 
1574
        
 
1575
          if(parm->econ) {
 
1576
             
 
1577
             if(parm->econ->asynRCntl.escanInfo.getnew == 1 ){
 
1578
            
 
1579
            nextSection = getNextSection(parm->econ) ;
 
1580
            if(nextSection != NULL) {
 
1581
               parm->xmb->base = nextSection ;
 
1582
               parm->xmb->cur  = nextSection ;
 
1583
               parm->xmb->last = nextSection + (parm->econ->asynRCntl.escanInfo.sectlen) ;
 
1584
 
 
1585
         } else {
 
1586
              printf(" sfccLex --- section is NULL !!!!!!!!!!!!!!!!! \n") ;
 
1587
         }
 
1588
         }
 
1589
      }
 
1590
      
 
1591
      
 
1592
      next = nextTag(parm->xmb);
 
1593
      if (next == NULL) {
 
1594
         return 0;
 
1595
      }
 
1596
//      fprintf(stderr,"--- token: %.32s\n",next); //usefull for debugging
 
1597
      if (parm->xmb->eTagFound) {
 
1598
         parm->xmb->eTagFound = 0;
 
1599
         return parm->xmb->etag;
 
1600
      }
 
1601
 
 
1602
      if (*next == '/') {
 
1603
         for (i = 0; i < TAGS_NITEMS; i++) {
 
1604
            if (nextEquals(next + 1, tags[i].tag, tags[i].tagLen) == 1) {
 
1605
               skipTag(parm->xmb);
 
1606
               return tags[i].etag;
 
1607
            }
 
1608
         }
 
1609
      }
 
1610
 
 
1611
      else {
 
1612
         if (strncmp(parm->xmb->cur, "<!--", 4) == 0) {
 
1613
            parm->xmb->cur = strstr(parm->xmb->cur, "-->") + 3;
 
1614
            continue;
 
1615
         } else
 
1616
         if (strncmp(parm->xmb->cur, "<EC>", 4) == 0) {
 
1617
            parm->econ->asynRCntl.escanInfo.getnew = 1 ;
 
1618
            parm->econ->asynRCntl.escanInfo.parsestate = PARSTATE_STARTED ; 
 
1619
            continue;
 
1620
         } 
 
1621
         for (i = 0; i < TAGS_NITEMS; i++) {
 
1622
            if (nextEquals(next, tags[i].tag, tags[i].tagLen) == 1) {
 
1623
//             printf("+++ %d\n",i);
 
1624
               rc=tags[i].process(lvalp, parm);
 
1625
               return rc;
 
1626
            }
 
1627
         }
 
1628
      }
 
1629
      break;
 
1630
   }
 
1631
   return 0;
 
1632
}
 
1633
 
 
1634
char * getNextSection(struct _CMCIConnection * con)
 
1635
{
 
1636
        char * xmlb    = NULL;
 
1637
  char * workptr = NULL;
 
1638
  char * curptr  = NULL;
 
1639
  int    xmlblen = 0;
 
1640
  int    tagval  = 0;
 
1641
  int    retcode = 0; 
 
1642
  int    toval   = 0;
 
1643
  
 
1644
   /*
 
1645
    * free that old buffer 
 
1646
    */
 
1647
  
 
1648
  if(con->asynRCntl.escanInfo.section != NULL) {
 
1649
     free(con->asynRCntl.escanInfo.section);
 
1650
     con->asynRCntl.escanInfo.section = NULL ;
 
1651
  }
 
1652
  
 
1653
  if((retcode = pthread_mutex_lock(&(con->asynRCntl.escanlock))) != 0){
 
1654
     printf(" getNextSection pthread lock return code %d\n",retcode) ;  
 
1655
  }
 
1656
  
 
1657
  /*
 
1658
   * If we have no more new data from the server , we 
 
1659
   * unlock and sleep then check till we see that we have 
 
1660
   * received new data 
 
1661
   */
 
1662
  
 
1663
  while(con->asynRCntl.escanInfo.prevtotl == con->asynRCntl.escanInfo.recdtotl){
 
1664
     if((retcode = pthread_mutex_unlock(&(con->asynRCntl.escanlock))) != 0){
 
1665
        printf(" getNextSection pthread lock return code %d\n",retcode) ;       
 
1666
     }
 
1667
     /* *******************************************
 
1668
      * ******************************************* 
 
1669
      * timeout toval keeps us from hanging forever
 
1670
      * *******************************************
 
1671
      * *******************************************
 
1672
      */
 
1673
     usleep(1000) ;
 
1674
     toval++ ;
 
1675
 
 
1676
     if(toval>5000) 
 
1677
         longjmp (save_env, 1);
 
1678
     
 
1679
     if(con->asynRCntl.escanInfo.prevtotl != con->asynRCntl.escanInfo.recdtotl){
 
1680
          /* 
 
1681
           * we got more data , exit this loop
 
1682
           */
 
1683
        if((retcode = pthread_mutex_lock(&(con->asynRCntl.escanlock))) != 0){
 
1684
             printf(" getNextSection pthread lock return code %d\n",retcode) ;  
 
1685
        }
 
1686
        break;
 
1687
     }   
 
1688
  }
 
1689
 
 
1690
  if((con->asynRCntl.xfer_state == XFER_DATA_RECVD) ||
 
1691
     (con->asynRCntl.xfer_state == XFER_COMPLETE)       )    {
 
1692
 
 
1693
     workptr = LASTPTR(&(con->asynRCntl.escanInfo)) ;
 
1694
     curptr  = CURPTR(&(con->asynRCntl.escanInfo));
 
1695
  
 
1696
     con->asynRCntl.escanInfo.ssecoff = con->asynRCntl.escanInfo.curoff ;
 
1697
     
 
1698
     toval = 0;
 
1699
     while(workptr > curptr) {   
 
1700
        if(*workptr == '>'){
 
1701
                 tagval = checkTag(workptr , con->asynRCntl.eMethodType) ;
 
1702
                 if(tagval == 0){
 
1703
              con->asynRCntl.escanInfo.curoff = con->asynRCntl.escanInfo.curoff + (workptr - curptr) + 1 ;
 
1704
              xmlblen = ((workptr - curptr) + 5) ;
 
1705
           
 
1706
              xmlb = malloc(xmlblen + 64) ;
 
1707
              con->asynRCntl.escanInfo.section = xmlb ;
 
1708
 
 
1709
              con->asynRCntl.escanInfo.sectlen = xmlblen + 5 ;
 
1710
              memset(xmlb , 0x0cc , xmlblen + 5) ;
 
1711
                                   
 
1712
              if(xmlb != NULL){
 
1713
                 memcpy(xmlb , SSECPTR(&con->asynRCntl.escanInfo) , xmlblen) ;
 
1714
                 strcpy((xmlb+(xmlblen - 4)) , "<EC>") ;
 
1715
                 con->asynRCntl.escanInfo.getnew = 0 ;
 
1716
 
 
1717
              } else {
 
1718
                     /* getNextSection xmlb is NULL !!! This is bad */
 
1719
              }
 
1720
                           
 
1721
              con->asynRCntl.escanInfo.prevtotl = con->asynRCntl.escanInfo.recdtotl ;
 
1722
 
 
1723
              if((retcode =  pthread_mutex_unlock(&(con->asynRCntl.escanlock))) != 0){
 
1724
                 printf(" getNextSection pthread lock return code %d\n",retcode) ;      
 
1725
              }
 
1726
              return(xmlb) ;
 
1727
          } else {
 
1728
                  /* 
 
1729
                   * backup before this tag 
 
1730
                   */
 
1731
              workptr = workptr - tagval ;
 
1732
              if(workptr <= curptr){
 
1733
                 if (con->asynRCntl.escanInfo.prevtotl != con->asynRCntl.escanInfo.recdtotl){
 
1734
                          pthread_mutex_unlock(&(con->asynRCntl.escanlock));
 
1735
                          usleep(1000) ;
 
1736
                          toval++ ;
 
1737
                          if(toval > 5000)
 
1738
                             longjmp (save_env, 2);
 
1739
                          pthread_mutex_lock(&(con->asynRCntl.escanlock));
 
1740
                    workptr = LASTPTR(&(con->asynRCntl.escanInfo)) ;
 
1741
                    curptr  = CURPTR(&(con->asynRCntl.escanInfo));                      
 
1742
                 }
 
1743
              }
 
1744
              continue;
 
1745
          }
 
1746
        } else {
 
1747
           workptr-- ;
 
1748
           if(workptr <= curptr){
 
1749
              if (con->asynRCntl.escanInfo.prevtotl != con->asynRCntl.escanInfo.recdtotl){
 
1750
                 workptr = LASTPTR(&(con->asynRCntl.escanInfo)) ;
 
1751
                 curptr  = CURPTR(&(con->asynRCntl.escanInfo));
 
1752
              }
 
1753
           }
 
1754
        }
 
1755
     }
 
1756
  }
 
1757
  
 
1758
  if((retcode =  pthread_mutex_unlock(&(con->asynRCntl.escanlock))) != 0){
 
1759
     printf(" getNextSection pthread unlock return code %d\n",retcode) ;        
 
1760
  }
 
1761
  return(NULL) ;
 
1762
}
 
1763
/*
 
1764
 * check to see if the ending tag is at a 
 
1765
 * place in the data that we can use to 
 
1766
 * start parsing. The parsing needs to be
 
1767
 * given certain chunks of the data based on 
 
1768
 * the request we are processing. 
 
1769
 * If we see </CIM> thats good , we are 
 
1770
 * at the end of the data.
 
1771
 * return 0 if ending tag is OK
 
1772
 * return >0 if ending tag is not OK   
 
1773
 * CIM 
 
1774
 * VALUE.NAMEDINSTANCE
 
1775
 * CLASSNAME
 
1776
 *
 
1777
 */
 
1778
 
 
1779
int checkTag(char * wrkptr , int methodtype ) {
 
1780
char * workptr = wrkptr ;
 
1781
char temptag[120] ;
 
1782
int  taglength = 1 ;
 
1783
 
 
1784
   memset(&temptag[0] , 00 , 119) ;
 
1785
   /*
 
1786
    * find start of tag 
 
1787
    */
 
1788
   while(*workptr != '<'){ 
 
1789
      workptr-- ;
 
1790
      taglength++ ;
 
1791
   }
 
1792
                 
 
1793
         
 
1794
         if (strncmp(workptr , "</CIM>", 6) == 0) {
 
1795
                  return(0) ;
 
1796
         }
 
1797
         
 
1798
  switch(methodtype) {
 
1799
     case ENUMERATEINSTANCES:
 
1800
        if (strncmp(workptr , "</VALUE.NAMEDINSTANCE>", 22) == 0) {
 
1801
           return(0) ;
 
1802
        }
 
1803
        break ;
 
1804
     case ENUMERATEINSTANCENAMES:       
 
1805
          if (strncmp(workptr , "</INSTANCENAME>", 15) == 0) {
 
1806
           return(0) ;
 
1807
        }
 
1808
        break;
 
1809
     case ENUMERATECLASSES:
 
1810
          if (strncmp(workptr , "</CLASS>", 8) == 0) {
 
1811
           return(0) ;
 
1812
        }
 
1813
        break;
 
1814
     case ENUMERATECLASSNAMES:
 
1815
          if (strncmp(workptr , "<CLASSNAME ", 11) == 0) {
 
1816
           return(0) ;
 
1817
        }
 
1818
        break;  
 
1819
         }
 
1820
            
 
1821
         /*
 
1822
          * return the length of this tag 
 
1823
          */
 
1824
         strncpy(&temptag[0] , workptr , taglength) ;
 
1825
         return(taglength) ;
 
1826
                
 
1827
}
 
1828
 
 
1829
#endif
 
1830