Remove #if 0 code
authorkrj <krj@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 18 May 2010 08:29:19 +0000 (08:29 +0000)
committerkrj <krj@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 18 May 2010 08:29:19 +0000 (08:29 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@32868 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-btrfcomm.c

index a58ab5e01d651d02d5fe017fff80b08dbbe2dcbc..ff6b84599b93d88f41f5eddd9dbb22e5063ecd33 100644 (file)
@@ -306,125 +306,6 @@ dissect_ctrl_pn(packet_info *pinfo, proto_tree *t, tvbuff_t *tvb, int offset, in
        return offset;
 }
 
-
-
-#ifdef REMOVED
-/* to serve as inspiration when implementing ppp over rfcomm */
-static void *my_malloc(int size) {
-
-/*     void *p = calloc(size, 1); */
-
-       if (!p) {
-/*             perror("calloc()"); */
-               /* exit(1); */
-       }
-       return p;
-}
-
-
-static void stream_buf_init(dlci_stream *s)
-{
-       s->len = DEFAULT_STREAM_BUF_SIZE;
-       s->mode = 0;
-       s->is_escaped = 0;
-       s->current = 0;
-       s->stream_buf = my_malloc(DEFAULT_STREAM_BUF_SIZE);
-}
-
-
-static void stream_buf_append(rfcomm_packet_state *rps,
-                             dlci_stream *ds, tvbuff_t *tvb,
-                             int off, int len) {
-
-       const guint8 *buf = tvb_get_ptr(tvb, off, len);
-       int bytes_left = len, curr = 0;
-
-       if (!ds->stream_buf)
-               stream_buf_init(ds);
-
-       for (bytes_left = len; bytes_left > 0 && ds->current < ds->len; bytes_left--) {
-
-               /* fetch next byte */
-
-               guint8 byte = buf[curr++];
-
-               /* eventually check mode here */
-
-               if (byte == 0x7e) {
-                       if (ds->current == 0)
-                               continue; /* was start delimiter */
-
-                       /* end delimiter*/
-
-                       add_ppp_frame(rps, ds->stream_buf, ds->current);
-
-                       ds->current = 0;
-                       ds->is_escaped = 0;
-                       continue;
-               }
-
-               if (ds->is_escaped) {
-                       ds->stream_buf[ds->current++] = byte ^ 0x20;
-                       ds->is_escaped = 0;
-               } else {
-                       if (byte == 0x7d)
-                               ds->is_escaped = 1;
-                       else
-                               ds->stream_buf[ds->current++] = byte;
-               }
-
-       }
-}
-
-
-void add_ppp_frame(rfcomm_packet_state *rps, guint8 *buf, int len) {
-
-       rfcomm_ppp_frame *ppp = my_malloc(len + sizeof(rfcomm_ppp_frame));
-
-       ppp->next = NULL;
-       ppp->len = len;
-       memcpy(ppp + 1, buf, len);
-
-       if (rps->ppp_first)
-               rps->ppp_last->next = ppp;
-       else
-               rps->ppp_first = ppp;
-
-       rps->ppp_last = ppp;
-}
-
-/*
-int decode_fragments(dlci_stream *pstream, guint8 *buf) {
-
-       int real_len = 0, is_escaped = 0, chunk_index = 0;
-       ppp_chunk *chunk_curr = pstream->first;
-
-       for (real_len = 0; chunk_curr;) {
-
-               guint8 byte;
-
-               byte = chunk_curr->buf[chunk_index++];
-               if (chunk_index >= chunk_curr->len) {
-                       chunk_index = 0;
-                       chunk_curr = chunk_curr->next;
-               }
-               if (is_escaped) {
-                       buf[real_len++] = byte ^ 0x20;
-                       is_escaped = 0;
-               } else {
-                       if (byte == 0x7d)
-                               is_escaped = 1;
-                       else
-                               buf[real_len++] = byte;
-               }
-
-       }
-       return real_len;
-}
-*/
-#endif
-
-
 static int
 dissect_ctrl_msc(proto_tree *t, tvbuff_t *tvb, int offset, int length)
 {
@@ -723,50 +604,7 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                call_dissector(data_handle, next_tvb, pinfo, tree);
        }
 
-
        proto_tree_add_item(rfcomm_tree, hf_fcs, tvb, fcs_offset, 1, TRUE);
-
-
-#ifdef REMOVED
-/* to serve as inspiration when implementing ppp over rfcomm */
-       rfcomm_packet_state *rps = p_get_proto_data(pinfo->fd, proto_btrfcomm);
-       proto_item *ti_main, *ti_addr, *ti_hctl, *ti;
-       proto_tree *st, *st_ctrl, *st_addr, *st_hctl;
-       int size, off, off_fcs
-
-       if (rps == NULL) {
-               rps = my_malloc(sizeof(rfcomm_packet_state));
-               rps->ppp_first = NULL;
-               rps->ppp_last = NULL;
-               p_add_proto_data(pinfo->fd, proto_btrfcomm, rps);
-       }
-
-
-
-       if(dlci&&frame_len){
-               tvbuff_t *next_tvb;
-
-               if (frame_type == 0xef && !pinfo->fd->flags.visited) {
-                       dlci_stream *ds;
-
-                       ds = &state[dlci].direction[cr_flag];
-                       stream_buf_append(rps, ds, tvb, off, frame_len);
-               }
-
-               if (rps && rps->ppp_first) {
-                       rfcomm_ppp_frame *p;
-
-                       for (p = rps->ppp_first; p; p = p->next) {
-                               next_tvb = tvb_new_child_real_data(tvb, (guint8 *) (p + 1), p->len, p->len);
-                               packet_add_new_data_source(pinfo, rfcomm_tree, next_tvb, "Reassembled PPP frame");
-                               call_dissector(ppp_handle, next_tvb, pinfo, tree);
-                       }
-               } else {
-                       next_tvb = tvb_new_subset(tvb, off, frame_len, frame_len);
-                       call_dissector(data_handle, next_tvb, pinfo, tree);
-               }
-       }
-#endif
 }