Browse Source

ethernet_packet.cpp edited online with Bitbucket

Jose R Ortiz Ubarri 8 years ago
parent
commit
04de4e52d7
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      ethernet_packet.cpp

+ 5
- 1
ethernet_packet.cpp View File

26
 
26
 
27
 
27
 
28
 string ethernet_packet::mac2string(u_char srcmac[]){
28
 string ethernet_packet::mac2string(u_char srcmac[]){
29
-
29
+    u_char mac[18] ;
30
+    sprintf((char *)mac, "%02X:%02X:%02X:%02X:%02X:%02X", srcmac[0],
31
+            srcmac[1],srcmac[2],srcmac[3], srcmac[4],srcmac[5]) ;
32
+    string macstr((char *) mac) ;
33
+    return macstr ;
30
 }
34
 }
31
 
35
 
32
 
36