printbyte in c

Programing/C언어 | 2010/06/28 03:01 | adioshun
//PrintByte("test", hj_uid, 128);

void PrintBYTE(char *msg, char *Data, int DataLen) {
int idx;
fprintf(stdout, "%5s =", msg);
for( idx=0; idx<(int)DataLen; idx++) {
if( (idx==0) || ((idx%16)!=0) )
fprintf(stdout, " 0x%.2x", Data[idx]); //fprintf(stdout, " %.2x", Data[idx]);
else
fprintf(stdout, "\n\t0x%.2x", Data[idx]); //fprintf(stdout, "\n\t%.2x", Data[idx]);
}
fprintf(stdout, "\n");
}



//PrintByte("data_out", data_out, snd_msg_len);
int PrintByte(char *str, unsigned char *bytes, int bytes_len)
{
  char tmp;
  unsigned char *log_str;
  int i;
  log_str = (unsigned char *)malloc(strlen(str)+ bytes_len*12 + 1 + 7*(bytes_len/5+1));

  strcpy(log_str, str);
  sprintf(log_str+strlen(log_str), "\n001 :");

  for(i=0;i<bytes_len;i++){
    if(('a'<=*(bytes+i)&&*(bytes+i)<='z')||('A'<=*(bytes+i)&&*(bytes+i)<='Z')||('0'<=*(bytes+i)&&*(bytes+i)<='9'))
      tmp = *(bytes+i);
    else
      tmp = ' ';
    sprintf(log_str+strlen(log_str), "[%02x|%c|%03d]  ",*(bytes+i), tmp, *(bytes+i));
    if(i&&(i+1)%5==0) sprintf(log_str+strlen(log_str), "\n%03d :",((i+1)/5)+1);
  }

fprintf(stdout, "!!!!!!!!!%s",log_str);

}

//PrintByte("data_out", data_out, snd_msg_len); //16바이트 16진수만 표현
int PrintByte(char *str, unsigned char *bytes, int bytes_len)
{
  char tmp;
  unsigned char *log_str;
  int i;
  log_str = (unsigned char *)malloc(strlen(str)+ bytes_len*12 + 1 + 7*(bytes_len/5+1));

  strcpy(log_str, str);
  sprintf(log_str+strlen(log_str), "\n000 :");

  for(i=0;i<bytes_len;i++){
    if(('a'<=*(bytes+i)&&*(bytes+i)<='z')||('A'<=*(bytes+i)&&*(bytes+i)<='Z')||('0'<=*(bytes+i)&&*(bytes+i)<='9'))
      tmp = *(bytes+i);
    else
      tmp = ' ';
    sprintf(log_str+strlen(log_str), "0x%.2x ",*(bytes+i), tmp, *(bytes+i));
    if(i&&(i+1)%16==0) sprintf(log_str+strlen(log_str), "\n%03d :", i+1);
  }

fprintf(stdout, "\n\n>>>%s\n",log_str);
printf("-%s_len [%d]\n",str, bytes_len);

}
2010/06/28 03:01 2010/06/28 03:01
IPv6의 ND는 보안적으로 취약하기 때문에

RFC3971의 SEND(Secure Neighbor Discovery Implementation)를 통해 보안 요구사항을 만족하고 있다.

현재(2010년)까지 알아본 봐로..

SEND의 구현은 총 3개(2개?)이다.

1] Docomo USA 연구실에서 진행 하던것 - 현재는 종료/ 소스코드도 공개 하지 않고 있음



* 2번과 3번이 같은것 같기도 아닌것 같기도 하고..그건 좀더 살펴 봐야 할듯..

각 구현문의 특징, ND설명, SEND설명은 아래 논문을 보면 자세히 나와 있다..


[논문_2009] Easy-SEND_A Didactic Implementation of the Secure Neighbor Discovery Protocol for IPv6
p.s 혹시 1] 도코모의 SEND소스를 가지고 계신 있으시면 링크좀 알려 주세요 ^^
2010/05/27 00:54 2010/05/27 00:54

ns3 개요 ppt

분류없음 | 2010/02/03 20:19 | adioshun

2010년 한국 통신학회에서 개최한

ns2강좌의 마지막 섹션...

2010/02/03 20:19 2010/02/03 20:19