Skip to content

Commit

Permalink
v2.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sunmingbao committed Nov 20, 2013
1 parent d22a4d1 commit b80c407
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 93 deletions.
9 changes: 5 additions & 4 deletions inc/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,19 +296,20 @@ typedef struct
unsigned char ar_pln; /* length of protocol address */
unsigned short ar_op; /* ARP opcode (command) */

#if 0
#if 1
/*
* Ethernet looks like this : This bit is variable sized however...
*/
unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */
unsigned char ar_sha[6]; /* sender hardware address */
unsigned char ar_sip[4]; /* sender IP address */
unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
unsigned char ar_tha[6]; /* target hardware address */
unsigned char ar_tip[4]; /* target IP address */
#endif

} t_arp_hdr;
} __attribute__ ((aligned (1))) t_arp_hdr;

void get_protocol_name(int protocol, char *name);
void get_eth_type_name(int type, char *info);

int SelRvs(HWND hList);
int SelAll(HWND hList);
Expand Down
11 changes: 4 additions & 7 deletions release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@

С����̫�������� v2.3.0
С����̫�������� v2.3.1

�������ڣ�2013-11-15
�������ڣ�2013-11-20


���������ơ�
o ������������ʾ���������ơ�
o ֧����IP����ȫ��Э�����Ƶ���ʾ��
o ��Դ�뼰����ļ��������������Ա㽫������Դ��
o �Ż��˱����б�����ʾ���ݡ�
o �Ż��˲��ֽ�����ʾ��

������˵����
o �ӱ��汾��ʼ�������������˿�Դ��

2 changes: 1 addition & 1 deletion res/sample.rc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ ABOUTBOX DIALOG DISCARDABLE 32, 32, 250, 200
STYLE DS_MODALFRAME | WS_POPUP
FONT 8, "MS Sans Serif"
BEGIN
ICON "my_frame_icon",IDC_STATIC,10,10,32,32
ICON "my_frame_icon",IDC_STATIC,10,10,32,32, SS_REALSIZEIMAGE
PUSHBUTTON "Դ��", ID_AB_SOURCE,5, 50, 35, 14
PUSHBUTTON "����", ID_AB_SITE, 5, 70, 35, 14
PUSHBUTTON "����", ID_AB_UPDATE,5, 90, 35, 14
Expand Down
26 changes: 26 additions & 0 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,5 +1046,31 @@ void get_protocol_name(int protocol, char *name)
}
}

void get_eth_type_name(int type, char *info)
{
switch (type)
{

case ETH_P_IP:
strcpy(info, "ip");
return;

case ETH_P_ARP:
strcpy(info, "arp");
return;

case ETH_P_RARP:
strcpy(info, "rarp");
return;

case ETH_P_IPV6:
strcpy(info, "ipv6");
return;

}

sprintf(info, "0x%04x", type);

}
#endif

139 changes: 82 additions & 57 deletions src/right_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "global_info.h"
#include "res.h"

const char version[4]={'2','3','0','0'};
const char version[4]={'2','3','1','0'};

