40 kprintf(
"Cannot find a DNS server\n");
57 qpkt.qucount =
htons(1);
102 llptr = (
byte*)(data++);
111 for(i = 0; i < dlen; i++) {
116 if(dname[i] !=
'.') {
122 llptr = (
byte*)(data++);
136 memcpy(data, (
char *)&tmp, 2);
143 memcpy(data, (
char *)&tmp, 2);
148 return sizeof(
struct dnspkt) - DNSDATASIZ + qlen;
171 qcount =
ntohs(tmp16);
176 for(i = 0; i < qcount; i++) {
180 llen = *((
byte *)dptr);
196 llen = *((
byte *)dptr);
213 acount =
ntohs(tmp16);
221 for(i = 0; i < acount; i++) {
238 memcpy((
char *)&tmptype, dptr, 2);
244 memcpy((
char *)&tmpip, dptr+10, 4);
259 memcpy((
char *)&tmplen, dptr, 2);
260 dptr +=
ntohs(tmplen) + 2;
300 for(i = 0; i < llen; i++) {
308 memcpy( (
char *)&tmpoff, son, 2);
309 offset =
ntohs(tmpoff) & 0x3fff;
321 return (
uint32)(son-sson);
syscall kprintf(char *fmt,...)
ポーリングI/Oを使用して、フォーマットされた文字列をコンソールに出力する。
#define NULL
連結リスト用のNULLポインタ
int32 udp_recv(uid32, char *, int32, uint32)
status udp_send(uid32, char *, int32)
unsigned char byte
符号なし8ビット値(unsigned char)
int32 strncmp(const char *, const char *, int32)
local uint32 dns_geta(char *, struct dnspkt *)
int strlen(char *str)
NULL終端された文字列の長さを返す。NULL終端は長さに含まない。
local uint32 dns_getrname(char *, char *, char *)
#define TIMEOUT
システムコールがタイムアウトした場合
int data
データセグメントの開始アドレス(リンカが追加する)
int int32
符号あり32ビット整数(int)
local uint32 dns_bldq(char *, char *)
uid32 udp_register(uint32, uint16, uint16)
unsigned short uint16
符号なし16ビット整数(unsigned short)
void * memset(void *, const int, int32)
指定のByteブロックに対して、同じ値をNバイト分書き込む。
status udp_release(uid32)
#define local
ローカル関数かローカル変数の宣言
int32 namlen(char *, int32)
unsigned int uint32
符号なし32ビット整数(unsigned int)
int32 uid32
UDPテーブルディスクリプタのID.
#define NULLCH
NULL文字(NULL終端)
void * memcpy(void *, const void *, int32)
メモリAの領域(source)からメモリBの領域(Destination)にN Byteコピーする。
uint32 dnslookup(char *dname)