Changeset 31e9fe0 in mainline


Ignore:
Timestamp:
2013-04-23T22:05:01Z (11 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c55cbbf
Parents:
dc95342
Message:

Dnsrsrv server and dnsres utility.

Files:
5 added
5 edited
10 moved

Legend:

Unmodified
Added
Removed
  • boot/Makefile.common

    rdc95342 r31e9fe0  
    112112        $(USPACE_PATH)/srv/hid/remcons/remcons \
    113113        $(USPACE_PATH)/srv/hid/isdv4_tablet/isdv4_tablet \
    114         $(USPACE_PATH)/srv/net/dnsres/dnsres \
     114        $(USPACE_PATH)/srv/net/dnsrsrv/dnsrsrv \
    115115        $(USPACE_PATH)/srv/net/ethip/ethip \
    116116        $(USPACE_PATH)/srv/net/inetsrv/inetsrv \
     
    166166        $(USPACE_PATH)/app/dltest2/dltest2 \
    167167        $(USPACE_PATH)/app/dload/dload \
     168        $(USPACE_PATH)/app/dnsres/dnsres \
    168169        $(USPACE_PATH)/app/edit/edit \
    169170        $(USPACE_PATH)/app/inet/inet \
  • uspace/Makefile

    rdc95342 r31e9fe0  
    3939        app/bnchmark \
    4040        app/devctl \
     41        app/dnsres \
    4142        app/edit \
    4243        app/getterm \
     
    8283        srv/devman \
    8384        srv/loader \
    84         srv/net/dnsres \
     85        srv/net/dnsrsrv \
    8586        srv/net/ethip \
    8687        srv/net/inetsrv \
  • uspace/app/dnsres/dnsres.c

    rdc95342 r31e9fe0  
    11/*
    2  * Copyright (c) 2012 Jiri Svoboda
     2 * Copyright (c) 2013 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3030 * @{
    3131 */
    32 /**
    33  * @file
     32/** @file DNS query utility.
    3433 */
    3534
     35#include <errno.h>
     36#include <inet/dnsr.h>
    3637#include <stdio.h>
    3738#include <stdlib.h>
    38 #include <errno.h>
    3939
    40 #include "dns_msg.h"
    41 #include "dns_std.h"
    42 #include "query.h"
     40#define NAME "dnsres"
    4341
    44 #define NAME  "dnsres"
     42static void print_syntax(void)
     43{
     44        printf("syntax: " NAME " <host-name>\n");
     45}
    4546
    4647static int addr_format(inet_addr_t *addr, char **bufp)
     
    6061int main(int argc, char *argv[])
    6162{
    62         dns_host_info_t *hinfo;
    63         char *astr;
    6463        int rc;
     64        dnsr_hostinfo_t *hinfo;
     65        char *saddr;
    6566
    66         printf("%s: DNS Resolution Service\n", NAME);
    67         rc = dns_name2host(argc < 2 ? "helenos.org" : argv[1], &hinfo);
    68         printf("dns_name2host() -> rc = %d\n", rc);
     67        rc = dnsr_init();
     68        if (rc != EOK) {
     69                printf(NAME ": Failed connecting to DNS resolution service "
     70                    "(%d).\n", rc);
     71                return 1;
     72        }
    6973
    70         if (rc == EOK) {
    71                 rc = addr_format(&hinfo->addr, &astr);
    72                 if (rc != EOK) {
    73                         dns_hostinfo_destroy(hinfo);
    74                         printf("Out of memory\n");
    75                         return ENOMEM;
    76                 }
     74        if (argc != 2) {
     75                print_syntax();
     76                return 1;
     77        }
    7778
    78                 printf("hostname: %s\n", hinfo->name);
    79                 printf("IPv4 address: %s\n", astr);
    80                 free(astr);
    81                 dns_hostinfo_destroy(hinfo);
     79        rc = dnsr_name2host(argv[1], &hinfo);
     80        if (rc != EOK) {
     81                printf(NAME ": Error resolving '%s'.\n", argv[1]);
     82                return 1;
    8283        }
     84
     85        rc = addr_format(&hinfo->addr, &saddr);
     86        if (rc != EOK) {
     87                dnsr_hostinfo_destroy(hinfo);
     88                printf(NAME ": Out of memory.\n");
     89                return 1;
     90        }
     91
     92        printf("Host name: %s address: %s\n", hinfo->name, saddr);
     93        dnsr_hostinfo_destroy(hinfo);
     94        free(saddr);
    8395
    8496        return 0;
  • uspace/app/init/init.c

    rdc95342 r31e9fe0  
    359359        srv_start("/srv/tcp");
    360360        srv_start("/srv/udp");
     361        srv_start("/srv/dnsrsrv");
    361362       
    362363        srv_start("/srv/clipboard");
  • uspace/lib/c/Makefile

    rdc95342 r31e9fe0  
    7474        generic/device/pci.c \
    7575        generic/device/ahci.c \
     76        generic/dnsr.c \
    7677        generic/dlfcn.c \
    7778        generic/elf/elf_load.c \
  • uspace/lib/c/include/ipc/services.h

    rdc95342 r31e9fe0  
    5353} services_t;
    5454
     55#define SERVICE_NAME_DNSR     "net/dnsr"
    5556#define SERVICE_NAME_INET     "net/inet"
    5657#define SERVICE_NAME_INETCFG  "net/inetcfg"
  • uspace/srv/net/dnsrsrv/Makefile

    rdc95342 r31e9fe0  
    2828
    2929USPACE_PREFIX = ../../..
    30 BINARY = dnsres
     30BINARY = dnsrsrv
    3131
    3232SOURCES = \
    3333        dns_msg.c \
    34         dnsres.c \
     34        dnsrsrv.c \
    3535        query.c \
    3636        transport.c
  • uspace/srv/net/dnsrsrv/dns_type.h

    rdc95342 r31e9fe0  
    105105} dns_host_info_t;
    106106
     107typedef struct {
     108} dnsr_client_t;
     109
    107110#endif
    108111
Note: See TracChangeset for help on using the changeset viewer.