<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>280W =終焉の宴=</title>
    <link>http://www.280w.info/</link>
    <description>280W プラス 弾幕アスレチックス</description>
    <!-- optional tags -->
    <language>ja</language>           <!-- valid langugae goes here -->
    <generator>Nucleus CMS v3.31SP1</generator>
    <copyright>&#169;</copyright>             <!-- Copyright notice -->
    <category>Weblog</category>
    <docs>http://backend.userland.com/rss</docs>
    <image>
      <url>http://www.280w.info//nucleus/nucleus2.gif</url>
      <title>280W =終焉の宴=</title>
      <link>http://www.280w.info/</link>
    </image>
    <item>
 <title><![CDATA[[C#]Parallel Port joystickをアプリケーションから操作する]]></title>
 <link>http://www.280w.info/item/456</link>
<description><![CDATA[PPJoyで、Virtual portを使って仮想ジョイスティックを作成し、<br />
その仮想ジョイスティックをアプリケーションから操作してみた。まだ実験メモ。<br />
作ったのはC#.net 2005かも。<br />
<br />
あくまでも実験段階なのでコードが間違ってる可能性が<b>非常に</b>高いです。<br />
<br />
まずPPJOYでVirtual joystickを作ってみた。<br />
<br />
<br />
<br />
DLLインポートとか<br />
<div class="csharp"><br />
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Runtime.InteropServices</span><span style="color: #008000;">;</span><br />
&nbsp;</div><br />
<br />
デバイスオープンの為の列挙型を4個ほど。<br />
<br />
<div class="csharp"><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">enum</span> DesiredAccess <span style="color: #008000;">:</span> <span style="color: #6666cc; font-weight: bold;">uint</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GENERIC_READ <span style="color: #008000;">=</span> 0x80000000,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GENERIC_WRITE <span style="color: #008000;">=</span> 0x40000000,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GENERIC_EXECUTE <span style="color: #008000;">=</span> 0x20000000<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">enum</span> ShareMode <span style="color: #008000;">:</span> <span style="color: #6666cc; font-weight: bold;">uint</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FILE_SHARE_READ <span style="color: #008000;">=</span> 0x00000001,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FILE_SHARE_WRITE <span style="color: #008000;">=</span> 0x00000002,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FILE_SHARE_DELETE <span style="color: #008000;">=</span> 0x00000004<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">enum</span> CreationDisposition <span style="color: #008000;">:</span> <span style="color: #6666cc; font-weight: bold;">uint</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CREATE_NEW <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CREATE_ALWAYS <span style="color: #008000;">=</span> <span style="color: #FF0000;">2</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OPEN_EXISTING <span style="color: #008000;">=</span> <span style="color: #FF0000;">3</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OPEN_ALWAYS <span style="color: #008000;">=</span> <span style="color: #FF0000;">4</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TRUNCATE_EXISTING <span style="color: #008000;">=</span> <span style="color: #FF0000;">5</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">enum</span> FlagsAndAttributes <span style="color: #008000;">:</span> <span style="color: #6666cc; font-weight: bold;">uint</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FILE_ATTRIBUTE_ARCHIVE <span style="color: #008000;">=</span> 0x00000020,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FILE_ATTRIBUTE_ENCRYPTED <span style="color: #008000;">=</span> 0x00004000,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FILE_ATTRIBUTE_HIDDEN <span style="color: #008000;">=</span> 0x00000002,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FILE_ATTRIBUTE_NORMAL <span style="color: #008000;">=</span> 0x00000080,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FILE_ATTRIBUTE_NOT_CONTENT_INDEXED <span style="color: #008000;">=</span> 0x00002000,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FILE_ATTRIBUTE_OFFLINE <span style="color: #008000;">=</span> 0x00001000,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FILE_ATTRIBUTE_READONLY <span style="color: #008000;">=</span> 0x00000001,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FILE_ATTRIBUTE_SYSTEM <span style="color: #008000;">=</span> 0x00000004,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FILE_ATTRIBUTE_TEMPORARY <span style="color: #008000;">=</span> 0x00000100<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp;</div><br />
<br />
デバイスオープン用の関数をば。<br />
<div class="csharp"><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//ジョイスティックオープン用</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#91;</span>DllImport<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;kernel32.dll&quot;</span>, CharSet <span style="color: #008000;">=</span> CharSet<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Auto</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">extern</span> IntPtr CreateFile<span style="color: #008000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">string</span> lpFileName,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DesiredAccess dwDesiredAccess,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ShareMode dwShareMode,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">int</span> lpSecurityAttributes,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CreationDisposition dwCreationDisposition, <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FlagsAndAttributes dwFlagsAndAttributes,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntPtr hTemplateFile<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp;</div><br />
<br />
そしてデータを送る為の関数。<br />
因みにDeviceIoControlの3番目の引数は、<br />
Byte配列のポインタらしき物を送るらしい。<br />
で、C#で配列を含む構造体をByte配列にするのが面倒だったから<br />
JOYSTICK_STATE構造体を作ってそのまま投げてみた。　※ボタンは上手く行くがなんとも調子が悪い気がする<br />
<div class="csharp"><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//データを送る</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#91;</span>DllImport<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;kernel32&quot;</span>, SetLastError <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#91;</span><span style="color: #0600FF; font-weight: bold;">return</span><span style="color: #008000;">:</span> MarshalAs<span style="color: #008000;">&#40;</span>UnmanagedType<span style="color: #008000;">.</span><span style="color: #6666cc; font-weight: bold;">Bool</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">extern</span> <span style="color: #6666cc; font-weight: bold;">bool</span> DeviceIoControl<span style="color: #008000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntPtr hDevice,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">uint</span> dwIoControlCode,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">ref</span> JOYSTICK_STATE lpInBuffer,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">uint</span> uInBufferSize,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">ref</span> <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> lpOutBuffer,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">uint</span> uOutBufferSize,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">ref</span> <span style="color: #6666cc; font-weight: bold;">int</span> lpBytesReturned,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">int</span> Overlapped<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp;</div><br />
<br />
後、CTL_CODEという謎のビット演算する関数が必要らしい。<br />
<br />
<div class="csharp"><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">uint</span> CTL_CODE<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">uint</span> DeviceType, <span style="color: #6666cc; font-weight: bold;">uint</span> Function, <span style="color: #6666cc; font-weight: bold;">uint</span> Method, <span style="color: #6666cc; font-weight: bold;">uint</span> Access<span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DeviceType <span style="color: #008000;">&lt;&lt;</span> <span style="color: #FF0000;">16</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">|</span> <span style="color: #008000;">&#40;</span>Access <span style="color: #008000;">&lt;&lt;</span> <span style="color: #FF0000;">14</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">|</span> <span style="color: #008000;">&#40;</span>Function <span style="color: #008000;">&lt;&lt;</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">|</span> Method<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp;</div><br />
<br />
先ほどのジョイスティック構造体の中身<br />
Pack = 1を書き忘れて時間をとても残念に消費してしまったよ。<br />
<div class="csharp"><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#91;</span>StructLayout<span style="color: #008000;">&#40;</span>LayoutKind<span style="color: #008000;">.</span><span style="color: #0000FF;">Sequential</span>, Pack <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">struct</span> JOYSTICK_STATE<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#91;</span>MarshalAs<span style="color: #008000;">&#40;</span>UnmanagedType<span style="color: #008000;">.</span><span style="color: #0000FF;">U4</span>, SizeConst <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">uint</span> Signature<span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#91;</span>MarshalAs<span style="color: #008000;">&#40;</span>UnmanagedType<span style="color: #008000;">.</span><span style="color: #0000FF;">U1</span>, SizeConst <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">char</span> NumAnalog<span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#91;</span>MarshalAs<span style="color: #008000;">&#40;</span>UnmanagedType<span style="color: #008000;">.</span><span style="color: #0000FF;">ByValArray</span>, SizeConst <span style="color: #008000;">=</span> <span style="color: #FF0000;">8</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> Analog<span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#91;</span>MarshalAs<span style="color: #008000;">&#40;</span>UnmanagedType<span style="color: #008000;">.</span><span style="color: #0000FF;">U1</span>, SizeConst <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">char</span> NumDigital<span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#91;</span>MarshalAs<span style="color: #008000;">&#40;</span>UnmanagedType<span style="color: #008000;">.</span><span style="color: #0000FF;">ByValArray</span>, SizeConst <span style="color: #008000;">=</span> <span style="color: #FF0000;">16</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> Digital<span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp;</div><br />
<br />
さてこっから実際にジョイスティックに対して処理をしていく。<br />
<br />
ジョイスティックデバイスをオープン。\\.\PPJoyIOCTL1っていう名前のジョイスティックらしい。<br />
<div class="csharp"><br />
IntPtr hPtr <span style="color: #008000;">=</span> CreateFile<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\\</span><span style="color: #008080; font-weight: bold;">\\</span>.<span style="color: #008080; font-weight: bold;">\\</span>PPJoyIOCTL1&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DesiredAccess<span style="color: #008000;">.</span><span style="color: #0000FF;">GENERIC_WRITE</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ShareMode<span style="color: #008000;">.</span><span style="color: #0000FF;">FILE_SHARE_WRITE</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">0</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CreationDisposition<span style="color: #008000;">.</span><span style="color: #0000FF;">OPEN_EXISTING</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">0</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntPtr<span style="color: #008000;">.</span><span style="color: #0000FF;">Zero</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp;</div><br />
<br />
Signatureのコードとか、ボタンのAnalog, Digitalの数はPPJoyのサンプルコードから拝借。<br />
<br />
joyState.Digital[0] = (char)1; ってなってるのは、ボタン1を押してる状態ってこと。<br />
0は離した状態かな。<br />
Analogの方はまだよく分からない。ちょうど中心は1～128の間の64かと思ったんだけど、<br />
これだと何か変な方向へ動く。　<br />
もしかしたら-127～128かもしれないし、まだ実験してないからなんとも。<br />
<br />
<div class="csharp"><br />
JOYSTICK_STATE joyState <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> JOYSTICK_STATE<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Signature</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">uint</span><span style="color: #008000;">&#41;</span>0x53544143<span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">NumAnalog</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">8</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">NumDigital</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">16</span><span style="color: #008000;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Analog</span> <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #6666cc; font-weight: bold;">int</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">8</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Analog</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">64</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Analog</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">64</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Analog</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">2</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">64</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Analog</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">3</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">64</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Analog</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">4</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">64</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Analog</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">5</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">64</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Analog</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">6</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">64</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Analog</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">7</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">64</span><span style="color: #008000;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span> <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">16</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">2</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">3</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">4</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">5</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">6</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">7</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">8</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">9</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">10</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">11</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">12</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">13</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">14</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">15</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#41;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp;</div><br />
<br />
ここもサンプルコードから拝借。なぜFILE_DEVICE_UNKNOWNでいいのかは分からないよ。<br />
<div class="csharp"><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//FILE_DEVICE_UNKNOWN = 0x22, index = 0, METHOD_BUFFERED = 0, FILE_ANY_ACCEESS = 0</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">uint</span> ioctlState <span style="color: #008000;">=</span> CTL_CODE<span style="color: #008000;">&#40;</span>0x00000022, <span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp;</div><br />
<br />
実際にデバイスにデータを送る段階。<br />
配列含んだ構造体のサイズを一発で取得する方法が思いつかなかったので、律儀に足してみた。<br />
誰かいい方法教えてください。<br />
<br />
<div class="csharp"><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">int</span> RetSize <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> outBuffer <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">int</span> joySize <span style="color: #008000;">=</span> Marshal<span style="color: #008000;">.</span><a href="http://www.google.com/search?q=sizeof+msdn.microsoft.com"><span style="color: #008000;">SizeOf</span></a><span style="color: #008000;">&#40;</span>joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Signature</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joySize <span style="color: #008000;">+=</span> Marshal<span style="color: #008000;">.</span><a href="http://www.google.com/search?q=sizeof+msdn.microsoft.com"><span style="color: #008000;">SizeOf</span></a><span style="color: #008000;">&#40;</span>joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">NumAnalog</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joySize <span style="color: #008000;">+=</span> Marshal<span style="color: #008000;">.</span><a href="http://www.google.com/search?q=sizeof+msdn.microsoft.com"><span style="color: #008000;">SizeOf</span></a><span style="color: #008000;">&#40;</span>joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Analog</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">*</span> <span style="color: #FF0000;">8</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joySize <span style="color: #008000;">+=</span> Marshal<span style="color: #008000;">.</span><a href="http://www.google.com/search?q=sizeof+msdn.microsoft.com"><span style="color: #008000;">SizeOf</span></a><span style="color: #008000;">&#40;</span>joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">NumDigital</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; joySize <span style="color: #008000;">+=</span> Marshal<span style="color: #008000;">.</span><a href="http://www.google.com/search?q=sizeof+msdn.microsoft.com"><span style="color: #008000;">SizeOf</span></a><span style="color: #008000;">&#40;</span>joyState<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">*</span> <span style="color: #FF0000;">16</span><span style="color: #008000;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DeviceIoControl<span style="color: #008000;">&#40;</span>hPtr, ioctlState, <span style="color: #0600FF; font-weight: bold;">ref</span> joyState, <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">uint</span><span style="color: #008000;">&#41;</span>joySize, <span style="color: #0600FF; font-weight: bold;">ref</span> outBuffer, <span style="color: #FF0000;">0</span>, <span style="color: #0600FF; font-weight: bold;">ref</span> RetSize, <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp;</div><br />
<br />
うまく行けば、ゲームパッドのプロパティの所でボタン１が押されてると思う。<br />
とりあえずメモまで。]]></description>
 <category>プログラミング</category>
<comments>http://www.280w.info/item/456</comments>
 <pubDate>Mon, 1 Mar 2010 18:08:09 +0900</pubDate>
</item><item>
 <title><![CDATA[フレッツにCiscoルータで接続]]></title>
 <link>http://www.280w.info/item/448</link>
<description><![CDATA[我が家も友人にそそのかされ、ルータが<a href="http://www.cisco.com/web/JP/product/hs/routers/c2600/prodlit/2600mar_ds.html">Cisco 2611XM</a>に入れ替わってしまった。<br />
<br />
<br />
<br />
今まで使っていたブロードバンドルータ（<a href="http://www.mrl.co.jp/product/nwgoptg5.htm">SuperOPT-GFive</a>）を使ったいたときと同じように接続するため、PPPoEとPATの設定を行いました。<br />
<br />
FastEthernet0/0 をWAN側、<br />
FastEthernet0/1 をLAN側にしたよ。<br />
<br />
設定を一部抜き出すと・・・<br />
<br />
----<br />
interface FastEthernet0/0<br />
 no ip address<br />
 duplex auto<br />
 speed auto<br />
 pppoe enable group global<br />
 pppoe-client dial-pool-number 1<br />
 no cdp enable<br />
<br />
interface FastEthernet0/1<br />
 ip address 192.168.1.1 255.255.255.0<br />
 ip nat inside<br />
 duplex auto<br />
 speed auto<br />
<br />
interface Dialer0<br />
 ip address negotiated<br />
 ip access-group DENY-TELNET in<br />
 ip mtu 1454<br />
 ip nat outside<br />
 encapsulation ppp<br />
 ip tcp adjust-mss 1414<br />
 dialer pool 1<br />
 dialer idle-timeout 0<br />
 dialer-group 1<br />
 ppp authentication chap callin<br />
 ppp chap hostname ○○××@hogehoge.com<br />
 ppp chap password ××○○<br />
<br />
ip route 0.0.0.0 0.0.0.0 Dialer0<br />
no ip http server<br />
no ip http secure-server<br />
ip dns server<br />
<br />
ip access-list extended DENY-TELNET<br />
 deny   tcp any any eq telnet<br />
 permit ip any any<br />
<br />
dialer-list 1 protocol ip permit<br />
<br />
ip access-list extended IT03<br />
 permit ip 192.168.1.0 0.0.0.255 any<br />
<br />
ip nat inside source list NETCON interface Dialer0 overload<br />
----<br />
<br />
<b>[ FastEthernet0/0 インタフェース ]</b><br />
<br />
<b>pppoe enable</b><br />
PPPoEを使用可能にする。<br />
group globalは勝手にくっつくと思う。 globalっていうグループ名がデフォルトとかなんとか。<br />
<br />
<b>pppoe-client dial-pool-number 1</b><br />
dialer pool 1の設定が入ったDialerインタフェースの設定を使う。<br />
<br />
<b>no cdp enable</b><br />
cdp飛ばしても無駄なのでやめ。<br />
<br />
<b>[ FastEthernet0/1 インタフェース ]</b><br />
<br />
<b>ip address 192.168.1.1 255.255.255.0</b><br />
LAN側のIPアドレスとサブネットマスクを指定。<br />
パソコンから見るとこのアドレスがゲートウェイになるよね。<br />
<br />
<b>ip nat inside</b><br />
NAT（後でPATの設定する）の内側とする。<br />
<br />
<b>[ Dialer0 インタフェース ]</b><br />
<br />
<b>ip address negotiated</b><br />
 PPP接続時にIPアドレスを受け取る<br />
<br />
<b>ip access-group DENY-TELNET in</b><br />
DENY-TELNETっていう名前のアクセスリストを適用する。<br />
中身は後述。<br />
<br />
<b>ip mtu 1454</b><br />
 MTUサイズを1454にする。<br />
 イーサフレームからL2TPとかPPPヘッダつけた残りのサイズだったと思う<br />
<br />
<b>ip nat outside</b><br />
　NATの外側とする。<br />
<br />
<b>encapsulation ppp</b><br />
　PPPでカプセル化する<br />
<br />
<b>ip tcp adjust-mss 1414</b><br />
 MTUからIPヘッダ(20bytes)とTCPヘッダ(20bytes)を引いた分。<br />
 TCPヘッダはもっと大きくなることがあるかもしれない。<br />
<br />
<b>dialer pool 1</b><br />
 このDialer0の設定と、後のFastEtherの設定をひもづけるやつ。番号1を設定。<br />
<br />
<b>dialer idle-timeout 0</b><br />
 適当な時間で切断されないようにタイムアウトを無効にする。<br />
<br />
<b>dialer-group 1</b><br />
 dialer-listの1に設定した通信を発見すると接続開始したり。<br />
<br />
<b>ppp authentication chap callin</b><br />
どうも日本のISPはCHAP認証らしい。<br />
callinはISPでのユーザ認証だけやるって事らしい。<br />
<br />
<b>ppp chap hostname ○○××@hogehoge.com</b><br />
これはISPからくる、PPP接続用ログインIDとかユーザ名とか言われるもの。<br />
Niftyだったら、○○○@nifty.com　とか。<br />
<br />
<b>ppp chap password ××○○</b><br />
こっちはPPP接続用のパスワード。これもISPから教えてもらってるやつ。<br />
<br />
<b>[ その他（グローバルコンフィグ） ]</b><br />
<br />
<b>ip route 0.0.0.0 0.0.0.0 Dialer0</b><br />
スタティックルーティングを行う。<br />
デフォルトルートはDialer0へ。<br />
<br />
<b>no ip http server</b><br />
<b>no ip http secure-server</b><br />
インターネット側からルータにアクセスできるので、<br />
HTTPサーバ機能をOFFにする。<br />
<br />
<b>no ftp-server enable</b><br />
FTPも（ｒｙ<br />
<br />
<b>ip dns server</b><br />
<b>ip name-server xxx.xxx.xxx.xxx</b><br />
DNSサーバのフォワーディングを行う。<br />
ip name-serverで使ってるISPのDNSサーバのアドレスでも入れておけば転送してくれるはず。<br />
<br />
<b>dialer-list 1 protocol ip permit</b><br />
IPトラフィックが飛んできたらダイヤラーで接続するよー。<br />
<br />
<b>ip nat inside source list NETCON interface Dialer0 overload</b><br />
NETCONっていう名前のアクセスリストに適合する範囲のIPをPAT。<br />
<br />
<b>[ アクセスリスト ]（TELNET接続拒否用）</b><br />
<br />
<b>ip access-list extended DENY-TELNET</b><br />
名前付きACLをばー。<br />
<br />
<b>deny tcp any any eq telnet</b><br />
TCPでどっからか接続してくるTELNETを拒否<br />
<br />
<b>permit ip any any</b><br />
他は許可<br />
<br />
<b>[ アクセスリスト ]（PAT変換対象用）</b><br />
<br />
<b>ip access-list extended NETCON</b><br />
名前付きアクセスリスト－。<br />
<br />
<b>permit ip 192.168.1.0 0.0.0.255 any</b><br />
192.168.1.0/24の範囲を許可<br />
<br />
<br />
結構適当な説明だけど大体こんな感じ。<br />
後はpassword-encryptionとかしないとパスワードが平分で保存されてたり、<br />
他の細かいのははしょりました。(;'A`)合ってるか自信がないし。<br />
ではでは。]]></description>
 <category>Cisco</category>
<comments>http://www.280w.info/item/448</comments>
 <pubDate>Fri, 15 Jan 2010 21:16:08 +0900</pubDate>
</item><item>
 <title><![CDATA[スバツイ2参加]]></title>
 <link>http://www.280w.info/item/445</link>
<description><![CDATA[<a href="http://expe.jp/event/2009/subatwi2-at-cisco.php">スバツイ2</a>に参加してきました。<br />
場所はシスコシステムズ合同会社の本社。２１階でした。<br />
<br />
入館管理システムがQRコードを使ったワンタイム式になっていた・・・。<br />
このかっこいいシステムがオラクル本社と同じだったのは感動した。<br />
<br />
会場に到着したらシックス・アパート株式会社さんからの<br />
差し入れでドリンクが置いてあったのでありがたく頂戴する。<br />
<br />
今回は、Lightning Talkで、お題は「ついったーで変わったワタシ」でした。<br />
発表者は以下の素敵な方達。<br />
<a href="http://twitter.com/gothedistance">@gothedistance</a><br />
<a href="http://twitter.com/MaripoGoda">@MaripoGoda</a><br />
<a href="http://twitter.com/mainichijpedit">@mainichijpedit</a><br />
<a href="http://twitter.com/nekocafe">@nekocafe</a><br />
<a href="http://twitter.com/daichi">@daichi</a><br />
<a href="http://twitter.com/shumai">@shumai</a><br />
<a href="http://twitter.com/worstman">@worstman</a><br />
<br />
謙虚な方からド変態な方まで一風変わったように見える方達でした。<br />
個別の発表については、<a href="http://twitter.com/#search?q=%23subatwi">#subatwi タグ</a>を参照したほうが早いかと。<br />
<br />
ほとんどIT系出身の方が多いなか、事務方からの参加だったから、<br />
あの雰囲気と盛り上がりはやはり変わっていると思った。<br />
もちろん向こうから見るとこっちが変わっているのだろうけど。<br />
ついったーで変わったとも言えるし、変化している人がついったーに参加したらこうなったとも。<br />
感性・環境がまったく違う人の話を聞くといろいろ参考になって面白い。<br />
<br />
現状に満足して何もしないと思考停止してしまうので、こういう<br />
見聞を広げていくのはいいんじゃないかなぁと思ったのさ。]]></description>
 <category>General</category>
<comments>http://www.280w.info/item/445</comments>
 <pubDate>Sat, 31 Oct 2009 03:42:19 +0900</pubDate>
</item><item>
 <title><![CDATA[[メモ]PHPでjsonを扱う ( php-json と PEAR::Services_JSON )]]></title>
 <link>http://www.280w.info/item/443</link>
<description><![CDATA[TwitterのAPIを使う場合、レスポンスの形式をxmlやjsonから選ぶことができる。<br />
jsonでレスポンスを受け、PHPで扱ったときのメモ。<br />
<br />
php-jsonモジュールでjsonをデコード<br />
<i>json_decode($json_data);</i><br />
　statusidがintegerの範囲を超えてる為、全部integerの最大値になっていた。<br />
<br />
PEAR::Services_JSONでjsonをデコード<br />
<i>require_once('JSON.php');<br />
$json->decode($json_data);</i><br />
　integerの範囲を超える部分はfloatになっていた。<br />
<br />
というわけで、PEAR::Services_JSONを採用。<br />
<a href="http://pear.php.net/pepr/pepr-proposal-show.php?id=198">http://pear.php.net/pepr/pepr-proposal-show.php?id=198</a><br />
こっから<b>PEAR package file (.tgz)</b>をダウンロードして解凍。<br />
中に入ってるJSON.phpをrequireかincludeして使うことにした。]]></description>
 <category>プログラミング</category>
<comments>http://www.280w.info/item/443</comments>
 <pubDate>Thu, 29 Oct 2009 02:03:44 +0900</pubDate>
</item><item>
 <title><![CDATA[[メモ]Eclipse導入 PHP&Ruby on Rails]]></title>
 <link>http://www.280w.info/item/441</link>
<description><![CDATA[1. Eclipse+PHP環境導入<br />
<a href="http://mergedoc.sourceforge.jp/">MergeDoc Project</a>からEclipse 3.5 Galileo Pleiades All in Oneを選んでPHPのFull All in One (JRE あり)をダウンロード。<br />
WindowsのZIP解凍フォルダ or WinRARでドライブルート直下に解凍。<br />
eclipseとxamppと何か３つディレクトリができる。<br />
<br />
PHPはこれで準備OK。Apacheの設定を変更する場合は、<br />
 xampp\apache\conf　のhttpd.confにて。<br />
<br />
2. InstantRails導入<br />
<a href="http://rubyforge.org/frs/?group_id=904">http://rubyforge.org/frs/?group_id=904</a>こっから、<br />
InstantRails-2.0-win.zipをダウンロードしてドライブルート直下に解凍。<br />
ディレクトリ名とInstantRailsに変更して、ディレクトリの中のInstantRails.exeを実行する。<br />
何かパスがどーたら聞いてくるのではいかOKかを押す。<br />
<br />
3. Aptana Studio導入<br />
<a href="http://www.aptana.org/">http://www.aptana.org/</a><br />
Download Nowをクリック。<br />
Installation TypeをEclipse Pluginにして、Download Nowをクリック。<br />
Update SiteのURLをコピー。<br />
Eclipseを起動して、[ヘルプ>新規ソフトウェアのインストール]<br />
作業対象にコピーしたURLを貼り付けて[追加]をクリック。<br />
名前はAptanaにする。<br />
<br />
インストール後、Eclipseを再起動してRadRails導入へ。<br />
<br />
4. RadRails導入<br />
Eclipse起動後、おそらくInstall Additional Featuresの画面が出てくるので、<br />
[Aptana RadRails]にチェックを入れ、[インストール]をクリック。<br />
また再起動。<br />
<br />
あとPathに何か設定した気がする。Gemのパスだったか何か。<br />
Eclipseの[ウィンドウ>設定]で、RailsとRubyの項目で<br />
RailsのパスはInstantRails\ruby\bin\railsとか。<br />
<br />
おそらくこんな感じだった。<br />
<br />
PHP開発は、パースペクティブのPHPにて。<br />
Ruby on Railsは、RadRailsにて。]]></description>
 <category>プログラミング</category>
<comments>http://www.280w.info/item/441</comments>
 <pubDate>Tue, 27 Oct 2009 04:28:16 +0900</pubDate>
</item><item>
 <title><![CDATA[鏡置き場設置]]></title>
 <link>http://www.280w.info/item/439</link>
<description><![CDATA[友人に頼まれたので鏡置き場を設置しました。<br />
<br />
右のメニュー[鏡置き場]または、以下のリンクから。<br />
<a href="http://www.280w.info/kagami/">http://www.280w.info/kagami/</a><br />
<br />
テスト運用中につきご自由に。<br />
違法なコンテンツは流さないようにしてください。<br />
一応ポートごとに6Mbpsの制限を実施中。<br />
PLCアダプタ使ってるので光回線でも速度が大幅に低下してこれが限界です。。。]]></description>
 <category>General</category>
<comments>http://www.280w.info/item/439</comments>
 <pubDate>Tue, 20 Oct 2009 20:57:54 +0900</pubDate>
</item><item>
 <title><![CDATA[とらのあな　八王子店]]></title>
 <link>http://www.280w.info/item/436</link>
<description><![CDATA[<a href="http://www.toranoana.jp/info/shop/091128_hachioji_open/">http://www.toranoana.jp/info/shop/091128_hachioji_open/</a><br />
<br />
ついに八王子にとらのあなが出店するらしい。<br />
この前吉祥寺店が無くなったばかりなのにね。<br />
<br />
アニメイトも、昔の寺だったか小学校だったかの横らへんの小さい店から駅前に移転してきたし、<br />
マンガがそろう店が増えてきていい感じ。]]></description>
 <category>General</category>
<comments>http://www.280w.info/item/436</comments>
 <pubDate>Fri, 16 Oct 2009 19:38:32 +0900</pubDate>
</item><item>
 <title><![CDATA[儚月抄とCDと。]]></title>
 <link>http://www.280w.info/item/431</link>
<description><![CDATA[ふと過去の記事を見返すと恥ずかしくて穴を掘って土葬されてしまいたい気持ちになります。<br />
どうみても若気の至りです。こんばんは。<br />
<br />
<br />
さて、知らぬ間に<a href="http://www.melonbooks.co.jp/contents/comic/toho_b3/index.html">東方儚月抄の低</a>（3巻目・最終刊）が出てました。<br />
ので早速購入。メロンブックスで買ったら湯飲みがついてきた。<br />
どーやら湯飲みは先着だったみたい。<br />
<br />
<br />
CDはこの前の<a href="http://karen.saiin.net/~kouroumu-toho/">東方紅楼夢</a>で出ていたもの。<br />
<br />
<a href="http://redalice.hmc6.net/">ALiCE'S EMOTiON</a>の<a href="http://redalice.hmc6.net/lycoris/index.html">Lycoris</a>と<br />
<a href="http://www.c-clays.com/">C-CLAYS</a>の<a href="http://blog.c-clays.com/?eid=1304219">AGGRESSIVE ELEMENTS</a><br />
以上二品。<br />
<br />
気になるのは、Lycorisのジャケット絵、小町が仕事してそうな顔をしていることただ一つ・・・。<br />
<br />
-----------------------------------<br />
<br />
この方ずっと買い物記録になってるから、そろそろ別の事書きたいねぇ('A`)]]></description>
 <category>General</category>
<comments>http://www.280w.info/item/431</comments>
 <pubDate>Wed, 14 Oct 2009 00:28:29 +0900</pubDate>
</item><item>
 <title><![CDATA[イカ娘]]></title>
 <link>http://www.280w.info/item/429</link>
<description><![CDATA[<br />
<br />
イカ娘5巻と東方アレンジCD：「遊穹 U-KYU」<br />
<br />
<br />
イカ娘は秋葉のとらで購入。すでにワゴンの半分ぐらい無くなってて焦った。<br />
メッセージペーパーも華麗にゲット。<br />
東方アレンジもとらで購入。店員のオヌヌメとしておいてあったので<br />
たまには乗ってみようと思い購入。<br />
<br />
≡≡ヾ( ﾟдﾟ)ﾉ"　早速音楽聴きながらマンガ読んでくるぜ！]]></description>
 <category>General</category>
<comments>http://www.280w.info/item/429</comments>
 <pubDate>Thu, 8 Oct 2009 22:00:48 +0900</pubDate>
</item><item>
 <title><![CDATA[シャンティティ＆ネージュ]]></title>
 <link>http://www.280w.info/item/427</link>
<description><![CDATA[<a href="http://www.etsu.jp/etsu_shop/200904tinkle_f/">http://www.etsu.jp/etsu_shop/200904tinkle_f/</a><br />
E☆２のアレ。てぃんくる先生の絵を元にしたフィギュアっぽ。<br />
<br />
<br />
(; ﾟдﾟ )気づいたら到着していた。<br />
<br />
<br />
ライティングなどないから、とても暗く写ってるのはしょうがない。<br />
<br />
<br />
('A`)つ□　おまけの色紙もついてきたよ！<br />
<br />
物はいいんだ。とてもいいんだ。<br />
<br />
が、金が・・・(;'A`)衝動買いは控えようね。]]></description>
 <category>General</category>
<comments>http://www.280w.info/item/427</comments>
 <pubDate>Wed, 30 Sep 2009 00:45:30 +0900</pubDate>
</item>
  </channel>
</rss>