TCHAR szRightWinClassName[] = TEXT ("right_win") ;
HWND hwnd_right;
Expand Down Expand Up @@ -111,9 +111,9 @@ TCHAR *col_names[] =
NULL,
TEXT("索引"),
TEXT("名称"),
TEXT("目的mac"),
TEXT("源mac"),
TEXT("类型"),
TEXT("源地址"),
TEXT("目的地址"),
TEXT("协议"),
TEXT("长度"),
TEXT("信息"),
};
Expand All @@ -122,51 +122,36 @@ BOOL InitListViewColumns(HWND hWndListView)
{
TCHAR szText[256]; // Temporary buffer.
LVCOLUMN lvc;
int iCol;
int iCol, col_num = ARRAY_SIZE(col_names);
int order[] = { 1, 0, 2, 3, 4, 5, 6, 7, 8};
// Initialize the LVCOLUMN structure.
// The mask specifies that the format, width, text,
// and subitem members of the structure are valid.
int lv_width = GetSystemMetrics(SM_CXSCREEN) - 240;
int col_width[] = {40, 20, cxChar*7, cxChar*10, cxChar*20, cxChar*20
, cxChar*9, cxChar*7, cxChar*30};

SendMessage(hWndListView, WM_SETFONT, (WPARAM)GetStockObject(SYSTEM_FIXED_FONT), 0);
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;

// Add the columns.
for (iCol = 0; iCol < ARRAY_SIZE(col_names); iCol++)
for (iCol = 0; iCol < col_num; iCol++)
{
lvc.fmt = LVCFMT_LEFT;
lvc.iSubItem = iCol;
lvc.pszText = col_names[iCol];
if ( iCol == 0 )
if ( iCol == 0 || iCol == 1)
{
lvc.fmt = LVCFMT_RIGHT; // Left-aligned column.
lvc.cx = 40;
}

else if ( iCol == 1 )
{
lvc.fmt = LVCFMT_RIGHT; // Left-aligned column.
lvc.cx = 20;
}
else if ( iCol == 2 )
if ( iCol != (col_num-1))
{
lvc.fmt = LVCFMT_LEFT; // Left-aligned column.
lvc.cx = 80;
lvc.cx = col_width[iCol];
lv_width -= lvc.cx;
}
else if ( iCol == 3 )
else
{
lvc.fmt = LVCFMT_LEFT; // Left-aligned column.
lvc.cx = 150;
}
lvc.cx = lv_width-25;

else if ( iCol == 6 || iCol == 7)
{
lvc.fmt = LVCFMT_LEFT; // Right-aligned column.
lvc.cx = 100;
}
else
{
lvc.fmt = LVCFMT_LEFT; // Right-aligned column.
lvc.cx = 230;
}


// Insert the columns into the list view.
if (ListView_InsertColumn(hWndListView, iCol, &lvc) == -1)
Expand Down Expand Up @@ -238,7 +223,8 @@ BOOL InsertItemFromStream(HWND hWndListView, t_stream* pt_stream)
LVITEM lvI;
int index=ListView_GetItemCount(hWndListView);
int iCol;
TCHAR info[64];
TCHAR info[128];
t_ether_packet *pt_eth_hdr = pt_stream->data;

// Initialize LVITEM members that are different for each item.
{
Expand Down Expand Up @@ -279,30 +265,50 @@ BOOL InsertItemFromStream(HWND hWndListView, t_stream* pt_stream)
sprintf(info, "%d", index+1);
ListView_SetItemText(hWndListView, index, 2, info);
#endif

ListView_SetItemText(hWndListView, index, 3, pt_stream->name);

if (ntohs(pt_eth_hdr->type)!=ETH_P_IP)
{
sprintf(info, "%02hhx %02hhx %02hhx %02hhx %02hhx %02hhx"
, pt_stream->eth_packet.dst[0]
, pt_stream->eth_packet.dst[1]
, pt_stream->eth_packet.dst[2]
, pt_stream->eth_packet.dst[3]
, pt_stream->eth_packet.dst[4]
, pt_stream->eth_packet.dst[5]);
ListView_SetItemText(hWndListView, index, 4, info);

sprintf(info, "%02hhx %02hhx %02hhx %02hhx %02hhx %02hhx"
, pt_stream->eth_packet.src[0]
, pt_stream->eth_packet.src[1]
, pt_stream->eth_packet.src[2]
, pt_stream->eth_packet.src[3]
, pt_stream->eth_packet.src[4]
, pt_stream->eth_packet.src[5]);
ListView_SetItemText(hWndListView, index, 5, info);


sprintf(info, "%04hx", htons(pt_stream->eth_packet.type));
, pt_stream->eth_packet.src[0]
, pt_stream->eth_packet.src[1]
, pt_stream->eth_packet.src[2]
, pt_stream->eth_packet.src[3]
, pt_stream->eth_packet.src[4]
, pt_stream->eth_packet.src[5]);
ListView_SetItemText(hWndListView, index, 4, info);


sprintf(info, "%02hhx %02hhx %02hhx %02hhx %02hhx %02hhx"
, pt_stream->eth_packet.dst[0]
, pt_stream->eth_packet.dst[1]
, pt_stream->eth_packet.dst[2]
, pt_stream->eth_packet.dst[3]
, pt_stream->eth_packet.dst[4]
, pt_stream->eth_packet.dst[5]);
ListView_SetItemText(hWndListView, index, 5, info);

get_eth_type_name(ntohs(pt_stream->eth_packet.type), info);
ListView_SetItemText(hWndListView, index, 6, info);

}
else
{
t_ip_hdr *iph=(void *)(pt_eth_hdr->payload);
ip_n2str(info, &(iph->saddr));
ListView_SetItemText(hWndListView, index, 4, info);

ip_n2str(info, &(iph->daddr));
ListView_SetItemText(hWndListView, index, 5, info);

get_protocol_name(iph->protocol, info);

ListView_SetItemText(hWndListView, index, 6, info);


}

sprintf(info, "%d", pt_stream->len);
ListView_SetItemText(hWndListView, index, 7, info);

Expand Down Expand Up @@ -360,21 +366,40 @@ void update_grid_from_edit(int edit_iItem, int edit_iSubItem)
{
TCHAR buf[32];
t_stream* pt_stream=g_apt_streams[edit_iItem];
t_ether_packet *pt_eth_hdr = pt_stream->data;
t_ip_hdr *iph=(void *)(pt_eth_hdr->payload);

GetWindowText(hwnd_dynamic_edit, buf, sizeof(buf));
ShowWindow (hwnd_dynamic_edit, 0);
ListView_SetItemText(hwnd_lv, edit_iItem, edit_iSubItem, buf);
if (edit_iSubItem==3)
{
strcpy(pt_stream->name, buf);
return;
}
else if (edit_iSubItem==4)

if (ntohs(pt_eth_hdr->type)!=ETH_P_IP)
{
if (edit_iSubItem==4)
{
mac_str2n(pt_stream->eth_packet.src, buf);
}
else if (edit_iSubItem==5)
{
mac_str2n(pt_stream->eth_packet.dst, buf);
}
return;
}

if (edit_iSubItem==4)
{
mac_str2n(pt_stream->eth_packet.dst, buf);
ip_str2n(&(iph->saddr), buf);
}
else if (edit_iSubItem==5)
{
mac_str2n(pt_stream->eth_packet.src, buf);
ip_str2n(&(iph->daddr), buf);
}
check_sum_proc(pt_stream);

}

Expand Down Expand Up @@ -470,7 +495,7 @@ void lv_row_color_init()
lv_row_color[0]=GetSysColor (COLOR_WINDOW);
lv_row_color[1]=colorShade(GetSysColor (COLOR_WINDOW), 95.0);
lv_row_color[2]=RGB(0xA9, 0x13, 0x30);
lv_row_color[3]=RGB(0xEE, 0xEE, 0x00);
lv_row_color[3]=RGB(0xE6, 0x94, 0x1A);
}


Expand Down
Loading

0 comments on commit b80c407

Please sign in to comment.