This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088

Dependents:   MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers NyLPC_cMDnsServer.h Source File

NyLPC_cMDnsServer.h

00001 /*********************************************************************************
00002  * PROJECT: MiMic
00003  * --------------------------------------------------------------------------------
00004  *
00005  * This file is part of MiMic
00006  * Copyright (C)2011 Ryo Iizuka
00007  *
00008  * MiMic is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License as published
00010  * by the Free Software Foundation, either version 3 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public License
00019  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020  *
00021  * For further information please contact.
00022  *  http://nyatla.jp/
00023  *  <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
00024  *
00025  *********************************************************************************/
00026 #ifndef NYLPC_CMDNSSERVER_H_
00027 #define NYLPC_CMDNSSERVER_H_
00028 #include "NyLPC_netif.h"
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif /* __cplusplus */
00033 
00034 
00035 /**
00036  * NyLPC_TDnsRecordで使用するサービスレコード
00037  */
00038 struct NyLPC_TMDnsServiceRecord
00039 {
00040     const char* protocol;
00041     NyLPC_TUInt16 port;
00042 };
00043 /**
00044  * DNSレコード
00045  */
00046 struct NyLPC_TDnsRecord
00047 {
00048     /** Service name*/
00049     const NyLPC_TChar* name;
00050     /** Host name recommended name[:emac:]*/
00051     const NyLPC_TChar* a;
00052     /**
00053      * 配列の数
00054      */
00055     NyLPC_TUInt16 num_of_srv;
00056     const struct NyLPC_TMDnsServiceRecord* srv;
00057 };
00058 
00059 
00060 
00061 /**
00062  * MDNSサーバクラス
00063  */
00064 typedef struct NyLPC_TcMDnsServer NyLPC_TcMDnsServer_t;
00065 
00066 
00067 
00068 struct NyLPC_TcMDnsServer
00069 {
00070     /** マルチキャストのUDPソケット*/
00071     NyLPC_TiUdpSocket_t* _socket;
00072     /**周期実行タイマ*/
00073     NyLPC_TcStopwatch_t _periodic_sw;
00074     /** 動作モード(private)*/
00075     NyLPC_TUInt8 _state;
00076     NyLPC_TUInt8 _state_val;
00077     NyLPC_TUInt8 _padding[2];
00078     /** DNSレコードの参照情報*/
00079     const struct NyLPC_TDnsRecord* _ref_record;
00080 };
00081 
00082 /**
00083  * スケッチシステムの場合、この関数はsetup時に実行してください。
00084  * @param i_ref_record
00085  * DNSレコードの参照値。インスタンス
00086  */
00087 NyLPC_TBool NyLPC_cMDnsServer_initialize(
00088     NyLPC_TcMDnsServer_t* i_inst,const struct NyLPC_TDnsRecord* i_ref_record);
00089 
00090 void NyLPC_cMDnsServer_finalize(
00091     NyLPC_TcMDnsServer_t* i_inst);
00092 
00093 void NyLPC_cMDnsServer_periodicRecvProc(NyLPC_TcMDnsServer_t* i_inst);
00094 /**
00095  * mDNSサービスを開始します。
00096  * 関数はstop関数をコールするまでの間ブロックします。
00097  */
00098 void NyLPC_cMDnsServer_start(NyLPC_TcMDnsServer_t* i_inst);
00099 /**
00100  * mDNSサービスを停止します。
00101  * 関数はサービスが停止するまでブロックします。
00102  */
00103 void NyLPC_cMDnsServer_stop(NyLPC_TcMDnsServer_t* i_inst);
00104 
00105 
00106 #ifdef __cplusplus
00107 }
00108 #endif /* __cplusplus */
00109 
00110 #endif