qshinoの日記

Powershell関係と徒然なこと

PPPoE

PPPoE

PPPoEは二つのセッションに別れる。

  1. Discovery
  2. PPP

Discovery

ここでは、PPPoE Active Discovery パケットがやり取りされる。本パケットには、下記のものがある。

  1. PADI. : Initialize
  2. PDO. : Offer
  3. PADR : Request
  4. PADS : Session-Confirmation

PPP

PPPセッションは、4段階からなる。

  1. LCP調整 : Link Control Protocol
  2. 認証 : Pap or Chap
  3. IPCP : IPアドレス付与
  4. PPP通信 : 通信

最後のPPP通信段階が通常の通信状態である。

参考

http://www.infraexpert.com/study/wan9.html

EtherIP/IPsec

EtherIP/IPsec

Softether + IX2000シリーズ。

  • ike mode aggressive
  • ipsec mode tunnel
  • ike id 入力値
  • pre-shared-key 入力値

  • peer se側 恐らくany

  • peer ix側 seのIP
  • nat traversal on

  • ike aes / sha DH group2/ 1024bit

  • ipsec aes/sha

パケット

  • 元 eth ip0 payload
  • eip: ip1 eip eth ip0 payload
  • eip/tunnel ip2 esp ip1 eip eth ip0
  • eip/natt ip2 udp esp ip1 eip eth ip0

ip2 = peer ip1 = ??? ip0 = private

使用ポート

参考

https://ja.m.wikipedia.org/wiki/NAT_traversal

Windows Installer作成ツール

Windows Installer作成ツール

主なツールは下記の通り。

  1. WiX Toolset
  2. Inno Setup
  3. Nullsoft Scriptable Install System (NSIS)

WiXのみ、WindowsInstallの仕組みを利用している。

WiXが難しそうなので、トライして撃退されたらInno Setupが良さそうな雰囲気。取り敢えず、3つを調べた上で最終的に採用するものを決める。

参考

wix チュートリアル

http://wix-tutorial-ja.github.io/preface.html

wix 使い方

https://codezine.jp/article/detail/428

https://msdn.microsoft.com/ja-jp/library/bb164671.aspx

http://qiita.com/tohshima/items/314143d605f8ae1e0d87

PowerShell Action delegate

PowerShell Action delegate

Action/Funcはdelegate

  • Action : 戻り値なし、引数なし。
  • Action: 戻り値なし、引数1
  • Func<T,TResult: 戻り値1,引数1

PowerShellでは

  • [action]
  • [action[int]]
  • [func[int][int]] ?
  • or func[int,int]] ?

Funcの例

Func<T,TResult>

using System;

public class GenericFunc
{
   public static void Main()
   {
      // Instantiate delegate to reference UppercaseString method
      Func<string, string> convertMethod = UppercaseString;
      string name = "Dakota";
      // Use delegate instance to call UppercaseString method
      Console.WriteLine(convertMethod(name));
   }

   private static string UppercaseString(string inputString)
   {
      return inputString.ToUpper();
   }
}

参考

Powershell delegate

http://stackoverflow.com/questions/19849848/powershell-how-to-create-a-delegate

System.Action

https://msdn.microsoft.com/ja-jp/library/system.action(v=vs.110).aspx

System.Action

https://msdn.microsoft.com/ja-jp/library/018hxwa8(v=vs.110).aspx

System.Func<T,TResult>

https://msdn.microsoft.com/ja-jp/library/bb549151(v=vs.110).aspx

wpfクリップボード

wpfクリップボードを使う。

クリップボードへのテキストコピーは、

Clipboard.SetData(DataFormats.Text, (Object)txet);

取り出すには、同様にGetDataを用いる。

サンプル

// copy string
string textData = "Hinan.";

// To clipboard
Clipboard.SetData(DataFormats.Text, (Object)textData);

参考

System.Windows.Clipboard

Assembly: PresentationCore

https://msdn.microsoft.com/ja-jp/library/system.windows.clipboard(v=vs.110).aspx

http://anis774.net/codevault/clipboardwatcherwpf.html

http://blog.hiros-dot.net/?page_id=3797

http://blog.hiros-dot.net/?page_id=3797

http://dobon.net/vb/dotnet/string/clipboard.html

以上