Changeset 220

Show
Ignore:
Timestamp:
08/22/05 21:28:12
Author:
ben
Message:

Track packet position.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openpgpsdk/trunk/examples/packet-dump.c

    r211 r220  
    261261        print_indent(); 
    262262        printf("==== ptag new_format=%d content_tag=%d length_type=%d" 
    263                " length=0x%x (%d)\n",content->ptag.new_format, 
     263               " length=0x%x (%d) position=0x%x (%d)\n",content->ptag.new_format, 
    264264               content->ptag.content_tag,content->ptag.length_type, 
    265                content->ptag.length,content->ptag.length); 
     265               content->ptag.length,content->ptag.length, 
     266               content->ptag.position,content->ptag.position); 
    266267        /* 
    267268        print_tagname(ops_str_from_single_packet_tag(content->ptag.content_tag)); 
  • openpgpsdk/trunk/include/packet-parse.h

    r209 r220  
    5656    ops_packet_reader_t *reader; /*!< the reader function to use to get the data to be parsed */ 
    5757    void *reader_arg; /*!< the args to pass to the reader function */ 
     58    // XXX: what do we do about offsets into compressed packets? 
     59    unsigned position; /*!< the offset from the beginning (with this reader) */ 
    5860 
    5961    unsigned accumulate:1;      /*!< set to accumulate packet data */ 
  • openpgpsdk/trunk/include/packet.h

    r211 r220  
    218218    //    unsigned              length_read;    /*!< How much bytes of this packet we have read so far - for internal use 
    219219    //                                    only. */ 
     220    unsigned            position;       /*!< The position (within the current reader) of the packet */ 
    220221    } ops_ptag_t; 
    221222 
  • openpgpsdk/trunk/src/packet-parse.c

    r219 r220  
    178178    // we track length anyway, because it is used for packet offsets 
    179179    opt->alength+=*plength; 
     180    // and also the position 
     181    opt->position+=*plength; 
    180182 
    181183    return ret; 
     
    17091711    ops_boolean_t indeterminate=ops_false; 
    17101712 
     1713    C.ptag.position=opt->position; 
     1714 
    17111715    ret=base_read(ptag,&one,0,opt); 
    17121716    if(ret == OPS_R_EOF)