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_cNet.c Source File

NyLPC_cNet.c

00001 
00002 #include "NyLPC_cNet.h"
00003 #include "./mimicip/NyLPC_cMiMicIpNetIf_protected.h"
00004 #include "dhcp/NyLPC_cDhcpClient.h"
00005 #include "apipa/NyLPC_cApipa.h"
00006 
00007 
00008 /**
00009  * 唯一のネットワークインタフェイス
00010  */
00011 const static struct NyLPC_TiNetInterface_Interface* netif;
00012 
00013 
00014 
00015 
00016 
00017 void NyLPC_cNet_initialize(const struct NyLPC_TiNetInterface_Interface* i_netif)
00018 {
00019     NyLPC_Assert(netif==NULL);
00020     netif=i_netif;
00021 }
00022 
00023 void NyLPC_cNet_start(const NyLPC_TcIPv4Config_t* i_ref_config)
00024 {
00025     netif->start(i_ref_config);
00026     return;
00027 }
00028 
00029 void NyLPC_cNet_stop(void)
00030 {
00031     netif->stop();
00032     return;
00033 }
00034 
00035 
00036 
00037 /**
00038  * 指定したIPアドレスを要求するARPリクエストを発行します。
00039  */
00040 void NyLPC_cNet_sendArpRequest(const struct NyLPC_TIPv4Addr* i_addr)
00041 {
00042     netif->sendarprequest(i_addr);
00043 }
00044 /**
00045  * ARPテーブルに指定したIPがあるかを返します。
00046  */
00047 NyLPC_TBool NyLPC_cNet_hasArpInfo(const struct NyLPC_TIPv4Addr* i_addr)
00048 {
00049     return netif->hasarpinfo(i_addr);
00050 }
00051 
00052 NyLPC_TBool NyLPC_cNet_isInitService(void)
00053 {
00054     return netif->isinitservice();
00055 }
00056 
00057 NyLPC_TiTcpSocket_t* NyLPC_cNet_createTcpSocketEx(NyLPC_TSocketType i_socktype)
00058 {
00059     return netif->createTcpSocketEx(i_socktype);
00060 }
00061 NyLPC_TiUdpSocket_t* NyLPC_cNet_createUdpSocketEx(NyLPC_TUInt16 i_port,NyLPC_TSocketType i_socktype)
00062 {
00063     return netif->createUdpSocetEx(i_port,i_socktype);
00064 }
00065 NyLPC_TiTcpListener_t* NyLPC_cNet_createTcpListenerEx(NyLPC_TUInt16 i_port)
00066 {
00067     return netif->createTcpListener(i_port);
00068 }
00069 
00070 const struct NyLPC_TNetInterfaceInfo* NyLPC_cNet_getInterfaceInfo(void)
00071 {
00072     return netif->getinterfaceinfo();
00073 }
00074 
00075 
00076 
00077 NyLPC_TBool NyLPC_cNet_requestAddrDhcp(NyLPC_TcIPv4Config_t* i_cfg,NyLPC_TInt16 i_repeat)
00078 {
00079     NyLPC_TBool ret;
00080     NyLPC_TcDhcpClient_t sock;
00081     //netを開始
00082     NyLPC_cDhcpClient_initialize(&sock);
00083     ret=NyLPC_cDhcpClient_requestAddr(&sock,i_cfg,i_repeat);
00084     NyLPC_cDhcpClient_finalize(&sock);
00085     return ret;
00086 }
00087 
00088 NyLPC_TBool NyLPC_cNet_requestAddrApipa(NyLPC_TcIPv4Config_t* i_cfg,NyLPC_TInt16 i_repeat)
00089 {
00090     NyLPC_TBool ret;
00091     NyLPC_TcApipa_t sock;
00092     //netを開始
00093     NyLPC_cApipa_initialize(&sock);
00094     ret=NyLPC_cApipa_requestAddr(&sock,i_cfg,i_repeat);
00095     NyLPC_cApipa_finalize(&sock);
00096     return ret;
00097 }
00098 
00099 
00100 
00101