Changeset 1351

Show
Ignore:
Timestamp:
08/05/08 14:42:03 (8 months ago)
Author:
perry
Message:

Constification

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libpacketdump/bitbuffer.c

    r979 r1351  
    109109 
    110110 
    111 void decode_protocol_file(uint16_t link_type,char *packet,int len,element_t *el) 
     111void decode_protocol_file(uint16_t link_type,const char *packet,int len,element_t *el) 
    112112{ 
    113113    bitbuffer_t result; 
  • trunk/libpacketdump/eth_2048.c

    r1287 r1351  
    2121#define DISPLAYIP(x,fmt) DISPLAY_EXP(x,fmt,inet_ntoa(*(struct in_addr*)&ip->x)) 
    2222 
    23 void decode(int link_type,char *packet,unsigned len) 
     23void decode(int link_type,const char *packet,unsigned len) 
    2424{ 
    2525        libtrace_ip_t *ip = (libtrace_ip_t*)packet; 
  • trunk/libpacketdump/eth_2054.c

    r1338 r1351  
    7777} 
    7878         
    79 void decode(int link_type,char *packet,unsigned len) 
     79void decode(int link_type,const char *packet,unsigned len) 
    8080{ 
    8181        struct arphdr *arp = (struct arphdr*)packet; 
  • trunk/libpacketdump/eth_34887.c

    r1219 r1351  
    1717        } while(0) 
    1818 
    19 void decode(int link_type,char *packet,unsigned len) 
     19void decode(int link_type,const char *packet,unsigned len) 
    2020{ 
    2121        int offset=0; 
  • trunk/libpacketdump/eth_34916.c

    r1241 r1351  
    1515} pppoe_t; 
    1616 
    17 void decode(int link_type, char *pkt, unsigned len)  
     17void decode(int link_type,const char *pkt,unsigned len)  
    1818{ 
    1919        pppoe_t *pppoe = (pppoe_t *) pkt; 
  • trunk/libpacketdump/eth_34958.c

    r1219 r1351  
    9191} 
    9292 
    93 void decode(int link_type,char *packet,unsigned len) 
     93void decode(int link_type,const char *packet,unsigned len) 
    9494{ 
    9595        int offset; 
  • trunk/libpacketdump/grammar.h

    r979 r1351  
    5151     
    5252element_t *parse_protocol_file(char *filename); 
    53 void decode_protocol_file(uint16_t link_type,char *packet,int len, element_t* el); 
     53void decode_protocol_file(uint16_t link_type,const char *packet,int len, element_t* el); 
    5454 
    5555typedef uint64_t bitbuffer_t; 
  • trunk/libpacketdump/ip_1.c

    r1219 r1351  
    3939}; 
    4040 
    41 void decode(int link_type,char *packet,unsigned len) 
     41void decode(int link_type,const char *packet,unsigned len) 
    4242{ 
    4343        libtrace_icmp_t *icmp = (libtrace_icmp_t*)packet; 
  • trunk/libpacketdump/ip_132.c

    r1219 r1351  
    151151} 
    152152 
    153 void decode(int link_type,char *packet,unsigned len) 
     153void decode(int link_type,const char *packet,unsigned len) 
    154154{ 
    155155    struct sctp_common_hdr *hdr; 
  • trunk/libpacketdump/ip_17.c

    r1219 r1351  
    2525 
    2626 
    27 void decode(int link_type,char *packet,unsigned len) 
     27void decode(int link_type,const char *packet,unsigned len) 
    2828{ 
    2929        struct libtrace_udp *udp = (struct libtrace_udp*)packet; 
  • trunk/libpacketdump/ip_33.c

    r1219 r1351  
    4747        }; 
    4848 
    49 void decode(int link_type,char *packet,unsigned len) 
     49void decode(int link_type,const char *packet,unsigned len) 
    5050{ 
    5151        struct dccphdr *dccp = (struct dccphdr*)packet; 
  • trunk/libpacketdump/ip_47.c

    r1238 r1351  
    1111} gre_t; 
    1212 
    13 void decode(int link_type,char *packet,unsigned len) 
     13void decode(int link_type,const char *packet,unsigned len) 
    1414{ 
    1515        // GRE 
  • trunk/libpacketdump/ip_6.c

    r1338 r1351  
    2020#define DISPLAYIP(x,fmt) DISPLAY_EXP(x,fmt,inet_ntoa(*(struct in_addr*)&tcp->x)) 
    2121 
    22 void decode(int link_type,char *packet,unsigned len) 
     22void decode(int link_type,const char *packet,unsigned len) 
    2323{ 
    2424        unsigned char *pkt = NULL; 
  • trunk/libpacketdump/libpacketdump.cc

    r1272 r1351  
    5555}; 
    5656 
    57 typedef void (*decode_norm_t)(uint16_t type,char *packet,int len); 
    58 typedef void (*decode_parser_t)(uint16_t type,char *packet,int len, element_t* el); 
     57typedef void (*decode_norm_t)(uint16_t type,const char *packet,int len); 
     58typedef void (*decode_parser_t)(uint16_t type,const char *packet,int len, element_t* el); 
    5959 
    6060typedef union decode_funcs { 
     
    8484        libtrace_linktype_t linktype; 
    8585        uint32_t length; 
    86         char *link=(char *)trace_get_packet_buffer(packet,&linktype,&length); 
     86        const char *link=(char *)trace_get_packet_buffer(packet,&linktype,&length); 
    8787 
    8888        printf("\n%s",ctime(&sec)); 
     
    9898} 
    9999 
    100 static void generic_decode(uint16_t type,char *packet, int len) { 
     100static void generic_decode(uint16_t type,const char *packet, int len) { 
    101101        int i; 
    102102        printf(" Unknown Protocol: %i",type); 
     
    128128} 
    129129 
    130 void decode_next(char *packet,int len,char *proto_name,int type) 
     130void decode_next(const char *packet,int len,const char *proto_name,int type) 
    131131{ 
    132132        std::string sname(proto_name); 
     
    187187                        uint16_t newtype; 
    188188                        uint32_t newlen=len; 
    189                         void *network=trace_get_payload_from_link(packet, 
     189                        const char *network=(const char*)trace_get_payload_from_link((void*)packet, 
    190190                                        (libtrace_linktype_t)type, 
    191191                                        &newtype,&newlen); 
    192192                        if (network) { 
    193193                                printf("skipping unknown link header of type %i to %i\n",type,newtype); 
    194                                 decode_next((char*)network,newlen,"eth",newtype); 
     194                                decode_next(network,newlen,"eth",newtype); 
    195195                                return; 
    196196                        } 
  • trunk/libpacketdump/libpacketdump.h

    r1219 r1351  
    88 
    99void trace_dump_packet(libtrace_packet_t *packet); 
    10 void decode_next(char *packet,int len,char *proto_name,int type); 
     10void decode_next(const char *packet,int len,const char *proto_name,int type); 
    1111 
    12 void decode(int link_type, char *pkt, unsigned len); 
     12void decode(int link_type, const char *pkt, unsigned len); 
    1313 
    1414#ifdef __cplusplus  
  • trunk/libpacketdump/link_0.c

    r1219 r1351  
    66#include "libpacketdump.h" 
    77 
    8 void decode(int link_type,char *packet,unsigned len) 
     8void decode(int link_type,const char *packet,unsigned len) 
    99{ 
    1010        printf(" Legacy PoS:"); 
  • trunk/libpacketdump/link_10.c

    r1219 r1351  
    55#include "libtrace.h" 
    66 
    7 void decode(int link_type,char *packet,unsigned len) 
     7void decode(int link_type,const char *packet,unsigned len) 
    88{ 
    99        // ATM 
  • trunk/libpacketdump/link_11.c

    r1219 r1351  
    44#include "libpacketdump.h" 
    55 
    6 void decode(int link_type,char *packet,unsigned len) 
     6void decode(int link_type,const char *packet,unsigned len) 
    77{ 
    88        // Ethernet - just raw ethernet frames 
  • trunk/libpacketdump/link_15.c

    r1300 r1351  
    1616        while ( (_p - _s) % sizeof(uint16_t)) {_p++; _c++;}  
    1717 
    18 void decode(int link_type,char *packet,unsigned len) 
     18void decode(int link_type,const char *packet,unsigned len) 
    1919{ 
    2020        uint32_t *ptr;  
  • trunk/libpacketdump/link_2.c

    r1232 r1351  
    77#include "libpacketdump.h" 
    88 
    9 void decode(int link_type,char *packet,unsigned len) 
     9void decode(int link_type,const char *packet,unsigned len) 
    1010{ 
    1111        char ether_buf[18] = {0, }; 
  • trunk/libpacketdump/link_4.c

    r1338 r1351  
    191191 * length remaining and decodes the IEs. 
    192192 */ 
    193 static void decode_80211_information_elements(char *pkt, unsigned len) { 
     193static void decode_80211_information_elements(const char *pkt, unsigned len) { 
    194194        ieee80211_ie *ie; 
    195195        int i = 0; 
     
    425425         
    426426/* Decodes a beacon (or a probe response) */ 
    427 static void decode_80211_beacon(char *pkt, unsigned len) { 
     427static void decode_80211_beacon(const char *pkt, unsigned len) { 
    428428        ieee80211_beacon *b = (ieee80211_beacon *)pkt; 
    429429        if (len < sizeof(ieee80211_beacon)) { 
     
    439439} 
    440440 
    441 static void decode_80211_assoc_request(char *pkt, unsigned len) { 
     441static void decode_80211_assoc_request(const char *pkt, unsigned len) { 
    442442        ieee80211_assoc_req *a = (ieee80211_assoc_req *) pkt; 
    443443         
     
    453453} 
    454454 
    455 static void decode_80211_assoc_response(char *pkt, unsigned len) { 
     455static void decode_80211_assoc_response(const char *pkt, unsigned len) { 
    456456        ieee80211_assoc_resp *r = (ieee80211_assoc_resp *) pkt; 
    457457 
     
    468468} 
    469469         
    470 static void decode_80211_reassoc_request(char *pkt, unsigned len) { 
     470static void decode_80211_reassoc_request(const char *pkt, unsigned len) { 
    471471        ieee80211_reassoc_req *r = (ieee80211_reassoc_req *) pkt; 
    472472 
     
    482482} 
    483483 
    484 static void decode_80211_authentication_frame(char *pkt, unsigned len) { 
     484static void decode_80211_authentication_frame(const char *pkt, unsigned len) { 
    485485        ieee80211_auth *auth = (ieee80211_auth *)pkt; 
    486486        if(len < sizeof(ieee80211_auth)) { 
     
    497497} 
    498498 
    499 static void decode_80211_mgmt(char *pkt, unsigned len) { 
     499static void decode_80211_mgmt(const char *pkt, unsigned len) { 
    500500        ieee80211_mgmt_frame *mgmt = (ieee80211_mgmt_frame *)pkt; 
    501501        uint8_t *data; 
     
    580580} 
    581581 
    582 static void decode_80211_ctrl(char *pkt, unsigned len) { 
     582static void decode_80211_ctrl(const char *pkt, unsigned len) { 
    583583        ieee80211_ctrl_frame_1addr *ctrl1 = (ieee80211_ctrl_frame_1addr *) pkt; 
    584584        ieee80211_ctrl_frame_2addr *ctrl2 = (ieee80211_ctrl_frame_2addr *) pkt; 
     
    650650} 
    651651 
    652 static void decode_80211_data(char *pkt, unsigned len) { 
     652static void decode_80211_data(const char *pkt, unsigned len) { 
    653653        ieee80211_data_frame *data = (ieee80211_data_frame *) pkt; 
    654654        ieee80211_qos_data_frame *qos = (ieee80211_qos_data_frame *)pkt; 
     
    747747} 
    748748 
    749 void decode(int link_type, char *pkt, unsigned len)  
     749void decode(int link_type, const char *pkt, unsigned len)  
    750750{ 
    751751        ieee80211_frame_control *fc; 
  • trunk/libpacketdump/link_6.c

    r1219 r1351  
    1111#include "libtrace_int.h" 
    1212 
    13 void decode(int link_type, char *pkt, unsigned len)  
     13void decode(int link_type,const char *pkt,unsigned len)  
    1414{ 
    1515        libtrace_sll_header_t *sll = (libtrace_sll_header_t *) pkt;