Classes | Macros | Functions | Variables
dns-server.c File Reference
#include "uv.h"
#include "task.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for dns-server.c:

Go to the source code of this file.

Classes

struct  dnshandle
 
struct  dnsstate
 
struct  write_req_t
 

Macros

#define DNSREC_LEN   (4)
 
#define LEN_OFFSET   0
 
#define QUERYID_OFFSET   2
 
#define WRITE_BUF_LEN   (64*1024)
 

Functions

static void addrsp (write_req_t *wr, char *hdr)
 
static void after_read (uv_stream_t *, ssize_t nread, const uv_buf_t *buf)
 
static void after_shutdown (uv_shutdown_t *req, int status)
 
static void after_write (uv_write_t *req, int status)
 
static void buf_alloc (uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf)
 
static int dns_start (int port)
 
 HELPER_IMPL (dns_server)
 
static void on_close (uv_handle_t *peer)
 
static void on_connection (uv_stream_t *, int status)
 
static void process_req (uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf)
 

Variables

static unsigned char arecord []
 
static unsigned char DNSRsp []
 
static uv_loop_tloop
 
static unsigned char qrecord []
 
static uv_tcp_t server
 

Macro Definition Documentation

◆ DNSREC_LEN

#define DNSREC_LEN   (4)

Definition at line 62 of file dns-server.c.

◆ LEN_OFFSET

#define LEN_OFFSET   0

Definition at line 64 of file dns-server.c.

◆ QUERYID_OFFSET

#define QUERYID_OFFSET   2

Definition at line 65 of file dns-server.c.

◆ WRITE_BUF_LEN

#define WRITE_BUF_LEN   (64*1024)

Definition at line 61 of file dns-server.c.

Function Documentation

◆ addrsp()

static void addrsp ( write_req_t wr,
char *  hdr 
)
static

Definition at line 102 of file dns-server.c.

◆ after_read()

static void after_read ( uv_stream_t handle,
ssize_t  nread,
const uv_buf_t buf 
)
static

Definition at line 234 of file dns-server.c.

◆ after_shutdown()

static void after_shutdown ( uv_shutdown_t req,
int  status 
)
static

Definition at line 96 of file dns-server.c.

◆ after_write()

static void after_write ( uv_write_t req,
int  status 
)
static

Definition at line 80 of file dns-server.c.

◆ buf_alloc()

static void buf_alloc ( uv_handle_t handle,
size_t  suggested_size,
uv_buf_t buf 
)
static

Definition at line 268 of file dns-server.c.

◆ dns_start()

static int dns_start ( int  port)
static

Definition at line 301 of file dns-server.c.

◆ HELPER_IMPL()

HELPER_IMPL ( dns_server  )

Definition at line 332 of file dns-server.c.

◆ on_close()

static void on_close ( uv_handle_t peer)
static

Definition at line 263 of file dns-server.c.

◆ on_connection()

static void on_connection ( uv_stream_t server,
int  status 
)
static

Definition at line 276 of file dns-server.c.

◆ process_req()

static void process_req ( uv_stream_t handle,
ssize_t  nread,
const uv_buf_t buf 
)
static

Definition at line 127 of file dns-server.c.

Variable Documentation

◆ arecord

unsigned char arecord[]
static
Initial value:
= {
0xc0, 0x0c, 0, 1, 0, 1, 0, 0, 5, 0xbd, 0, 4, 10, 0, 1, 1
}

Definition at line 75 of file dns-server.c.

◆ DNSRsp

unsigned char DNSRsp[]
static
Initial value:
= {
0, 43, 0, 0, 0x81, 0x80, 0, 1, 0, 1, 0, 0, 0, 0
}

Definition at line 67 of file dns-server.c.

◆ loop

uv_loop_t* loop
static

Definition at line 50 of file dns-server.c.

◆ qrecord

unsigned char qrecord[]
static
Initial value:
= {
5, 'e', 'c', 'h', 'o', 's', 3, 's', 'r', 'v', 0, 0, 1, 0, 1
}

Definition at line 71 of file dns-server.c.

◆ server

uv_tcp_t server
static

Definition at line 53 of file dns-server.c.



grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:11