October 30, 2008

Common Modem Commands

HAYES(DEV) Devices HAYES(DEV)

NAME
hayes - The hayes modems

DESCRIPTION

MISCELLANEOUS
-------------
a/ - redo last command
+++ - return to modem cmd mode from live connection

-------------------------------
--- DIALING
-------------------------------

DIAL COMMAND
------------
atdt[tele#]
ats11=75 - speed of tone dialing (in miliseconds. minimum 50)

AUTO-DIAL PHONE NUMBERS
-----------------------
at&z0[tele#] -stores a tele# in memory #0
at&z1[tele#] -stores a tele# in memory #1, etc
atd\0 - dial tele# in memory #0


SHOW ALL SETTINGS
-----------------
at&v - show all hayes command settings

-------------------------------
--- ENTER/EXIT CONNECTION STATE
-------------------------------

ANSWER/ORIGINATE MODES
----------------------
ata - manual answer incoming call
atd - originate connection. Assumes number already
dialed, remote has picked up
ONLINE RETURN
-------------
ato - go back online from +++
ato1 - return to online state and retrain baud sync

HANGUP
------
ath0 - hang up if modem off hook (esp. after a +++)
ath1 - pick up, but do nothing

RESET
-----
atz - reset modem to config profile 0
at&f - return all settings to factory settings
at&w - save current settings in non-volatile mem (?not sure)

BREAK
-----
at\b - send break
at\b3 - send a 300ms break (number is x100ms)

-------------------------------
--- SPEAKER
-------------------------------
LOUDNESS (SPEAKER)
------------------
atl1 - low speaker volume
--> atl2 - medium speaker volume
atl3 - loud speaker volume

MONITOR (SPEAKER)
-----------------
atm - speaker off
--> atm1 - speaker on until carrier detected
atm2 - speaker always on
atm3 - spkr on until carrier detected except during dialing

-------------------------------
--- MODEM RESPONSES
-------------------------------
QUIET
-----
--> atq0 - quiet off (enable messages)
atq1 - quiet on (disable messages)

VERBAL
------
atv0 - verbal off (numeric messages)
--> atv1 - verbal on (word messages)

CONNECT CODES
-------------
atx[01234] - various levels of word messages (default atx4)

ECHO
----
ate0 - no local echo
--> ate1 - local echo

-------------------------------
--- HARDWARE LINES
-------------------------------

CTS/RTS
-------
at&r0 - ignore RTS in command mode, CTS follows RTS in data mode
at&r1 - force CTS active

DCD ASSERT
----------
at&c0 - force DCD high always
at&c1 - modem asserts DCD when carrier detected

DSR ASSERT
----------
at&s0 - force DSR high always
at&s1 - modem asserts DSR (when connection established?)

DTR
---
at&d0 - ignores DTR line from computer
at&d1 - goto AT command state on DTR on->off change, (no hangup)
at&d2 - modem resets itself on DTR on->off change

-------------------------------
--- FLOW CONTROL
-------------------------------

XON/XOFF FLOW CONTROL
---------------------
at&k0 - disable local flow control
at&k1 - ?
at&k2 - ?
at&k3 - RTS/CTS bi-directional hardware flow control
at&k4 - XON/XOFF bidirectional software flow control
at&k5 - uni-directional XON/XOFF flow control

-------------------------------
--- AUTO ANSWER
-------------------------------

ats0=0 - no auto answer
ats0=1 - auto-answer on first ring

-------------------------------
--- CARRIER
-------------------------------

ats7=30 - time to wait for carrier detect before giving up
ats9=6 - recognize carrier by .6 seconds of carrier tone
ats10=10 - hangup after 1 second without carrier tone

S REGISTERS
-----------
ats0=0 - no auto answer
ats0=1 - auto-answer on first ring

ats7=30 - time to wait for carrier detect before giving up

ats9=6 - recognize carrier by .6 seconds of carrier tone

ats10=10 - hangup after 1 second without carrier tone

ats11=75 - speed of tone dialing (in miliseconds. minimum 50)

DIAL MODIFIERS
--------------
, - pause for 2 seconds (value of S7 register)
; - return to command state after dialing
! - flash the hook for 1/2 second
R - reverse to 'answer' mode after dial (@ end of tele#)
W - wait up to 30 secs for 1 sec continuous dial tone
@ - modem waits 30 secs for one or more ringbacks


RECOMMENDED SETTINGS

FOR UNIX DIALUP MODEM WITH UUGETTY
----------------------------------
at&f - return to factory settings
ats0=1 - auto answer on first ring
ats2=127 - disable +++ escape (allows binary file xmission)
atl3 - loud spkr volume
atm1 - spkr on until carrier detect
ate0 - echo off
atq1 - no messages
at&c1 - DCD active on carrier detect, inactive on hangup
at&d2 - modem resets when DTR dropped
at&s1 - DSR active (when??)
at&k0 - disable XON/XOFF flow control
at&r0 - ignore RTS in cmd mode, CTS follows RTS in data mode
at&w - save these settings

FOR UNIX DIALOUT
----------------
at&f
ats0=1 - auto answer on first ring
ats2=127 - disable +++ escape (allows binary file xmission)
atl3 - loud spkr volume
atm1 - spkr on until carrier detect
ate1 - echo on
atq0v1 - disable quiet/enable verbose messages
at&c1 - DCD active on carrier detect, inactive on hangup
at&s1 - DSR active (when??)
at&d2 - modem resets when DTR dropped
at&k0 - disable XON/XOFF flow control
at&r0 - ignore RTS in cmd mode, CTS follows RTS in data mode
at&w - save these settings

SEE ALSO
www.hayes.com - I think they have all models of modem settings
available online.

ORIGIN
Gregory Ercolano, Los Feliz California 08/28/93

October 15, 2008

Add bracket match of CS (clearsilver) file in VIM

1. download matchit.zip for vim (script 39) and install it following the instruction
2. disable the vim default cs (c sharp) filetype plugin by doing:
cd /usr/share/vim/vim63/ftplugin/
sudo mv cs.vim csharp.vim
3. create out own cs filetype flugin
mkdir ~/.vim/ftplugin
vi cs.vim, and enter the following line:
:let b:match_words='<:>,<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td ]\>:<\@<=/dl>,<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'

4. done! now press % match < > and things like

October 14, 2008

net-snmp proxy

For Net-snmp proxy to work, you have to specify the following in your net-snmp snmpd config file:
----------------------
com2sec -Cn default
group v1
access any noauth exact all none none
proxy -Cn -v 1 -c .1.3
----------------------

for example:

--------
com2sec -Cn mycontext secname_public default public

group group_public v1 secname_public
group group_public v2c secname_public

view all included .1

access group_public mycontext any noauth exact all none none

proxy -Cn mycontext -v 1 -c public localhost:1161 .1.3
-----------

This will work.

Simply specify "rocommunity" and then add the proxy line does not work!!

October 13, 2008

build net-snmp on Windows

This is how to build net-snmp (version 5.4.2) on windows :

0. install MS visual Studio Express 2008 VC++

0.1 build openssl, copy headers and libs to visual studio include and lib directories according to net-snmp readme.WIN32

1. read file readme.WIN32 section "Manual build using Configure / nmake"

2. cd win32

3. change file build.pl line 34

#if (! (-d $ENV{MSVCDir})) {
to
if (! (-d $ENV{VCINSTALLDIR})) {

4. perl Configure --with-sdk --with-ssl --config=debug --prefix="c:/usr"

5. add the following code to the beginning of win32\net-snmp\net-snmp-config.h
#include
#include

#ifdef WIN32
#include "windows.h"
#include "winsock.h"
#include "iprtrmib.h"
#include "tlhelp32.h"
#include "iphlpapi.h"
#endif
also
change NETSNMP_DEFAULT_MIBS to:
#define NETSNMP_DEFAULT_MIBS "IF-MIB"

6. in file c:\tools\net-snmp-5.4.2\win32\netsnmpmibssdk\Makefile
comment out the 2 lines containing "winExtDLL.obj"

7. in file C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\openssl/ossl_typ.h
comment out these two lines:
//typedef struct ocsp_response_st OCSP_RESPONSE;
//typedef struct ocsp_responder_id_st OCSP_RESPID;

8. in file snmplib\snmpTcpDomain.c, remove 2 includes files, and add socketlen_t define
#if HAVE_WINSOCK_H
#define socklen_t int
//#include
//#include
#endif

9. repeat last step for file snmplib\snmpUdpDomain.c, apps\snmpnetstat\inet.c, apps\snmpnetstat\inet6.c
10. nmake (you will see warnings about /YX, GX and unsafe use of strcpy, etc. they are safe to ignore for now.

I wish it is easier than this. Maybe next year. :-)

October 8, 2008

indent arguments

My coding style
indent -i4 -ts4 -di4 -cdw -bli0 -ncs -npsl -nbfda -npcs -nsaf

you can put this in ~/.indent.pro

October 7, 2008

winpcap capture snaplen ONLY functional when a filter is set

Re: [WinPcap-users] snaplen only works when BPF is set ?

Loris Degioanni
Mon, 14 Feb 2005 22:39:35 -0800

Guy Harris wrote:


> phengmaly peter wrote:
>
>> It seems to me, that the pcap_open_live's snaplen argument has only effect when a BPF filter is set thereafter (pcap_setfilter).
>> Is it the intended functionality ? (both 3.0 and 3.1b4)
>
>
>
> At least on the original systems where BPF was implemented, the snapshot length was supplied by the BPF program; the "return" instruction in BPF includes a snapshot length value, which, if zero, means "discard this packet". On those systems, you need a BPF program to supply a snapshot length.
>
> The WinPcap driver might follow that model, in which case you'd see that behavior, just as you would, for example, on various BSD systems.


Yes, I confirm that the winpcap driver follows that model.


> On other systems, that's not the case. Perhaps libpcap should, when opening a device, install, on systems where the snapshot length comes from a BPF program, an initial BPF program that consists only of a "return" instruction with the specified snapshot length.


This is a good idea, but I'd leave it for the next winpcap release. We are sort of freezing the development to focus on fixing the last bugs in 3.1, so I'd prefer not to change the interface with libpcap now. The same applies to the "user buffer not emptied after a setfilter" problem.

Loris
http://www.mail-archive.com/winpcap-users@winpcap.polito.it/msg02414.html