Sergey Pastor / 1

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers nbns_client.h Source File

nbns_client.h

Go to the documentation of this file.
00001 /**
00002  * @file nbns_client.h
00003  * @brief NBNS client (NetBIOS Name Service)
00004  *
00005  * @section License
00006  *
00007  * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.
00008  *
00009  * This file is part of CycloneTCP Open.
00010  *
00011  * This program is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU General Public License
00013  * as published by the Free Software Foundation; either version 2
00014  * of the License, or (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software Foundation,
00023  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00024  *
00025  * @author Oryx Embedded SARL (www.oryx-embedded.com)
00026  * @version 1.7.6
00027  **/
00028 
00029 #ifndef _NBNS_CLIENT_H
00030 #define _NBNS_CLIENT_H
00031 
00032 //Dependencies
00033 #include "core/net.h"
00034 #include "core/socket.h"
00035 #include "core/udp.h"
00036 #include "dns/dns_cache.h"
00037 #include "dns/dns_common.h"
00038 #include "netbios/nbns_common.h"
00039 
00040 //NBNS client support
00041 #ifndef NBNS_CLIENT_SUPPORT
00042    #define NBNS_CLIENT_SUPPORT ENABLED
00043 #elif (NBNS_CLIENT_SUPPORT != ENABLED && NBNS_CLIENT_SUPPORT != DISABLED)
00044    #error NBNS_CLIENT_SUPPORT parameter is not valid
00045 #endif
00046 
00047 //Maximum number of retransmissions of NBNS queries
00048 #ifndef NBNS_CLIENT_MAX_RETRIES
00049    #define NBNS_CLIENT_MAX_RETRIES 3
00050 #elif (NBNS_CLIENT_MAX_RETRIES < 1)
00051    #error NBNS_CLIENT_MAX_RETRIES parameter is not valid
00052 #endif
00053 
00054 //Initial retransmission timeout
00055 #ifndef NBNS_CLIENT_INIT_TIMEOUT
00056    #define NBNS_CLIENT_INIT_TIMEOUT 1000
00057 #elif (NBNS_CLIENT_INIT_TIMEOUT < 1000)
00058    #error NBNS_CLIENT_INIT_TIMEOUT parameter is not valid
00059 #endif
00060 
00061 //Maximum retransmission timeout
00062 #ifndef NBNS_CLIENT_MAX_TIMEOUT
00063    #define NBNS_CLIENT_MAX_TIMEOUT 1000
00064 #elif (NBNS_CLIENT_MAX_TIMEOUT < 1000)
00065    #error NBNS_CLIENT_MAX_TIMEOUT parameter is not valid
00066 #endif
00067 
00068 //Maximum cache lifetime for NBNS entries
00069 #ifndef NBNS_MAX_LIFETIME
00070    #define NBNS_MAX_LIFETIME 60000
00071 #elif (NBNS_MAX_LIFETIME < 1000)
00072    #error NBNS_MAX_LIFETIME parameter is not valid
00073 #endif
00074 
00075 //NBNS related functions
00076 error_t nbnsResolve(NetInterface *interface, const char_t *name, IpAddr *ipAddr);
00077 
00078 error_t nbnsSendQuery(DnsCacheEntry *entry);
00079 
00080 void nbnsProcessResponse(NetInterface *interface, const Ipv4PseudoHeader *pseudoHeader,
00081    const UdpHeader *udpHeader, const NbnsHeader *message, size_t length);
00082 
00083 #endif
00084