home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
COMET.ZIP
/
COMET13.INF
(
.txt
)
< prev
next >
Wrap
OS/2 Help File
|
1991-07-25
|
370KB
|
18,351 lines
ΓòÉΓòÉΓòÉ 1. Disclosure ΓòÉΓòÉΓòÉ
COMET is the sole property of the IBM Corporation and is protected under U.S.
copyright laws. IBM grants you the right to make unlimited copies of this
material and the right to distribute it freely, as long as you receive no
profit from said distribution. These materials are provided as is, with no
warranties or guarantees expressed or implied.
ΓòÉΓòÉΓòÉ 2. OVERVIEW ΓòÉΓòÉΓòÉ
As OS/2 Extended Edition was being developed, there were programs written by
various groups to test specific programming interfaces. The Communication
Manager testers, for instance, wrote programs to test the APPC interface, and
the other communications API's. Similarly, the database group wrote programs to
test the database API's, but there was no program available that could exercise
all of the available API's. For example, no program existed which could select
some data from a database and then send the data to another PC across an APPC
link. COMET provides this missing function.
The main purpose for the development of COMET is to create a single test tool
which is capable of exercising all of the various Application Programming
Interfaces (API's) provided by IBM's OS/2 Extended Edition. To do so, a user
must first create an input file which specifies what commands are to be issued
to which API's. The user can specify commands to any API, in any order. COMET
reads the instructions from the file, and issues the desired API function
calls in the order listed in the input file.
COMET is a command interpreter which reads an instruction from a specified file
and processes that instruction by calling the required API with the desired
function before reading and processing the next instruction.
COMET can be used to create and use databases with the Database Manager's API.
It can also be used to transfer data to other PC's or host systems using the
Communication Manager's different API's.
The following documentation shows a user how to use Comet, and also contains
sample code on how to program each of the API's used by Comet. Each API
supported is accompanied by a description of how to use the API in Comet (what
parameters to use, etc ), as well as a Sample Code selection that illustrates
how to use that particular API in a C program.
The API's supported by COMET are:
ACDI Asynchronous Communication Device Interface
APPC Advanced Program to Program Communication
SRPI Server/Requestor Programming Interface
DBM Database Manager Utility functions
SQL Database Manager Structured Query Language functions
OS/2 Selected OS/2 operating system function calls
802.2 IEEE 802.2 Local Area Network interface
NETBIOS PC Network Netbios interface
PM Selected OS/2 Presentation Manager functions
EHLLAPI Emulator High Level Language Application Programming Interface
There are some internal COMET commands also available which provide some other
useful functions. The categories of COMET commands available are:
COMET Some utility commands.
IF Conditional Jumps
GOTO Unconditional Jumps
CALL Subroutine calls
RETURN Return from subroutine calls
BEGIN_LOOP Begin a timed or counted loop
BREAK_TO Break out of a loop to a label
END_LOOP End of a loop construct
For more information about using COMET, see the following sections: USING
COMET and CREATING COMET INPUT FILES.
COMET is written using IBM's C/2 programming language and compiler.
Version Level Descriptions
Please refer to COMET Version Level Descriptions. for description of changes
made to COMET and the corresponding version levels.
ΓòÉΓòÉΓòÉ 3. USING COMET ΓòÉΓòÉΓòÉ
Using COMET, Quick Description
COMET Help Panel
Using COMET, More Details
COMET Ending Conditions
ΓòÉΓòÉΓòÉ 3.1. Using COMET, Quick Description ΓòÉΓòÉΓòÉ
This is a quick description of how to run COMET. For more details, see Using
COMET, More Details.
Before you can run a COMET test case, you must first create an input file for
COMET. The input file should contain commands which tell COMET what functions
you wish to perform. The input file can be created using an editor which
creates a simple ASCII file. See CREATING COMET INPUT FILES for details on
creating a COMET input file.
To run a COMET test case, do the following:
1. IPL your PC with OS/2 Extended Edition Version 1.1 or later version.
2. Start an OS/2 Command Prompt (Protect mode session).
3. Include the directory which contains the COMET files in your PATH and
DPATH statements.
4. Issue the COMET command in the following form:
COMET inputfilename [outputfilename] [/nl] [:start_label]
The outputfilename, start label, and /nl parameters are optional. Specify
an outputfilename if don't wish to use the default log file name, which is
COMETLOG.TXT. If you don't want a log file to be created, use the /nl
(nolog) option. If you want to begin processing the input file at some
line other than the beginning of the file, type the label of the starting
point. (Don't actually type the brackets around these items... they are
used just to show that these parameters are optional.)
COMET will read the instructions from the input file, and perform the
specified functions.
If you don't specify an output file name (and don't choose the nolog (/nl)
option), COMET will create an output file with the default name COMETLOG.TXT
in the current directory.
ΓòÉΓòÉΓòÉ 3.2. COMET Help Panel ΓòÉΓòÉΓòÉ
The version number on the current version of COMET you are using can be
obtained by specifying a question mark ('?') in the place of the input file
name. Along with the version number, the distribution start date and the COMET
run syntax format will also be specified.
For example, entering:
COMET ?
will return output similar to this:
COMET Version # Date
Format: COMET input_filename [output_filename] [/nl] [:start_label]
Where:
input_filename is the name of the COMET input file. (Default extension is
.CMT)
output_filename is the name of the output file. (Default name is
COMETLOG.TXT)
/nl is the nolog option, to keep an output file from being created.
:start_label is a label within the input file where processing is to start.
When COMET ends, the error level of the process is returned to OS/2. The
error level may be specified by the user (by issuing the COMET ERRORLEVEL
command in the input file). If no user error level is set, then COMET returns
an error level of 0 for successful completion of a test case, or an error
level of 1 for an unsuccessful completion.
ΓòÉΓòÉΓòÉ 3.3. Using COMET, More Details ΓòÉΓòÉΓòÉ
Hardware Requirements
Software Requirements
System Setup
Syntax for Running COMET
ΓòÉΓòÉΓòÉ 3.3.1. Hardware Requirements ΓòÉΓòÉΓòÉ
Since COMET only runs in OS/2 protect mode, you must have a PC which can run
OS/2. The useable PC's at this time are:
286 machine
386 machine
486 machine
You must have enough storage available on the PC to run OS/2. You should allow
approximately 800K of storage for COMET if you are using all of its functions.
You will need at least 6 Megabytes of memory in your PC if you wish to run
OS/2 with both the Database and Communication Managers.
ΓòÉΓòÉΓòÉ 3.3.2. Software Requirements ΓòÉΓòÉΓòÉ
The following software is required to run COMET.
1. IBM OS/2 Extended Edition
For COMET Version 1.2x and 1.3x, OS/2 EE version 1.2 or later is required.
For COMET Version 1.1x, OS/2 EE versions 1.1, or 1.2 may be used.
For COMET Version 1.0x, OS/2 EE versions 1.0, 1.1, or 1.2 may be used.
OS/2 Extended Edition includes the OS/2 operating system, the
Communication Manager, and the Database Manager.
2. The COMET program.
The following files are provided with COMET, and should all reside in the
same directory:
COMET.EXE The COMET executable program.
CMTSQL.BND A database bind file, used when processing a database
manager "Create Database" command.
ΓòÉΓòÉΓòÉ 3.3.3. System Setup ΓòÉΓòÉΓòÉ
When copying the COMET files to your hard disk, your PATH and DPATH statements
must include a path to the directory which contains these COMET files. This
can be done in several different ways. In OS/2 Version 1.1+, the PATH and DPATH
for a new screen group can be specified in the config.sys file. If you don't
wish to add the COMET directory to the generic PATH's found in the config.sys
file, an alternative is to run another command (batch) file to set up the
environment before running COMET
Assuming that the COMET files are in the C:\COMET directory, the PATH and
DPATH statements might include the following paths:
PATH=C:\OS2;C:\MUGLIB;C:\SQLLIB;C:\CMLIB;C:\OS2\SYSTEM;. . . ;C:\;c:\comet;
DPATH=C:\OS2;C:\MUGLIB\DLL;C:\CMLIB;C:\IBMLAN\NETPROG;. . . ;C:\;c:\comet;
ΓòÉΓòÉΓòÉ 3.3.4. Syntax for Running COMET ΓòÉΓòÉΓòÉ
Once the system is set up, you are ready to run a COMET test case.
To do so, you must first create an input file which contains COMET commands.
The input file may be created with a PC editor such as "E" which creates a
simple ASCII file. See CREATING COMET INPUT FILES for more details.
To run COMET, type the following command at the OS/2 command prompt.
COMET input_file [output_file] [/nl] [:start_label] [/start=line_number]
The input file parameter must immediately follow the COMET command, but the
other parameters may be entered in any order. The parameters in brackets are
optional. (You should not type the brackets when entering the command.)
The COMET parameters are as follows:
input_file The name of the input file. If no file extension is specified,
a default of .CMT will be used. The file name may specify the
drive and path pointing to the file, if desired. If the
specified file is in the current directory, or if it is in a
directory pointed to by the current DPATH, then only the file
name is required. To execute one or more input files
sequentially, enter input file names in the order you want to
execute them. Seperate the input file names by comma with no
space between file names. COMET will concatenate all input files
into a temperory input file BIG$CMT.CMT.
output_file The name of the desired output log file. If this parameter is
not specified (and the /nl option is not used), then the default
log file name, COMETLOG.TXT, is used. If the drive and path are
not specified, the log file will be stored in the current
directory of the current drive. This is an optional parameter.
/nl The "nolog" parameter. If specified, no log file is created.
:start_label The label indicating at which line to start processing the input
file. The label is a variable parameter, and must begin with a
colon. If the label does not exist in the specified input file,
an error message will be displayed saying that the label was not
found.
/start=line_number Start processing input file at the line specified by
line_number.
Here is an example of how to run a COMET test case. Assume that the COMET
program files are on the C drive in a directory called \COMET, and the current
drive is the C drive. The input file you wish to run is called MYCOMET.IN, and
is on a diskette in the A drive. Also, you want the COMET log data file to be
called MYCOMET.LOG, and stored in the C:\COMET\LOGFILES directory which
already exists on the C drive.
Since the A drive is not in your DPATH in this example, you would issue the
following instruction to run that test case:
COMET A:MYCOMET.IN \COMET\LOGFILES\MYCOMET.LOG
Had the A drive been included in your DPATH, and you wished to write the
output file to the current directory, you would issue the following
instruction to run that test case:
COMET MYCOMET.IN MYCOMET.LOG
If no output log file is desired, the following command might be issued:
COMET MYCOMET.IN /nl
For one or more input files, the following command execute MYCOMET1.IN and
then MYCOMET2.IN sequentially.
COMET MYCOMET1.IN,MYCOMET2.IN MYCOMET.LOG
ΓòÉΓòÉΓòÉ 3.4. COMET Ending Conditions ΓòÉΓòÉΓòÉ
When COMET processes an input file, one of two final results will occur as a
result. It will either end successfully (no errors) or unsuccessfully
(something unexpected occurred).
ΓòÉΓòÉΓòÉ 3.4.1. Successful Ending Conditions ΓòÉΓòÉΓòÉ
If no errors occurred during the processing of the input file, the test case is
considered to be successful by COMET, and COMET exits with an error level of
zero. (See Error Levels (COMET Return Codes).) The phrase "no errors occurred"
means that, for each statement executed in the input file, all parameters which
were returned from the API compared successfully with the expected values. For
instance, when receiving data, if the data specified by the expected data
parameter exactly matches the data which is actually received, that comparison
is successful.
Return codes resulting from an API call can be somewhat confusing. COMET's
default is to expect a return code of zero for each API command, unless the
input file statement explicitly says to check for a non-zero return code. Each
API command has a parameter of the form "RC=...", which tells COMET that a
non-zero return code is expected. In this case, the specified non-zero return
code is the expected (thus, the "successful") condition, and a return code of
zero would be regarded as an error.
Another way of dealing with return codes from the API calls is by using a
condition (IF) statement after an API instruction in the input file. The IF
statement allows return code checking just as the "RC=..." parameter did.
Specifying the actual return code in the IF statement also results in a
"successful" condition for that API command. See If.
ΓòÉΓòÉΓòÉ 3.4.2. Unsuccessful Ending Conditions ΓòÉΓòÉΓòÉ
If some type of error is detected, COMET will stop the processing of the input
file at that point, display an error message in a popup window and allow user
to select the following options from the action bar:
select EXIT to terminate COMET with an error level of 1.
select CONTINUE to resume COMET test case at the command line following the
command line at which the error occurs.
select RETRY to re-execute the command line at which the error occurs.
The types of things which will result in COMET stopping a test case early are
such things as an error found in the syntax of a command in the input file, or
a returned parameter from an API call that does not compare successfully with
the expected value.
COMET will terminate a test case with an error message in the following types
of situation.
The input file could not be opened for some reason.
A syntax error was found in an input file command.
A non-zero return code occurred on an API command, with no "RC=.." parameter
on the statement, and no IF statement following the API command in the input
file.
A return code of zero was received when an "RC=..." parameter was used,
specifying a non-zero return code was expected.
A non-zero return code occurred on an API command, with IF statement(s)
following the command, but the IF statement does not select the actual
return code received.
See If for more information about the IF statement.
ΓòÉΓòÉΓòÉ 3.4.3. Error Levels (COMET Return Codes) ΓòÉΓòÉΓòÉ
When COMET terminates, it passes an error level back to the operating system.
The error level is a type of return code which can be used in batch (command)
files to determine the results of running a program, and to decide what action
to take as a result.
The error level set by COMET when it ends can be specified by the user from
within the input file. See Exit for information about user specified exit
error levels.
If the input file does not specify an exit error level by using the COMET EXIT
command, COMET will set the error level based on the results processing the
input file. If no errors were detected when processing the input file, an
error level of zero is set. If an error did occur, the COMET sets an error
level of one.
ΓòÉΓòÉΓòÉ 4. CREATING COMET INPUT FILES ΓòÉΓòÉΓòÉ
When running a COMET test case, an input file must be specified.
The input file provided by the user of COMET contains a script of instructions
which tells COMET what function calls to issue to which APIs. A number of OS/2
commands, Database Manager commands, and Communication Manager Commands are
supported. In addition, there are some general control and utility commands
which allow other functions to be accomplished.
ΓòÉΓòÉΓòÉ 4.1. General Instruction Syntax ΓòÉΓòÉΓòÉ
The basic format of a COMET instruction is as follows. The first word (token)
of the instruction tells COMET which API the command is for. The second word
(token) in the instruction tell what API function is desired. Any other
parameters in the instruction are used to further define the instruction. A
semicolon (;) signals the end of an instruction. For detailed input file
examples see Sample COMET Input Files.
The following conventions are used in this document to describe the syntax of
specific COMET instructions.
1. Items written in CAPITAL letters are reserved COMET script words and are
not required to be typed in capital letters.
2. Items shown in lower case letters represent parameters which are variable.
For instance, "filename.ext" would represent any pc filename which the
input file script writer might choose to type.
3. Parameters are separated by commas (,).
4. A semicolon (;) indicates the end of an instruction. There should not be
a comma between the last parameter and the semicolon which ends the
instruction.
5. Items in square [ ] brackets are optional parameters. If these items are
included in the instruction, the [ ] brackets should NOT be typed as part
of the instruction. If an optional parameter is not specified, then the
default value for that parameter is assumed.
6. If two or more items are separated by a vertical bar | character, and
enclosed in <> brackets, then one, and only one, of the parameters may be
selected. When entering the parameter, the <> brackets and the | character
should not be typed. For example, if PARAMETER1 has two choices then it is
shown here as PARAMETER1= <choice1|choice2>. If you selected choice1 then
you would specify it as PARAMETER1= choice1.
7. If an item is shown enclosed in quotes, the quotation marks are required
when you specify it in your input file. Character strings which may
contain blanks will always be surrounded by quotes. If a string contains a
quote, the nested quote must be preceded by a backslash. For example, a
string containing only a quotation mark will be defined this way: "\"".
8. A character string can be continued on the next line of the input file. A
dash (-) as the last character on the line in a string definition (within
quotes) signals that the next line is a continuation of the string. The
dash will be deleted from the data stream, and leading blanks on the next
line will also be deleted. The character string will continue with the
first nonblank character on next line. For example, if PARAMETER2 is
specified in your input file as: PARAMETER2="This is -
an example.", it would be equivalent to: PARAMETER2="This is an
example.", within COMET.
9. A character string can contain carriage return and line feed characters
(CRLF) if desired. If the last character on the line in a character
string definition (within quotes) is a backslash (\), the backslash will
be replaced by CRLF. The leading blanks on the next line will be deleted.
For example, if PARAMETER3 is specified in your input file as:
PARAMETER3="This is / an example.", it would be
equivalent to: PARAMETER3="This is an example.", within COMET.
10. Hexadecimal data may be specified using the format x'hex_numbers', for
example, x'000F' represents the number 15 in hex.
11. A pound sign symbol (#) indicates the start of a comment (unless it is
within quotes used to define a string). The comment begins at the pound
sign and extends to the end of the line.
See the following sections for details on specific instructions, and Appendix
A for input file examples.
ΓòÉΓòÉΓòÉ 4.2. COMET Control Commands ΓòÉΓòÉΓòÉ
This section describes COMET control commands. Looping and Conditional Jumps
are supported. There are also some commands (@define and @include) which allow
constants and imbedded input files to be used when writing an input file.
ΓòÉΓòÉΓòÉ 4.2.1. @Define ΓòÉΓòÉΓòÉ
Define a constant. This allows commonly used values to be defined once in the
input file, and then be used any number of times. See @DEFINE Examples to see
how constants can be used.
SYNTAX
@DEFINE constant_name constant_value;
Where:
constant_name is the name of the constant. It can be composed of any
combination of non-blank characters, and is limited to 50
characters in length. Constant names are case-sensitive. For
example, a lower-case version of an upper-case constant name will
not be interpreted as the upper-case constant.
constant_value is the character string that is represented by the constant.
Constant names will be interpreted literally by the following
COMET interfaces : OS/2 Shell, Query Manager Callable Interface,
SQL.
Sample Code
ΓòÉΓòÉΓòÉ 4.2.1.1. @DEFINE Examples ΓòÉΓòÉΓòÉ
In the following example, an APPC send data command is being issued. The data
being sent is specified in the first @define statement; the expected primary
return code is x'0003' (which means an allocation error occurred), and the
expected secondary return code is x'00000005' (which means the allocate can be
retried).
@define DATA1 "This is some sample data";
@define ALLOC_ERROR x'0003';
@define RETRY x'00000005';
appc send_data data=DATA1, prc=ALLOC_ERROR, src=RETRY;
The above example is equivalent to the following statement, using no @define
statements:
appc send_data data="This is some sample data",
prc=x'0003',
src=x'00000005'; Note: @Define statements need the trailing semicolon, and
constant names will be interpreted literally if included as PART of a
parameter value.
ΓòÉΓòÉΓòÉ 4.2.2. @Include ΓòÉΓòÉΓòÉ
Inserts another input file. The specified file is processed just as if it's
statements were included in the original file. When the included input file has
been completely processed, COMET returns to the original file and continues
processing it at the line following the include statement. If a terminal error
occurs in the included file, the entire test case stops, just as if it had
happened in the original input file.
SYNTAX
@INCLUDE "file_name";
Where:
file_name is the name of a file which contains COMET commands. This can be
just the file name, or can include the entire drive and path
specification. If the drive and path are not specified, the
current drive and subdirectory are assumed. If the file can not be
found in the current directory, the directories listed in the
DPATH will be searched for the file.
ΓòÉΓòÉΓòÉ 4.2.3. Begin_Loop ΓòÉΓòÉΓòÉ
This is a structured loop construct which allows you to execute a group of
statements in the COMET input file a number of times. You can executed the
statements within the loop a specified number of times or for a specified
period of time. If both a time value and a loop count are specified, COMET
will exit the loop when both of the conditions are met (whichever happens
last).
Infinite loops can be done by setting the time parameter equal to zero.
See Labels used for Loops and Jumps. for additional information about loops and
loop names.
SYNTAX
BEGIN_LOOP loop_name <TIME=minutes, || COUNT=loop_count>;
Where:
loop_name is the name of the loop. There should be a corresponding END_LOOP
statement in the input file with the same loop name.
TIME is the minumum length of time (in minutes) that the loop should
run. If TIME is not specified, then the COUNT parameter must be
specified. Both TIME and COUNT may be specified. If so, both
conditions must be met in order to exit the loop, that is, COMET
will exit the loop when this time has expired, unless the minimum
COUNT has not yet been reached. Set TIME = 0 for an infinite loop.
COUNT is the minimum number of times to go through the loop. COMET will
exit the loop after it has completed this many times through the
loop. This is a decimal number. If COUNT is not specified, then
the TIME parameter must be used. COUNT and TIME may both be
specified. If the TIME parameter was also specified, and the
mimimum time has not yet been reached, the loop will continue till
the timer has expired even if it exceeds the loop count specified
here.
ΓòÉΓòÉΓòÉ 4.2.3.1. Loop example ΓòÉΓòÉΓòÉ
The example in Figure "Example of a Loop" shows a timed loop. The loop will
run for two minutes, beeping for 1 second at 15 second intervals. If an error
occurs when issuing the DosBeep command (if a non-zero return code occurs),
then the test case will exit the loop using the Break_To command and display an
error message on the screen. If no errors occur, the test case will jump to the
end after the loop completes.
begin_loop beeper time=2;
os2_api dosbeep 440,1000;
if os2_rc <> x'0' break_to beep_error;
os2_api dossleep seconds=15;
end_loop beeper;
goto end;
:beep_error
comet msg msg="error occurred in DosBeep command";
:end
Example of a Loop
This example shows the Begin_Loop, Break_To, and End_Loop
commands.
ΓòÉΓòÉΓòÉ 4.2.4. Break_to ΓòÉΓòÉΓòÉ
This allows you to break out of a loop before the loop ending conditions (time
or count) have been met. See Begin_Loop for information about the time and
count parameters when starting a loop.
When jumping out of a loop, you must use BREAK_TO rather than the GOTO
statement. Using the BREAK_TO statement tells COMET to remove the loop
information from the internal loop stack which would not be removed if a GOTO
was used.
Break_to can be used as part of an IF statement to make a conditional break
from a loop, or it can be used alone to cause an unconditional break from a
loop. See Figure "Example of a Loop" to see how a break_to command might be
coded in a loop. The BREAK_TO command will only break from on level of
looping. You will need more that one BREAK_TO command to break out of each
level of imbedded loops.
SYNTAX
BREAK_TO label;
Where:
label is the label for the statement in the input file which should be
processed next.
ΓòÉΓòÉΓòÉ 4.2.5. Call ΓòÉΓòÉΓòÉ
The Call command allows subroutines to be coded in the input file. The
beginning of the subroutine is at the specified call label, and it ends when a
Return command is reached. There can be a maximum of 10 nested calls. (A
nested call is a call statement which is placed in a subroutine which is called
from elsewhere in the input file.)
See Labels used for jumps. for more information about labels used at the
beginning of called routines in the COMET input file.
SYNTAX
CALL label;
Where:
label is the label of the line in the input file which should be
executed next.
ΓòÉΓòÉΓòÉ 4.2.6. Clear ΓòÉΓòÉΓòÉ
The CLEAR command is used to clear an error condition for an API return code
variable. It can be used alone, or in conjunction with the IF statement to
clear an error condition for a return code.
When an API command is used in a COMET input file, the return code resulting
from the API call will be either zero or non-zero. If it is zero, then the
command was successfully completed, as defined by the API command
specification. COMET treats any zero return codes as a successful completion,
and any non-zero return codes as an unsuccessful, or error completion. The
default treatment of an error condition is for COMET to log an error message
and stop the execution of the test case input file. To clear an error condition
(a non-zero return code) and allow a test case to continue, any combination of
the following things can be done:
Use the "RC=" parameter when issuing the API command. This requires the test
case writer to know exactly what return code is expected.
Use an "IF" statement, or a series of "IF" statements to test the appropriate
return code(s) after the API command is issued in the test case. Using the
"IF" statement will clear an error condition only if the actual error
condition is specified in the "IF" test. For a more complete description of
the IF statement, see If.
Use the CLEAR command to clear an error condition for a specific return code
variable. The syntax of the clear command is defined later in this section.
The CLEAR command can be used as a shortcut to allow you to test only certain
error conditions in a test case, without having to test all possibilities.
The clear command can then be used to reset the error to allow COMET to
continue processing the test case instead of terminating it. More than one
return code variable can be cleared with a single CLEAR statement.
SYNTAX
CLEAR ret_code_variable [, ret_code_variable,...];
Where:
ret_code_variable specifies the return code variable for which the error
condition should be cleared. It can be one of the following:
ACDI_RC ACDI return code.
APPC_PRC Advanced Program to Program Communication Primary return code.
See APPC (Advanced Program to Program Communications) commands
for details on the APPC interface.
APPC_SRC Advanced Program to Program Communication Secondary return
code. See APPC (Advanced Program to Program Communications)
commands for details on the APPC interface.
SRPI_RC Server/Requestor Programming Interface return code. See SRPI
(Server/Requester Programming Interface) commands for details
on the SRPI interface.
SRVR_RC Server return code (for SRPI API). See SRPI (Server/Requester
Programming Interface) commands for details on the SRPI
interface.
DBM_RC Database Manager return code (for utility functions). See DBM
(Database Manager) commands for details on the Database Manager
utility functions interface.
SQL_RC Structured Query Language return code. See SQL (Structured
Query Language) commands for details on the SQL interface.
OS2_RC OS/2 API return code. See OS2_API commands for details on the
OS/2 interface.
8022_RC 802.2 interface return code. See IEEE 802.2 API for details on
the IEEE 802.2 LAN interface.
NETB_RC Netbios return code. See NETBIOS API for details on the Netbios
interface.
EHLLAPI_RC Emulator High Level Language API return code. See EHLLAPI API
for details on the EHLLAPI interface.
ΓòÉΓòÉΓòÉ 4.2.6.1. CLEAR command example: ΓòÉΓòÉΓòÉ
The example in Figure "Example using Clear command" shows how the CLEAR command
might be used. An APPC Confirm command will be issued, and one of two return
conditions is expected: either a good return code (Primary return code =
x'0000') or an Allocation Error condition (Primary return code = x'0003'). If
the return code is good, the test case will continue to Send_Data command. If
the return code is an Allocation Error, the test case will pause for 2 seconds
and retry the Allocate. Any other return code condition will cause COMET to
display an error message and exit the test with an ERRORLEVEL of 10.
:allocate_label
appc mc_alloc remote_lu="LU_1", mode="MODE_1",
tp="TP_1", sync=NONE;
if appc_prc = x'0000' goto send_data;
if appc_prc = x'0003' goto retry_alloc;
clear appc_prc, appc_src;
comet msg msg="ERROR on ALLOCATE";
comet exit errorlevel=10;
:retry_alloc
os2_api dossleep seconds=2;
goto allocate_label;
:send_data
appc mc_send_data data="Send this data to LU_1";
Example using Clear command
This example shows how the Clear command could be used
to clear an error in an input file. Clearing the error condition
allows COMET to continue with the next instructions, in this case,
displaying an error message and exiting with an error level of 10.
ΓòÉΓòÉΓòÉ 4.2.7. End_Loop ΓòÉΓòÉΓòÉ
The End_Loop command signals the end of a loop construct in the input file.
There should be a corresponding Begin_Loop command earlier in the input file.
See Figure "Example of a Loop" to see how a loop might be coded in an input
file.
SYNTAX
END_LOOP loop_name;
Where:
loop_name is the name of the loop. There should be a corresponding
BEGIN_LOOP statement in the input file with the same loop name.
ΓòÉΓòÉΓòÉ 4.2.8. Goto ΓòÉΓòÉΓòÉ
The Goto command allows the branching within the input file. Both conditional
and unconditional GOTO's are allowed. You should not use a GOTO statement to
branch from within a loop to a place outside of the loop. In that case, the
BREAK_TO statement should be used. See If and Labels used for jumps. for
information on conditional goto's and how to label the lines to which you are
branching.
SYNTAX
GOTO label;
Where:
label is the label of the line to which you want to jump. You do not
type a colon at the beginning of the label here.
ΓòÉΓòÉΓòÉ 4.2.9. If ΓòÉΓòÉΓòÉ
The IF command allows conditional execution of other COMET commands, based on
the value of a return code resulting from a previous API call.
The IF statement can be considered to be an extension of the preceding
statement, in that it is used to check the return code of that statement. It
can be used in conjunction with, or instead of, the "RC=..." parameter which
can be used on each API command supported by COMET. For further discussion of
this, see the note which follows the IF syntax description.
The IF command can be used only to test the results of API calls. The results
of COMET control and utility commands can not currently be tested with the IF
statement. See the syntax (below) for the valid API return codes which can be
tested.
SYNTAX
IF ret_code_variable condition value COMET_instruction;
Where:
ret_code_variable must be one of the following, indicating which return code
is to be tested:
ACDI_RC ACDI return code.
APPC_PRC APPC primary return code. (Note If)
APPC_SRC APPC secondary return code. (Note If)
SRPI_RC SRPI return code. (Note If)
SRVR_RC SRPI server return code. (Note If)
DBM_RC Database Manager return code.
SQL_RC Structured Query Language return code.
OS2_RC OS/2 API command return code.
8022_RC 802.2 return code.
NETB_RC Netbios return code.
EHLLAPI_RC Emulator High Level Language API return code.
condition must be one of the following, indicating how the return code
should be compared with the following value.
= return code equals value
< return code is less than value
> return code is greater than value
<= return code is less than or equal to value
>= return code is greater than or equal to value
<> return code is not equal to value
value is a 1 to 8 digit hex_number. Since most return codes are either
2 or 4 bytes long, the value should normally be specified in one
of the following forms: x'nnnn' or x'nnnnnnnn' where 'n'
represents any valid hex digit.
COMET_instruction is any input file instruction supported by COMET except the
following:
Begin_Loop
End_Loop
If
1. Normally, if a non-zero return code occurs on an API command issued by
COMET, an error will be logged and COMET will end the test case. This can
be prevented in one of two ways: use the "RC=..." parameter on the API
command, if the non-zero return code is expected, or use an IF statement
(or a series of IF statements) after the API command to test for the
possible return codes.
2. When using IF statements to check the return codes, COMET will continue to
the next non-IF statement following the API command ONLY if a true
condition is chosen in the IF statements. If the failing condition is not
found, then COMET will end the test case.
3. If the primary APPC return code (APPC_PRC) is correctly identified by an
IF statement, any errors in the secondary return code will be cleared, and
COMET will continue to the next statement which follows the APPC command.
(See note If.)
4. A bad comparison on an APPC Secondary return code (APPC_SRC) will not
necessarily cause COMET to terminate the test case. If the APPC Primary
return code is correctly identified using an IF statement after an APPC
function, the error in the secondary return code will be cleared, allowing
the test case to continue. Correctly identifying the secondary return code
will not clear an error in the primary return code, though.
5. If the actual srpi return code (SRPI_RC) is correctly identified, any
comparison error condition for the server return code (SRVR_RC) will be
ignored.
ΓòÉΓòÉΓòÉ 4.2.10. Return ΓòÉΓòÉΓòÉ
The return command tells COMET to return to the instruction following the last
CALL command which was processed. A subroutine begins with a label (see Labels
used for jumps.) and ends with a Return command. There may be more than one
return statement in a subroutine. The subroutine will end at the first return
statement encountered while processing the subroutine. A CALL command is used
to call the subroutine.
SYNTAX
RETURN;
There are no parameters for this instruction.
ΓòÉΓòÉΓòÉ 4.2.11. Labels used for Loops and Jumps. ΓòÉΓòÉΓòÉ
The method of labeling lines in the input file is different for loops and
jumps.
ΓòÉΓòÉΓòÉ 4.2.11.1. Labels used for loops. ΓòÉΓòÉΓòÉ
For loops, the label is part of the Begin_Loop and End_Loop statements, where
the first parameter on the input line after the Begin_Loop and End_Loop key
words is the loop name (or label). In the following example (Figure "Example
showing labels for loops"), two loops are used, called "loop1" and "loop2."
Since loop2 is nested within loop1, it will loop 5 times for every time loop 1
executes.
Begin_Loop loop1 count=10;
COMET instruction A;
Begin_Loop loop2 count=5;
COMET instruction B;
End_Loop loop2;
COMET instruction C;
End_Loop loop1;
Example showing labels for loops
This example shows how loop labels are used.
ΓòÉΓòÉΓòÉ 4.2.11.2. Labels used for jumps. ΓòÉΓòÉΓòÉ
For jumps (conditional and unconditional goto's) and subroutine calls, the line
to which the test case is jumping must be labeled. A label is created, just as
in a DOS batch file or OS/2 command file, by typing a colon (:) as the first
non-blank character on a line of the input file, and immediately following it
with the desired label. There may be no spaces in the label, and there may not
be a space between the starting colon and the label.
This same type of label (starting with a colon) is used if the start_label
option is used on the command line when starting COMET. See Syntax for Running
COMET for more details. In the following example (Figure "Example showing
labels for goto's"), "label1" is the label identifying the line at which
processing should continue should the IF condition be true, and "end_testcase"
is a label used at the end of the input file. Note that when calling the label,
the colon is not used.
APPC MC_CONFIRM;
If appc_prc = x'3' goto label1;
COMET instruction A;
goto end_testcase;
:label1
COMET instruction B;
:end_testcase
Example showing labels for goto's
This example shows how labels are used for conditional
and unconditional goto's.
In the above example, the following thing might happen:
If the actual primary return code from the Confirm is 3, then the next
instruction processed after the IF will be COMET instruction B, which
follows "label1" in the example.
If the actual primary return code is zero, then COMET will continue the test
case with COMET instruction A, which follows immediately after the IF
statement. Assuming the result of instruction A is good, COMET will then
jump to "end_testcase" as a result of the unconditional GOTO following
instruction A.
If the actual primary return code from the Confirm is something other than 0
or 3, then COMET will log an error and terminate the test case.
ΓòÉΓòÉΓòÉ 4.3. COMET Utility Commands ΓòÉΓòÉΓòÉ
This section describes COMET utility commands.
ΓòÉΓòÉΓòÉ 4.3.1. Compare_Files ΓòÉΓòÉΓòÉ
Compares two files to see if they are the same. The two files are not compared
byte for byte, but a checksum (CRC) is computed for each file, and the two
checksums are compared. If the checksums are equal, the files are assumed to
be the same and the test case continues to the next instruction in the input
file. If the checksums do not match, the files are assumed to be different. If
the files are not the same, an error message is stored in the status log, and
the test case is stopped.
SYNTAX
COMET COMPARE_FILES FILE1=file_specification,
FILE2=file_specification;
Where:
FILE1 is the name of the first file to be compared.
FILE2 is the name of the second file to be compared.
Sample Code
ΓòÉΓòÉΓòÉ 4.3.2. Display_On ΓòÉΓòÉΓòÉ
Turn on the display message facility. Informational messages describing what
is currently happening in the test case will be displayed to the screen. The
informational messages are the same as those stored into the log file created
by COMET.
SYNTAX
COMET DISPLAY_ON;
ΓòÉΓòÉΓòÉ 4.3.3. Display_Off ΓòÉΓòÉΓòÉ
Turn off the display message facility. This is the default condition; the
display_off command is not necessary unless the DISPLAY_ON instruction was
previously used. This does not affect the test case start and end messages. A
message indicating the test case has started and ended will be displayed even
if the DISPLAY_OFF option is used.
SYNTAX
COMET DISPLAY_OFF;
ΓòÉΓòÉΓòÉ 4.3.4. Debug_On ΓòÉΓòÉΓòÉ
Set debug mode for specific API's. Debug mode can be set for the ACDI, APPC,
SRPI, DBM, or SQL interfaces. If debug mode is set, the control blocks (data
structures) passed to the specified API and returned from the API will be
displayed on the screen. The hex and ascii representations of the control
blocks will be displayed. There is no decoding of specific fields within a
control block.
SYNTAX
COMET DEBUG_ON [COMET] [,ACDI] [,APPC] [,SRPI] [,DBM] [,SQL]
[,802.2] [,NETB] [ALL];
Where:
COMET will turn on the COMET debug facility.
ACDI will turn on the ACDI debug facility.
APPC will turn on the APPC debug facility.
SRPI will turn on the SRPI debug facility.
DBM will turn on the DBM debug facility.
SQL will turn on the SQL debug facility.
802.2 will turn on the 802.2 debug facility.
NETB will turn on the NETBIOS debug facility.
ALL will turn on all of the above debug facilities. None of the other
options should be selected if ALL is used.
ΓòÉΓòÉΓòÉ 4.3.5. Debug_Off ΓòÉΓòÉΓòÉ
Turn off debug mode for specific API's. If debug mode is not set for the
specified API, this command has no effect.
SYNTAX
COMET DEBUG_OFF [COMET] [,ACDI] [,APPC] [,SRPI] [,DBM] [,SQL]
[,802.2] [,NETB] [ALL];
Where:
COMET will turn on the COMET debug facility.
ACDI will turn off the ACDI debug facility.
APPC will turn off the APPC debug facility.
SRPI will turn off the SRPI debug facility.
DBM will turn off the DBM debug facility.
SQL will turn off the SQL debug facility.
802.2 will turn off the 802.2 debug facility.
NETB will turn off the NETBIOS debug facility.
ALL will turn off all of the above debug facilities. None of the other
options should be selected if ALL is used.
ΓòÉΓòÉΓòÉ 4.3.6. Entry_Points ΓòÉΓòÉΓòÉ
Used to specify a file which will contain the addresses of key COMET procedures
loaded into main memory. If the file specified exists, it will be written over.
If the file specified does not already exist, it will be created.
SYNTAX
COMET ENTRY_POINTS FILE=file_specification;
Where:
FILE is the name of the output file.
ΓòÉΓòÉΓòÉ 4.3.7. Exit ΓòÉΓòÉΓòÉ
Used to end a test case and exit COMET The input file can specify an error
level to be returned to the operating system when ending COMET
SYNTAX
COMET EXIT ERRORLEVEL=number;
Where:
ERRORLEVEL is the return code (error level) to be returned to the operating
system. The number specified should be a decimal number.
ΓòÉΓòÉΓòÉ 4.3.8. Log ΓòÉΓòÉΓòÉ
Used to control the logging of status information when an input file is being
processed. This command can be used to turn logging on and off, or to change
the name of the output log file.
SYNTAX
COMET LOG [FILE=file_name] [,ACTION=<PAUSE|RESUME|RESET>];
Where:
FILE is the new name to be used for the output log file. The previous
log file is closed if PAUSE or RESET are specified. NOTE: Using
this parameter without any ACTION will cause the specified file to
be cleared of data and replaced by a log file. RESET is the
default value for ACTION. At least one parameter must be
specified.
ACTION is used to control logging. PAUSE will cause COMET to stop
logging status to the output log file. RESUME will cause logging
to resume in append mode. RESET will clear any current log file
and will start a fresh log in the specified file or the current
log file. PAUSE, RESUME, and RESET all need a current log file or
a new log file name specified. For example, if COMET was started
with the /nl (no log) option and RESET was specified without a
file name, COMET will end with an error. On the other hand, if
COMET was started without specifying a log file or /nl, RESET
specified without a file parameter would cause a new log to be
made in cometlog.txt.
ΓòÉΓòÉΓòÉ 4.3.9. MSG ΓòÉΓòÉΓòÉ
Used to display a message to the screen or store it into a file.
SYNTAX
COMET MSG MSG="user message string" [,FILE=file_name]
[,DISPLAY];
Where:
MSG is the message which is to be displayed or logged.
FILE is the name of the file into which the message should be stored.
The file will be opened in append mode, and the message added to
the end of the file. If FILE is specified, the message will not
be displayed to the screen unless the DISPLAY option is also used.
DISPLAY tells COMET to display the message on the screen in addition to
storing it into a file. If the FILE parameter is not used, it is
not necessary to specify DISPLAY, since it will be displayed on
the screen by default.
ΓòÉΓòÉΓòÉ 4.3.10. WAIT ΓòÉΓòÉΓòÉ
Used to tell COMET to wait for an operator to press the ENTER key on the
keyboard before continuing. A message can optionally be displayed on the
screen.
SYNTAX
COMET WAIT [MSG="user message string"];
Where:
MSG is the message which is to be displayed.
ΓòÉΓòÉΓòÉ 4.4. OS/2 Shell commands ΓòÉΓòÉΓòÉ
COMET supports two types of OS/2 commands. The first type, described here, are
OS/2 shell commands. See OS2_API commands for a description of OS/2 API
commands.
OS/2 shell commands cause COMET to issue OS/2 commands which would normally be
issued at the OS/2 command line prompt. The string specified in the OS2_SHELL
instruction is passed directly to the OS/2 prompt and executed in an OS/2
shell. OS/2 shell instructions begin with the keyword: OS2_SHELL
SYNTAX
OS2_SHELL "os2 command string";
For example, the following instruction would cause COMET to issue an OS/2 copy
command.
OS2_SHELL "COPY file1.ext file2.ext";
The following utility command would cause a file called file1.ext to be erased.
OS2_SHELL "ERASE file1.ext";
The following utility command would cause a directory list to be displayed on
the screen.
OS2_SHELL "dir";
Sample Code
ΓòÉΓòÉΓòÉ 4.5. OS2_API commands ΓòÉΓòÉΓòÉ
The second type of OS/2 command supported by COMET is OS2 API. See OS/2 Shell
commands for a description of OS/2 SHELL commands.
OS/2 API commands cause COMET to issue the specified OS/2 API function calls to
the OS/2 callable interface. They begin with the keyword: OS2_API
New OS/2 commands will be added to COMET as the need arises. Since normal
COMET processing already causes various OS/2 commands to be issued, the need
for adding more OS/2 function calls to the COMET input file command language is
small.
ΓòÉΓòÉΓòÉ 4.5.1. DosBeep ΓòÉΓòÉΓòÉ
Generate sound from the PC speaker.
SYNTAX
OS2_API DOSBEEP frequency,duration [,RC=expected_return_code];
Where:
frequency is the frequency in hertz (cycles per second) of the tone to be
generated, in range of 37 to 32767.
duration is the length of the sound in milliseconds.
RC is the expected return code. If this parameter is not specified,
an error will be flagged if the return code is not okay.
Sample Code
ΓòÉΓòÉΓòÉ 4.5.2. DosGetDateTime ΓòÉΓòÉΓòÉ
This command will be supported in a future version of COMET.
Get the current time and date from the operating system. The result can be
displayed to the screen or stored in a file.
SYNTAX
OS2_API TIMEDATE [FILE=file_specification] [,RC=expected_return_code];
Where:
FILE is a file specification, which may include the drive and path. If
the file already exists, the time and date will be appended to the
end. Otherwise, the file will be created.
If the FILE parameter is not specified, the time and date will be
displayed to the screen.
RC is the expected return code. If this parameter is not specified,
an error will be flagged if the return code is not okay.
Sample Code
ΓòÉΓòÉΓòÉ 4.5.3. DosSetDateTime ΓòÉΓòÉΓòÉ
This command will be supported in a future version of COMET.
Set the current system time and date.
SYNTAX
OS2_API SETTIMEDATE [TIME=time_specification]
[,DATE=date_specification] [,RC=expected_return_code];
Where:
TIME is a time specification in the format: HH:MM[:SS]. HH is the
hours, MM is the minutes, and SS is the seconds. The Seconds are
optional.
DATE is a date specification in the format: MM/DD/YYYY. MM is the month
(01-12), DD is the day (01-31), and YYYY is the year (0000-9999).
RC is the expected return code. If this parameter is not specified,
an error will be flagged if the return code is not okay.
Sample Code
ΓòÉΓòÉΓòÉ 4.5.4. DosSleep ΓòÉΓòÉΓòÉ
Wait for a specified length of time before continuing to the next step of the
test case.
SYNTAX
OS2_API DOSSLEEP SECONDS = number_of_seconds [,MINUTES =
number_of_minutes];
Where:
SECONDS is the number of seconds to wait before continuing.
MINUTES is the number of minutes to wait before continuing.
Sample Code
ΓòÉΓòÉΓòÉ 4.6. DBM (Database Manager) commands ΓòÉΓòÉΓòÉ
COMET divides the available database manager calls into two groups. The first
group, DBM (database manager) calls, is described in this section. The other
group (SQL, or structured query language) calls is described in SQL (Structured
Query Language) commands. The DBM calls include Database Environment (DBE)
commands and Database Utility (DBU) commands, as described in the Database
Manager documentation. The SQL calls include Data Definition Language (DDL)
commands, Data Manipulation Language (DML) commands, and Dynamic SQL Language
(DSL) commands. Only a subset of these commands will be supported by COMET.
The following sections list the supported commands and describe the syntax to
be used when including these commands in a COMET test case input file.
For a more complete description of the Database commands, see the OS/2 Database
Manager Programming Guide or or other Database Manager Documentation.
Refer to General Instruction Syntax for general information about the command
syntax for COMET instructions.
ΓòÉΓòÉΓòÉ 4.6.1. Alter_DB ΓòÉΓòÉΓòÉ
Change the password for a database, or add or delete database security.
SYNTAX
DBM ALTER_DB DB=database_name, OLDPW=old_password,
NEWPW=new_password [,RC=expected_return_code];
Where:
DB is the database name.
OLDPW is the old password. To add database security (if there was no
old password specified), set OLDPW=NONE.
NEWPW is the new password. To remove database security (to eliminate
the password), set NEWPW=NONE.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.6.2. Catalog_DB ΓòÉΓòÉΓòÉ
(Remote Database Services command) Catalogs a remote database.
SYNTAX
DBM CATALOG_DB DB=database_name [,ALIAS=alias_database_name]
[,NODENAME=node name alias] [,TYPE=0|1] [,DRIVE=drive lam alias]
[,COMMENT=comment string] [,CODEPAGE=comment_code_page]
[,RC=expected_return_code];
Where:
DB is the remote database name.
ALIAS is the alias name the remote database will be known as locally.
NODENAME is the name of the node to be used. Note: the node was defined
using CATALOG_NODE or Query Manager.
TYPE is the type to be associated with the database. Type 0 speficies
this will be an local indirectly cataloged db. Type 1, which is
the default, specifies that this will be a remotely access
database.
DRIVE used when TYPE=0, this will specifiy the drive the local
indirectly cataloged database resides on.
COMMENT is a comment string.
CODEPAGE is the desired code page number (used with national language
support applications).
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.6.3. Catalog_Node ΓòÉΓòÉΓòÉ
(Remote Database Services command) Catalogs a node for RDS communications.
SYNTAX
DBM CATALOG_NODE NODENAME=node_name ,LOCAL_LU=local_lu_name
,PARTNER_LU=partner_lu_name ,MODE=mode_name [,COMMENT=descriptive
comment ] [,CODEPAGE=comment_codepage_number]
[,RC=expected_return_code];
Where:
NODENAME is the name to be used when referring this node.
LOCAL_LU is the defined local lu name for the SNA conversation session.
PARTNER_LU is the defined partner lu alias name for this SNA conversation
session.
MODE is the conversation mode for this conversation session.
COMMENT is a comment string for this node.
CODEPAGE is the desired code page number (used with national language
support applications).
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.6.4. Create_DB ΓòÉΓòÉΓòÉ
Initialize a new database. A bind to a database is automatically done by COMET
immediately after the Create Database command is issued.
SYNTAX
DBM CREATE_DB DB=database_name [,PW=password] [,COMMENT="comment
string"] [,CODEPAGE=codepage_number] [,RC=expected_return_code];
Where:
DB is the database name.
PW is the password, if required.
COMMENT is a comment string.
CODEPAGE is the desired code page number (used with national language
support applications).
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.6.5. Drop_DB ΓòÉΓòÉΓòÉ
Drop a database.
SYNTAX
DBM DROP_DB DB=database_name [,PW=password]
[,RC=expected_return_code];
Where:
DB is the database name.
PW is the password, if required.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.6.6. Export_from ΓòÉΓòÉΓòÉ
Copy data from a database table or view into an OS/2 file.
The DCOLDATA parameter used by the EXPORT function is set to null by COMET.
That parameter can not be specified in the input file.
Note: A SQL COMMIT command should be issued after issuing previous database
environment commands (such as CREATE DB, CREATE TABLE, ...) and before issuing
the database utility IMPORT or EXPORT commands.
SYNTAX
DBM EXPORT_FROM DB=database_name [,PW=password]
,DATAFILE=data_file_specification ,TCOLSTRG="select statement"
,FILETYPE= < DEL | IXF | WSF > [,FILETMOD="file type modifier"]
[,MSGFILE=message_file_specification] [,RC=expected_return_code];
Where:
DB is the database name.
PW is the password, if required.
DATAFILE is the name of the file into which the data is to exported.
TCOLSTRG is a SELECT statement specification, used to tell the database
manager which items to export to the file. It must be enclosed in
quotes.
FILETYPE is type of file to be created.
DEL is Delimited ASCII
IXF is PC version for exchange with host products via IWX-CPSI.
WSF is Work Sheet Formats (lotus and symphony)
FILETMOD modifies the file type. Refer to Database Manager documentation
for valid FILETMOD strings. If this parameter is not specified,
the database managers default values will be used. For FILETYPE=
WSF, the following values are valid for FILETMOD. They must be
enclosed in quotes. The specified character string is passed
directly, as is. Other values may be specified, if error
conditions are being tested.
"1" specifies a first generation WSF file (lotus 123/1 or lotus 123/A).
"2" specifies a second generation WSF file (symphony/1.0).
"3" specifies a third generation WSF file (lotus 123/2 or symphony/1.1).
If just "3" is used, the default product type is lotus.
"3L" specifies a third generation WSF file (lotus 123/2 or symphony/1.1).
The L specifies that the product type is lotus.
"3S" specifies a third generation WSF file (lotus 123/2 or symphony/1.1).
The S specifies that the product type is symphony.
MSGFILE specifies the desired destination of EXPORT messages, if any
occur. A file specification may be set, or a standard device such
as LPT1 or NUL my be used.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.6.7. Import_to ΓòÉΓòÉΓòÉ
Insert data into a database table or view from an OS/2 file.
The DCOLDATA parameter used by the IMPORT function is set to null by COMET.
That parameter can not be specified in the input file.
Note: A SQL COMMIT command should be issued after issuing previous database
environment commands (such as CREATE DB, CREATE TABLE, ...) and before issuing
the database utility IMPORT or EXPORT commands.
SYNTAX
DBM IMPORT_TO DB=database_name [,PW=password]
,DATAFILE=data_file_name ,TCOLSTRG="column description string"
,FILETYPE= < DEL | ASC | IXF | WSF > [,FILETMOD="file type modifier"]
[,MSGFILE=message_file_specification] [,RC=expected_return_code];
Where:
DB is the database name.
PW is the password, if required.
DATAFILE is the name of the file containing the data to be imported.
TCOLSTRG is a string describing the columns into which the data should be
imported. Refer to Database Manager documentation for the valid
format of this string. The specified string must be enclosed in
quotes. The string specified within the quotes is a REPLACE,
CREATE, or INSERT statement, as defined in the Database Manager
documentation.
FILETYPE is type of file to be created.
DEL is Delimited ASCII
ASC is Non-delimited ASCII
IXF is PC version for exchange with host products via IWX-CPSI.
WSF is Work Sheet Formats (lotus and symphony)
FILETMOD modifies the file type. Refer to Database Manager documentation
for valid FILETMOD strings. If this parameter is not specified,
the database managers default values will be used.
MSGFILE specifies the desired destination of EXPORT messages, if any
occur. A file specification may be set, or a standard device such
as LPT1 or NUL may be used.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.6.8. Restore ΓòÉΓòÉΓòÉ
(Remote Database Services command) Restores a database.
SYNTAX
DBM RESTORE_DB DB=database_name ,DRIVE=drive_to_restore_from
[,DB_DRIVE=drive_to_restore_to] [,RC=expected_return_code];
Where:
DB is the restore database name.
DRIVE is the drive where database backup files are located.
DB_DRIVE is the drive where the restored database should be written to. The
default is drive C:.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.6.9. StartDBM ΓòÉΓòÉΓòÉ
Start the database manager.
This function can also be done using the OS/2 SHELL command, if it is desired
to start the database manager from the OS/2 command prompt.
SYNTAX
DBM STARTDBM [RC=expected_return_code];
Where:
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.6.10. Start_Using_DB ΓòÉΓòÉΓòÉ
Connect to a database for database manipulation.
SYNTAX
DBM START_USING_DB DB=database_name [,PW=password]
[,USE=<S|X>] [,RC=expected_return_code];
Where:
DB is the database name.
PW is the password, if required.
USE is the exclusive use indicator. USE=S means the database is
shared. USE=X means that exclusive use is requested. If not
specified, USE=S is the default.
Note: For exclusive use of a database, the SQLUSER environment
string must be set prior to issuing the START_USING_DB command.
This can be done from within COMET by issuing an OS2_SHELL
command. For example: OS2_SHELL "SET SQLUSER sqluser_name";
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.6.11. StopDBM ΓòÉΓòÉΓòÉ
Terminate the Database Manager.
SYNTAX
DBM STOPDBM [RC=expected_return_code];
Where:
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.6.12. Stop_Using_DB ΓòÉΓòÉΓòÉ
Disconnect from a database.
SYNTAX
DBM STOP_USING_DB [RC=expected_return_code];
Where:
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.6.13. Uncatalog_DB ΓòÉΓòÉΓòÉ
(Remote Database Services command) Uncatalogs a remote database.
SYNTAX
DBM UNCATALOG_DB DB=database_name [,RC=expected_return_code];
Where:
DB is the name the database alias to be uncataloged.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.6.14. Uncatalog_Node ΓòÉΓòÉΓòÉ
(Remote Database Services command) Uncatalogs a node.
SYNTAX
DBM UNCATALOG_NODE NODENAME=node_name [,RC=expected_return_code];
Where:
NODENAME is the name to be used when referring this node.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.6.15. Unsupported Database Utility commands ΓòÉΓòÉΓòÉ
The following database utility commands are not supported in this version of
COMET. This means that the input file containing a test case script may not
issue these instructions. Support of these commands will be added as time
permits.
BACKUP DATABASE
REORG TABLE UTILITY
RUNSTATS
ΓòÉΓòÉΓòÉ 4.7. SQL (Structured Query Language) commands ΓòÉΓòÉΓòÉ
The SQL (structured Query Language) commands described in this section include
Data Definition Language (DDL) commands, Data Manipulation Language (DML)
commands, as defined in the Database Manager documentation. The Dynamic SQL
EXECUTE IMMEDIATE command is used to implement the SQL functions, with the
exception of the SELECT operation.
When adding a SQL command to a COMET input file, the keyword SQL should be the
first word of the instruction. The actual SQL instruction must be enclosed in
quotes. The general syntax to be followed when using SQL statements in the
COMET test case input file is this:
SQL "sql command string", other parameters;
The following sections describe the formats of some valid SQL commands. Other
SQL commands (or invalid commands) may be enclosed within the quotes, if
desired. The character string specified in SQL statements are be passed
directly to the Database Manager using the EXECUTE IMMEDIATE function. If the
string specified in the input file contains an invalid SQL statement, the
return code from the database manager should reflect the error.
ΓòÉΓòÉΓòÉ 4.7.1. Alter Table ΓòÉΓòÉΓòÉ
Used to add columns to a table.
SYNTAX
SQL "ALTER TABLE table_name ADD column_name datatype [FOR BIT DATA]
[ADD column_name datatype [FOR BIT DATA]]..."
[,RC=expected_return_code];
Where:
"ALTER..." is the ALTER TABLE string.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.7.2. Create Index ΓòÉΓòÉΓòÉ
Create an index on an existing table.
SYNTAX
SQL "CREATE [UNIQUE] INDEX index_name ON table_name (column_name [ASC |
DESC] [,column_name [ASC | DESC]] ...)" [,RC=expected_return_code];
Where:
"CREATE.." is the CREATE INDEX string.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.7.3. Create Table ΓòÉΓòÉΓòÉ
Create a table in a database.
SYNTAX
The parentheses () shown in the following syntax are required.
SQL "CREATE TABLE tablename (column_name datatype [FOR BIT DATA] [NOT
NULL] [, column_name datatype [FOR BIT DATA] [NOT NULL]]...)"
[,RC=expected_return_code];
Where:
"CREATE.." is the CREATE TABLE string.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.7.4. Create View ΓòÉΓòÉΓòÉ
Define a view on a table.
SYNTAX
SQL "CREATE VIEW view_name [(column_name [,column_name]...) AS
select_statement [WITH CHECK OPTION]" [,RC=expected_return_code];
Where:
"CREATE.." is the CREATE VIEW string.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.7.5. Drop Index ΓòÉΓòÉΓòÉ
Drop an index.
SYNTAX
SQL "DROP index_name" [,RC=expected_return_code];
Where:
"DROP..." is the DROP INDEX string.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.7.6. Drop Table ΓòÉΓòÉΓòÉ
Drop a drop a table from the database.
SYNTAX
SQL "DROP TABLE table_name" [,RC=expected_return_code];
Where:
"DROP..." is the DROP TABLE string.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.7.7. Drop View ΓòÉΓòÉΓòÉ
Drop a view definition.
SYNTAX
SQL "DROP VIEW view_name" [,RC=expected_return_code];
Where:
"DROP..." is the DROP VIEW string.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.7.8. Commit ΓòÉΓòÉΓòÉ
Commit work previously performed for a database transaction.
SYNTAX
SQL "COMMIT [WORK] [HOLD]" [,RC=expected_return_code];
Where:
"COMMIT.." is the COMMIT string.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.7.9. Delete ΓòÉΓòÉΓòÉ
Remove rows from a data base table.
SYNTAX
SQL "DELETE FROM tablename [correlname] [WHERE predicate]"
[,RC=expected_return_code];
Where:
"DELETE.." is the DELETE string.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.7.10. Insert ΓòÉΓòÉΓòÉ
Add new rows to a database table.
SYNTAX
SQL "INSERT INTO tablename [(column_name list)] VALUES (value list)"
[,RC=expected_return_code];
Where:
"INSERT.." is the INSERT string.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.7.11. Rollback ΓòÉΓòÉΓòÉ
Back out unwanted work performed for a database transaction.
SYNTAX
SQL "ROLLBACK [WORK]" [,RC=expected_return_code];
Where:
"ROLLBACK.." is the ROLLBACK string.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.7.12. Select ΓòÉΓòÉΓòÉ
Selectively choose a list of information from a database.
The Dynamic SQL version of the select_statement definition is supported by
COMET. The INTO clause is not supported.
COMET does not issue a SELECT directly, but must issue several other commands
to accomplish the task in a dynamic SQL environment. Those commands include
Open Cursor, Prepare, Fetch, and Close Cursor.
SYNTAX
SQL "SELECT [ALL | DISTINCT] < * | select-list > FROM tablename
[correlname] [,tablename [correlname]] ... [WHERE predicate]
[GROUP BY colname[,colname] ...] [HAVING predicate] [FOR UPDATE OF
colname[,colname] ...] | ORDER BY <colname | colnum [ASC | DESC]> [,
<colname | colnum [ASC | DESC]>...]]", FILE=pcfile_specification
[,RC=expected_return_code];
Where:
"SELECT.." is the SELECT string.
FILE is the name of the file into which the selected rows are stored.
If the file already exists, the data will be appended to the end
of the file.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.7.13. Update ΓòÉΓòÉΓòÉ
Change the data in specified rows of a database table.
SYNTAX
SQL "UPDATE tablename [(correlname)] SET colname = <expression | NULL>
[, colname = <expression | NULL>]... [WHERE predicate]"
[,RC=expected_return_code];
Where:
"UPDATE.." is the UPDATE string.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.7.14. Dynamic SQL Language ΓòÉΓòÉΓòÉ
These commands are used by COMET, but can not be issued from the test case
input file.
DECLARE CURSOR
EXECUTE
EXECUTE IMMEDIATE
PREPARE
ΓòÉΓòÉΓòÉ 4.8. Query Manager Callable Interface ΓòÉΓòÉΓòÉ
The Query Manager Callable Interface function provides a mechanism for
executing Query Manager functions through a CPI. COMET passes Query Manager
commands through this CPI which are then executed by Query Manager. Return
codes and status information, resulting from the execution, are returned to
COMET When required, Query Manger windows are displayed if the Callable
Interface is started in Interactive mode.
When adding a Query Manager Callable Interface (QRYCI) command to a COMET input
file, the keyword QRYCI should be the first word of the instruction. The
actual QRYCI instruction must be enclosed in quotes. The general syntax to be
followed when using QRYCI commands in the COMET test case input file is this:
QRYCI "Query Manger command string" [,other parameters];
The following sections describe the formats of some valid QRYCI commands. Other
QRYCI commands (or invalid commands) may be enclosed within the quotes, if
desired. The character string specified in QRYCI statements are be passed
directly to the Query Manager. If the string specified in the input file
contains an invalid QRYCI statement, the return code from the Query Manager
should reflect the error.
ΓòÉΓòÉΓòÉ 4.8.1. START ΓòÉΓòÉΓòÉ
Issued only once, before any other QRYCI commands to start Query Manager
Callable Interface.
SYNTAX
QRYCI "START" [,MODE=INTERACTIVE|BATCH] [,DB=database_name]
[,QUALIFIER=qualifier_name] [,RC=expected_return_code];
Where:
START is the command issued start Query Manager Callable Interface.
MODE is the desired Query Manager Callable Interface mode of execution.
If the mode is batch, then user interface will not be permitted
since Query Manager Callable Interface will not display any panels
(windows). The default mode is INTERACTIVE, this means panels will
be displayed. For example, when a query is executed the results
will be displayed on a report panel and will require user
intervention for process continuation to next input script
command.
DB The name of the database to open. If this parameter is not
specified, the QRYCI panel displayed will be the Query Manager
Databases List and one will require to be selected.
Qualifier is the qualifier to be used. If not specified, the default is the
local logon id used.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.8.2. Example of QRYCI commands other than START. ΓòÉΓòÉΓòÉ
Used to execute objects that are located in the database.
SYNTAX
QRYCI "RUN QUERY query_name USING ...." [,RC=expected_return_code];
Where:
"RUN QUERY ..." is the example QRYCI command (issued to run a predefined
query).
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.9. ACDI (Asynchronous Communication Device Interface) commands ΓòÉΓòÉΓòÉ
The Communication Manager's ACDI interface supports a number of commands. Only
a subset of those commands are supported by COMET. The following sections
describe the syntax to be used when including ACDI instructions in a COMET test
case input file.
Refer to General Instruction Syntax for general information about the command
syntax.
Each ACDI instruction begins with the keyword: ACDI
ΓòÉΓòÉΓòÉ 4.9.1. ComClose ΓòÉΓòÉΓòÉ
Close the async communications adapter, making it unavailable for use. When
this command is issued, the send and receive threads dropped.
SYNTAX
ACDI CLOSE [RC=expected_return_code];
Where:
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.9.2. ComConnect ΓòÉΓòÉΓòÉ
Establish a connection on an ASYNC line.
SYNTAX
ACDI CONNECT TYPE=connection_type [,TIMEOUT1=connect_timeout_1]
[,TIMEOUT2=connect_timeout_2] [,PREFIX="Telephone network prefix
string"] [,SUFFIX="Telephone network suffix string"]
[,NUMBER="Telephone number"] [,RC=expected_return_code];
Where:
TYPE is the connection type. See the Communication Manager
documentation for valid values.
TIMEOUT1 is timeout value 1. See the Communication Manager documentation
for valid values.
TIMEOUT2 is timeout value 2. See the Communication Manager documentation
for valid values.
PREFIX is the telephone network prefix string. See your modem
documentation to see if this is required, and for valid values.
SUFFIX is the telephone network suffix string. See your modem
documentation to see if this is required, and for valid values.
NUMBER is the telephone number to be dialed, if autocall is used.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.9.3. ComDisconnect ΓòÉΓòÉΓòÉ
Disconnect the Async line.
SYNTAX
ACDI DISCONNECT [RC=expected_return_code];
Where:
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.9.4. ComOpen ΓòÉΓòÉΓòÉ
Open the async communications adapter, making it available for use. When this
command is issued two background threads are created; one for sending and
another for receiving.
SYNTAX
ACDI OPEN DEV=Com_Device_Name [,RC=expected_return_code];
Where:
DEV is the communication device name. Valid values are COM1, COM2,
etc.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Where Com_Device_Name is COM1, COM2, etc.
Sample Code
ΓòÉΓòÉΓòÉ 4.9.5. ComRetBitRate ΓòÉΓòÉΓòÉ
Get the current bit rate settings from ACDI.
SYNTAX
ACDI RETBIT SEND=send_bit_rate, RCV=receive_bit_rate
[,RC=expected_return_code];
Where:
SEND is the send bit rate expected to be returned by the communication
manager. COMET will compare this value with the value actually
returned from ACDI. If they are not the same, an error will be
flagged.
RCV is the receive bit rate expected to be returned by the
communication manager. COMET will compare this value with the
value actually returned from ACDI. If they are not the same, an
error will be flagged.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
See ComSetBitRate for the valid parameter values.
Sample Code
ΓòÉΓòÉΓòÉ 4.9.6. ComRetLineCtrl ΓòÉΓòÉΓòÉ
Get the current Line Control parameters from ACDI and compare the parameters to
those specified here.
SYNTAX
ACDI RETLINECTRL STOPBITS=number_of_stop_bits, PARITY=parity,
DATABITS=number_of_data_bits [,RC=expected_return_code];
Where:
STOPBITS is the value expected to be returned by the communication manager
denoting the number of stop bits being used. COMET will compare
this value with the value actually returned from ACDI. If they are
not the same, an error will be flagged.
PARITY is the parity value expected to be returned by the communication
manager. COMET will compare this value with the value actually
returned from ACDI. If they are not the same, an error will be
flagged.
DATABITS is the value expected to be returned by the communication manager
denoting the number of data bits being used. COMET will compare
this value with the value actually returned from ACDI. If they
are not the same, an error will be flagged.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
See ComSetLineCtrl for valid values for the parameters.
Sample Code
ΓòÉΓòÉΓòÉ 4.9.7. ComSetBitRate ΓòÉΓòÉΓòÉ
Set the bit rates for send and receive.
SYNTAX
ACDI SETBIT SEND=send_bit_rate, RCV=receive_bit_rate
[,RC=expected_return_code];
Where:
SEND is the send bit rate. Valid numbers are 110, 150, 300, 600, 1200,
2400, and 9600.
RCV is the receive bit rate. Valid numbers are the same as in SEND.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.9.8. ComSetLineCtrl ΓòÉΓòÉΓòÉ
Set the line control parameters.
SYNTAX
ACDI SETLINECTRL STOPBITS=number_of_stop_bits, PARITY=parity,
DATABITS=number_of_data_bits [,RC=expected_return_code];
Where:
STOPBITS is the number of stop bits. Valid values are 1, 1.5, or 2.
PARITY is the parity used for each character. Valid values are NONE,
ODD, EVEN, MARK, or SPACE.
DATABITS is the number of data bits in each character. Valid values are 5,
6, 7, and 8.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.9.9. ACDI SEND command ΓòÉΓòÉΓòÉ
This is a COMET command used to send data across the ASYNC link. Various ACDI
API commands will be used by COMET to accomplish the SEND function. The remote
pc should also have an ACDI communication session started before the SEND
command is issued.
NOTE: The ACDI SEND runs in a background thread which will be used for
transmission of data. This allows COMET to continue processing instructions in
the foreground thread. Therefore, the user should make certain that the ACDI
SEND has completed before COMET terminates, otherwise the background thread may
be stopped and the file transfer may not be successful. The DosSleep command
can be used in this case to stall COMET in processing succeeding instructions
for the time specified. For more information on the DosSleep command refer to
OS2_API commands. A future version of COMET will automatically wait for the
data transfer to be completed before processing the next instruction.
SYNTAX
ACDI SEND FILE=file_specification;
Where:
FILE is the name of a file containing data to be transmitted.
ΓòÉΓòÉΓòÉ 4.9.10. ACDI RCV command ΓòÉΓòÉΓòÉ
This command will be supported in a future version of COMET.
This is a COMET command used when the test case expects to receive data from
the ASYNC link. Various ACDI API commands will be used by COMET to accomplish
the RCV function.
SYNTAX
ACDI RCV FILE=file_specification;
Where:
FILE is the name of a file into which the received data should be
stored.
ΓòÉΓòÉΓòÉ 4.9.11. Unsupported ACDI commands ΓòÉΓòÉΓòÉ
The following verbs are not supported by this version of COMET This means that
the COMET input file can not include these commands in the test case script.
Some of these commands are used internally by COMET to process the SEND and
RECEIVE functions described previously.
ComDefInputBuff
ComDefOutputBuff
ComDrainOutput
ComFlushInput
ComFlushOutput
ComGetLineInfo
ComReadBlock
ComReadCharString
ComReadEvent
ComRetCharXmitRate
ComRetErrorCharSub
ComRetFlowChar
ComRetFlowMode
ComRetFlowThresh
ComRetTimeouts
ComSendBreak
ComSetCharXmitRate
ComSetErrorCharSub
ComSetFlowChar
ComSetFlowMode
ComSetFlowThresh
ComSetInputMode
ComSetMinBreak
ComSetTimeouts
ComStartTrans
ComStopTrans
ComTransImm
ComUnblockThreads
ComWriteCharString
ΓòÉΓòÉΓòÉ 4.10. APPC (Advanced Program to Program Communications) commands ΓòÉΓòÉΓòÉ
The following sections describe the commands supported by COMET for the APPC
programming interface. In the initial version of COMET, only Mapped
conversations will be supported. COMET does not support program level security
or PIP data.
Before a test case containing APPC instructions can be run, the proper LU
configurations must be set up using the Communication Manager's configuration
utilities. Refer to the Communication Manager Installation and Configuration
documentation for further information.
This section is concerned only with the syntax of the COMET APPC instructions,
and does not describe the APPC functions actually performed by the various
verbs. Refer to an APPC manual such as the "Transaction Programmer's Guide for
APPC," the OS/2 Communication Manager APPC Programmer's Guide, or other
Communication Manager documentation for a more complete description of the
meaning of the APPC verbs.
Refer to General Instruction Syntax for general information about the command
syntax.
Each APPC instruction begins with the keyword: APPC
ΓòÉΓòÉΓòÉ 4.10.1. Mc_Allocate ΓòÉΓòÉΓòÉ
Allocate a conversation with a remote transaction program.
SYNTAX
APPC MC_ALLOC [CONV=conversation_number,] REMOTE_LU="remote_lu_alias",
MODE="mode_name", TP="remote_tp_name", SYNC=<NONE | CONFIRM>
[,PRC=expected_primary_return_code]
[,SRC=expected_secondary_return_code];
Where:
CONV is the conversation number (from 1 to 5). Up to 5 conversations
can be running at any time. If not specified, the default is
CONV=1.
REMOTE_LU is the locally known name for the remote LU (from Communication
Manager Configuration).
MODE is the mode name (from Communication Manager Configuration).
TP is the remote Transaction Program name (the name of the program in
the remote machine).
SYNC is the sync level: either NONE or CONFIRM. NONE means a
synchronization level of "none" will be used. CONFIRM means a
sync level of confirm will be set.
PRC is the primary return code expected from APPC. COMET will compare
the value specified here with the value actually returned by APPC,
and flag an error if they are not the same. If this parameter is
not specified, an error will be flagged if the return code is not
okay.
SRC is the secondary return code expected from APPC. COMET will
compare the value specified here with the value actually returned
by APPC, and flag an error if they are not the same. If this
parameter is not specified, an error will be flagged if the return
code is not okay.
Sample Code
ΓòÉΓòÉΓòÉ 4.10.2. Mc_Confirm ΓòÉΓòÉΓòÉ
Request the the remote transaction program confirm receipt of the data which
has been sent.
SYNTAX
APPC MC_CONFIRM [CONV=conversation_number]
[,PRC=expected_primary_return_code]
[,SRC=expected_secondary_return_code];
Where:
CONV is the conversation number, to allow COMET to keep track of the
conversations if more than one is active at a time. If not
specified, the default is CONV=1.
PRC is the primary return code expected from APPC. COMET will compare
the value specified here with the value actually returned by APPC,
and flag an error if they are not the same. If this parameter is
not specified, an error will be flagged if the return code is not
okay.
SRC is the secondary return code expected from APPC. COMET will
compare the value specified here with the value actually returned
by APPC, and flag an error if they are not the same. If this
parameter is not specified, an error will be flagged if the return
code is not okay.
EXAMPLES
Here is an example of a confirm verb instruction.
appc CONFIRM conv=1;
Sample Code
ΓòÉΓòÉΓòÉ 4.10.3. Mc_Confirmed ΓòÉΓòÉΓòÉ
Confirm the receipt of data as requested by the remote transaction program.
SYNTAX
APPC MC_CONFIRMED [CONV=conversation_number]
[,PRC=expected_primary_return_code]
[,SRC=expected_secondary_return_code];
Where:
CONV is the conversation number, to allow COMET to keep track of the
conversations if more than one is active at a time. If not
specified, the default is CONV=1.
PRC is the primary return code expected from APPC. COMET will compare
the value specified here with the value actually returned by APPC,
and flag an error if they are not the same. If this parameter is
not specified, an error will be flagged if the return code is not
okay.
SRC is the secondary return code expected from APPC. COMET will
compare the value specified here with the value actually returned
by APPC, and flag an error if they are not the same. If this
parameter is not specified, an error will be flagged if the return
code is not okay.
EXAMPLES
Here is an example of a confirmed verb instruction.
APPC confirmed conv=1;
Sample Code
ΓòÉΓòÉΓòÉ 4.10.4. Mc_Deallocate ΓòÉΓòÉΓòÉ
Deallocate a conversation. A deallocate type sync level will be issued.
SYNTAX
APPC MC_DEALLOC [CONV=conversation_number]
[,PRC=expected_primary_return_code]
[,SRC=expected_secondary_return_code];
Where:
CONV is the conversation number, to allow COMET to keep track of the
conversations if more than one is active at a time. If not
specified, the default is CONV=1.
PRC is the primary return code expected from APPC. COMET will compare
the value specified here with the value actually returned by APPC,
and flag an error if they are not the same. If this parameter is
not specified, an error will be flagged if the return code is not
okay.
SRC is the secondary return code expected from APPC. COMET will
compare the value specified here with the value actually returned
by APPC, and flag an error if they are not the same. If this
parameter is not specified, an error will be flagged if the return
code is not okay.
EXAMPLE
Here is an example of a deallocate.
appc mc_dealloc conv=1;
Sample Code
ΓòÉΓòÉΓòÉ 4.10.5. Mc_Receive_And_Wait ΓòÉΓòÉΓòÉ
Wait for something to arrive on a specific conversation.
SYNTAX
APPC MC_RCV_WAIT [CONV=conversation_number]
[,LENGTH=user_specified_length] [,WHAT=< DATA_COMP | DATA_INC | SEND |
CONF | CONF_SND | CONF_DEALLOC >] [,< DATA="user data"
[,DATA="more user data", ...] | FILE=file_specification |
CRC=file_specification >] [,PRC=expected_primary_return_code]
[,SRC=expected_secondary_return_code];
Where:
CONV is the conversation number, to allow COMET to keep track of the
conversations if more than one is active at a time. If not
specified, the default is CONV=1.
LENGTH is the MAX LENGTH parameter, indicating the maximum amount of data
to be received at this time. If not specified, the maximum length
of 4K (4096) will be used. The MAX LENGTH parameter is supplied
to APPC to limit the amount of data returned by APPC.
WHAT is the WHAT RECEIVED parameter. COMET will compare this value
with the value actually returned by APPC. DATA_COMP is data
complete. DATA_INC is data incomplete. SEND is the send
indication, changing the conversation to send state. CONF is the
confirm indication. CONF_SND is confirm send. CONF_DEALLOC is for
confirm deallocate.
DATA is user specified data. The data defined here will be compared to
the received data. An error will be flagged if they are not
equal. More than one line of data can be defined, if desired,
using multiple DATA= parameters. If using DATA=, the FILE=
parameter must not be used. The DATA parameter is valid only if
the WHAT RECEIVED parameter is DATA COMPLETE or DATA INCOMPLETE.
FILE is a pc file specification, telling COMET to store the received
data into the specified pc file. The FILE parameter is valid only
if the WHAT RECEIVED parameter is DATA COMPLETE or DATA
INCOMPLETE.
CRC tells COMET to compute a checksum of the specified file, and
compare the computed checksum with the received data. If the WHAT
RECEIVED parameter is specified, it should equal Data_Complete.
PRC is the primary return code expected from APPC. COMET will compare
the value specified here with the value actually returned by APPC,
and flag an error if they are not the same. If this parameter is
not specified, an error will be flagged if the return code is not
okay.
SRC is the secondary return code expected from APPC. COMET will
compare the value specified here with the value actually returned
by APPC, and flag an error if they are not the same. If this
parameter is not specified, an error will be flagged if the return
code is not okay.
EXAMPLES
Here is an example of data complete being received, with the received data
compared with expected data.
APPC MC_RCV_WAIT CONV=1, WHAT=DATA_COMP, DATA="This is the
data I expect.", DATA="I expect this data too.";
Here is an example asking COMET to store the received data into a file in the
current directory of the default drive.
APPC MC_RCV_WAIT WHAT=DATA_COMP, FILE=myfile.ext;
This example would instruct COMET to compute a checksum on the file named
myfile.dat, and compare the result with the data received.
appc mc_rcv_wait conv=1, what=data_comp, crc=myfile.dat;
This example expects to receive data incomplete, and verify the received data.
APPC MC_RCV_WAIT CONV=2, LENGTH=24, WHAT=DATA_INC,
DATA="This is the data I expec";
This example expects a send indication.
APPC MC_RCV_WAIT CONV=1, WHAT=SEND;
Sample Code
ΓòÉΓòÉΓòÉ 4.10.6. Mc_Send_Data ΓòÉΓòÉΓòÉ
SYNTAX and EXAMPLES
COMET will issue a MC_SEND_DATA command with the specified data.
APPC MC_SEND_DATA [CONV=conversation_number] < ,DATA="user data",
[,DATA="more user data", ...] | ,FILE=file_specification |
,CRC=file_specification > [,PRC=expected_primary_return_code]
[,SRC=expected_secondary_return_code];
Where:
CONV is the conversation number, to allow COMET to keep track of the
conversations if more than one is active at a time. If not
specified, the default is CONV=1.
DATA is user specified data. More than one line of data can be
defined, if desired, using multiple DATA= parameters. If using
DATA=, the FILE= parameter must not be used.
FILE is a pc file specification, telling COMET to transmit the entire
file.
CRC tells COMET to compute a checksum of the specified file, and
transmit the results of the checksum. The checksum is two bytes
long.
PRC is the primary return code expected from APPC. COMET will compare
the value specified here with the value actually returned by APPC,
and flag an error if they are not the same. If this parameter is
not specified, an error will be flagged if the return code is not
okay.
SRC is the secondary return code expected from APPC. COMET will
compare the value specified here with the value actually returned
by APPC, and flag an error if they are not the same. If this
parameter is not specified, an error will be flagged if the return
code is not okay.
EXAMPLES:
Here is an example of a single line of data to be transmitted.
APPC MC_SEND_DATA DATA="I'm sending this data";
Here is an example of more than one line of data being transmitted.
APPC MC_SEND_DATA CONV=1, DATA="This is the first line of data",
DATA="This is the 2nd line of data";
Here is an example of a file being sent.
APPC MC_SEND_DATA CONV=1, FILE=c:\directory\filename.ext;
This example tells COMET to compute a checksum of a file called myfile.dat,
and send the result to the remote program. The remote program should issue a
Receive And Wait with the CRC option if it is desired to compare the checksums
for two files to see if they are equal.
appc mc_send_data conv=1, crc=myfile.dat;
Sample Code
ΓòÉΓòÉΓòÉ 4.10.7. Receive_Allocate ΓòÉΓòÉΓòÉ
Issue a Receive Allocate verb. COMET will wait for the allocate to be received
before continuing with the next statement in the input file.
SYNTAX
APPC RECEIVE_ALLOC TP="transaction_program_name"
[,CONV=conversation_number] [,PRC=expected_primary_return_code]
[,SRC=expected_secondary_return_code] [,SYNC=<NONE | CONFIRM>]
[,TYPE=<BASIC | MAPPED>] [,LOCAL_LU="local_lu_alias"]
[,PARTNER_LU="partner_lu_alias"] [,MODE="mode_name"];
Where:
TP is the transaction program name.
CONV is the conversation number, to allow COMET to keep track of the
conversations if more than one is active at a time. If not
specified, the default is CONV=1.
PRC is the primary return code expected from APPC. COMET will compare
the value specified here with the value actually returned by APPC,
and flag an error if they are not the same. If this parameter is
not specified, an error will be flagged if the return code is not
okay.
SRC is the secondary return code expected from APPC. COMET will
compare the value specified here with the value actually returned
by APPC, and flag an error if they are not the same. If this
parameter is not specified, an error will be flagged if the return
code is not okay.
TYPE is the expected conversation type (basic or mapped). If not
specified, the returned type will be ignored.
LOCAL_LU is the expected local LU alias. If not specified, the returned
alias will not be verified.
PARTNER_LU is the expected partner LU alias. If not specified, the returned
alias will not be verified.
MODE is the expected mode name. If not specified, the returned mode
name sill be ignored.
Sample Code
ΓòÉΓòÉΓòÉ 4.10.8. TP_Ended ΓòÉΓòÉΓòÉ
Tell APPC that the transaction program is ending, and will not be using the
APPC facilities any longer. This allows APPC to free the resources being used
by the Transaction Program.
SYNTAX
APPC TP_ENDED [PRC=expected_primary_return_code]
[,SRC=expected_secondary_return_code];
Where:
PRC is the primary return code expected from APPC. COMET will compare
the value specified here with the value actually returned by APPC,
and flag an error if they are not the same. If this parameter is
not specified, an error will be flagged if the return code is not
okay.
SRC is the secondary return code expected from APPC. COMET will
compare the value specified here with the value actually returned
by APPC, and flag an error if they are not the same. If this
parameter is not specified, an error will be flagged if the return
code is not okay.
Sample Code
ΓòÉΓòÉΓòÉ 4.10.9. TP_Started ΓòÉΓòÉΓòÉ
Register a transaction program with APPC.
SYNTAX
APPC TP_STARTED LOCAL_LU="lu_alias", TP="transaction_program_name"
[,.PRC=expected_primary_return_code]
[,.SRC=expected_secondary_return_code];
Where:
LOCAL_LU is the LU alias for the locally known LU name.
TP is the transaction program name.
PRC is the primary return code expected from APPC. COMET will compare
the value specified here with the value actually returned by APPC,
and flag an error if they are not the same. If this parameter is
not specified, an error will be flagged if the return code is not
okay.
SRC is the secondary return code expected from APPC. COMET will
compare the value specified here with the value actually returned
by APPC, and flag an error if they are not the same. If this
parameter is not specified, an error will be flagged if the return
code is not okay.
Sample Code
ΓòÉΓòÉΓòÉ 4.10.10. Unsupported APPC commands ΓòÉΓòÉΓòÉ
The following mapped conversation verbs are not supported by this version of
COMET This means that the COMET input file can not include these commands in
the test case script. Some of these commands are used internally by COMET to
process the SEND and RECEIVE functions described previously. Please also note
that none of the Basic conversation APPC verbs are supported by COMET
Mc_Flush
Mc_Get_Attributes
Mc_Prepare_To_Receive
Mc_Receive_Immediate
Mc_Receive_And_Post
Mc_Request_To_Send
Mc_Send_Error
Mc_Test_RTS
ΓòÉΓòÉΓòÉ 4.11. SRPI (Server/Requester Programming Interface) commands ΓòÉΓòÉΓòÉ
There is only one command supported by COMET for the SRPI programming
interface, since the SRPI interface itself only has a single verb. That is the
Send_Request verb.
Refer to General Instruction Syntax for general information about the command
syntax.
Each SRPI instruction begins with the keyword: SRPI
ΓòÉΓòÉΓòÉ 4.11.1. Send_Request ΓòÉΓòÉΓòÉ
Issues a SEND_REQUEST verb to the SRPI interface.
SYNTAX
SRPI SENDREQ SERVER="server_name", FUNCTION=function_id
[,<PARM="request parameters",| PFILE=filename.ext>] [,<DATA="request
data"| DFILE=filename.ext>] [,RCSRPI=srpi_return_code]
[,RCSRVR=server_return_code] [,<RPARM="reply parameters"|
RPFILE=filename.ext>] [,<RDATA="reply data"| RDFILE=filename.ext>];
Where:
SERVER is the server name. This should be an 8 ASCII character string
enclosed in quotes. If the server name is less than 8 characters
long, then the string within the quotes should be padded with
spaces. See the Communication Manager SRPI Server profiles for the
valid server_names which are configured to be called from the PC
being used.
FUNCTION is the Function_ID. This is a number made up of 4 hex digits (from
0000 to FFFF). Valid function codes are determined by the SRPI
server (specified in the SERVER parameter). See the server's
documentation for valid function_id's.
PARM is a Request Parameter string. This is a character string
enclosed in quotes. The data specified will be copied into the
request parameter buffer which is sent to the SRPI interface. If
this parameter is used, the PFILE parameter may not be specified.
PFILE is a Request Parameter file. This is a PC filename
specification. The specified file should contain all of the
Request Parameters to be copied into the request parameter buffer.
If this parameter is used, the PARM parameter may not be
specified.
DATA is a Request Data string. This is a character string enclosed in
quotes. The data specified will be copied into the request data
buffer which is sent to the SRPI interface. If this parameter is
used, the DFILE parameter may not be specified.
DFILE is a Request Data file. This is a PC filename specification. The
specified file should contain all of the Request Data to be copied
into the request data buffer. If this parameter is used, the DATA
parameter may not be specified.
RCSRPI is the expected SRPI Return Code. This is a number made up of 8
hex digits representing a 4 byte SRPI return code. See the
Communication Manager SRPI documentation for valid values. COMET
will compare the value specified in this parameter with the return
code actually received from SRPI. If they don't match, an error
is logged. If this parameter is not specified, an error will be
flagged if the return code is not okay.
RCSRVR is the expected Server Return Code. This is a number made up of 8
hex digits representing a 4 byte server return code. Valid values
for this parameter are defined by the server specified in the
SERVER parameter. COMET will compare the value specified in this
parameter with the return code actually received from SRPI. If
they don't match, an error is logged. If this parameter is not
specified, an error will be flagged if the return code is not
zero.
RPARM is a Reply Parameter string. The data specified here will be
compared with the data returned from the Server at the completion
of the SRPI function call. An error will be flagged if they are
not equal. More than one RPARM line may be specified. If the
RPARM parameter is specified, the RPFILE parameter must not be
used.
RPFILE Reply Parameter file. This is a PC filename specification. If
this parameter is specified, the indicated file will be opened and
the reply parameters (returned from the server), if any, will be
stored into the file. No validation is done on the reply
parameters which are received. If validation is desired, the OS2
SHELL instruction may be used to compare this file with another
file containing the expected reply parameters. If this parameter
is specified, the RPARM parameter must not be used.
RDATA is a Reply Data string. The data specified here will be compared
with the data returned from the Server at the completion of the
SRPI function call. An error will be flagged if they are not
equal. More than one RDATA line may be specified. If the RDATA
parameter is specified, the RDFILE parameter must not be used.
RDFILE is a Reply Data file. This is a PC filename specification. If
this parameter is specified, the indicated file will be opened and
the reply data (returned from the server), if any, will be stored
into the file. No validation is done on the received reply data.
If validation is desired, the OS2 SHELL instruction may be used to
compare this file with another file containing the expected reply
data. If this parameter is specified, the RDATA parameter must not
be used.
Sample Code
ΓòÉΓòÉΓòÉ 4.12. IEEE 802.2 API ΓòÉΓòÉΓòÉ
The Communication Manager's 802.2 API provides access to the functions provided
by the different local area networks available on the PC. It can be used to
communicate on Token Ring, PC Network Baseband, or PC Network Broadband
networks. See the Local Area Network Technical Reference for more detailed
information about the 802.2 commands.
ΓòÉΓòÉΓòÉ 4.12.1. Dir_Close_Adapter ΓòÉΓòÉΓòÉ
Terminate the network communications on a LAN adapter, and close the adapter.
There are two types of Close which can be done: logical and physical. If the
system key is specified, (the KEY parameter, below), then a physical close of
the adapter is done, which results in the termination of all communication on
the specified adapter. If the system key is not used, then a logical close is
done.
SYNTAX
802.2 DIR_CLOSE_ADAPTER [ADAPTER=number] [,KEY=system_key]
[,RC=expected_return_code];
Where:
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to the value used in the last
Dir.Open.Adapter command processed by COMET.
KEY is the system key, which may be needed to successfully complete
the close adapter command. The system key is needed if it was
defined when creating the LAN definitions in the Communications
Manager's configuration file.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.12.2. Dir_Initialize ΓòÉΓòÉΓòÉ
Initilize the adapter support program, reset adapter tables and buffers, and
run start-up tests on the LAN adapter.
SYNTAX
802.2 DIR_INITIALIZE [ADAPTER=number,] KEY=system_key
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to the value used in the last
Dir.Open.Adapter command processed by COMET.
KEY is the system key, which is necessary to allow completion of this
command. The system key is set in the Communications Manager's
configuration file, when creating the LAN definitions.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
ΓòÉΓòÉΓòÉ 4.12.3. Dir_Open_Adapter ΓòÉΓòÉΓòÉ
Make a LAN adapter ready for communication.
SYNTAX
802.2 DIR_OPEN_ADAPTER [,ADAPTER=number]
[,NODE_ADDRESS=hex_number] [,GROUP_ADDRESS=hex_number]
[,FUNCTIONAL_ADDRESS=hex_number] [,MAX_SAP=number]
[,MAX_STATION=number] [,OPEN_OPTIONS=hex_number]
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
NODE_ADDRESS The desired adapter network address. This should be specified as
a 6 byte hex number of the form x'nnnnnnnnnnnn'. If not specified,
the default is adapter's encoded address.
GROUP_ADDRESS The desired adapter group network address. If not specified,
this defaults to 0.
FUNCTIONAL_ADDRESS The desired adapter functional network address. If not
specified, this defaults to 0.
MAX_SAP The maximum number of SAPs to be allowed. If not specified, this
defaults to 10. The maximum allowed by COMET is 10.
MAX_STATION The maximum number of link stations to be allowed. If not
specified, this defaults to 10. The maximum allowed by COMET is
100.
OPEN_OPTIONS is a two byte field which should be specified as a hex number
with the following format: x'nnnn'. See the LAN Technical
Reference manual for details on the content of this field. If not
specified, this defaults to x'0100'.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.12.4. Dir_Status ΓòÉΓòÉΓòÉ
Get the current status information for the LAN adapter.
All of the parameters except ADAPTER are used for verification of the
parameters returned by the 802.2 interface. COMET will compare the values
listed in the input file with those actually returned from the interface. If
the values are not the same, an error will be logged.
SYNTAX
802.2 DIR_STATUS [ADAPTER=number] [,NODE_ADDRESS=hex_number]
[,GROUP_ADDRESS=hex_number] [,FUNCTIONAL_ADDRESS=hex_number]
[,MAX_SAP=number] [,OPEN_SAP=number] [,MAX_STATION=number]
[,OPEN_STATION=number] [,AVAIL_STATION=number]
[,ADAPTER_TYPE=hex_number] [,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to the value used in the last
Dir.Open.Adapter command processed by COMET.
NODE_ADDRESS The adapter's network address (as set by the dir.open.adapter
command). If not specified, this defaults to the adapter encoded
address.
GROUP_ADDRESS The adapter's group network address (as set by the
dir.open.adapter command).
FUNCTIONAL_ADDRESS The adapter's functional network address (as set by the
dir.open.adapter command).
MAX_SAP The maximum number of SAPs allowed (as set by the dir.open.adapter
command).
OPEN_SAP The number of SAPs that are currently open (by dlc.open.sap
commands).
MAX_STATION The maximum number of link stations allowed (as set by the
dir.open.adapter command).
OPEN_STATION The number of link stations currently open (by dlc.open.station
commands).
AVAIL_STATION The number of link stations that have not been reserved by
dlc.open.sap commands.
ADAPTER_TYPE The network adapter type. The adapter types which currently may
be returned are as follows:
x'0001' Token Ring Network PC Adapter
x'0002' Token Ring Network PC Adapter II
x'0004' Token Ring Network 16/4 Mbps Adapter
x'0008' Token Ring Network Adapter/A
x'0010' Token Ring Network Adapter/A (short version)
x'0012' Token Ring Network 16/4 Mbps Adapter/A
x'4000' PC Network Adapter
x'8000' PC Network Adapter
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
ΓòÉΓòÉΓòÉ 4.12.5. Dlc_Close_SAP ΓòÉΓòÉΓòÉ
Close (deactivate) a Service Access Point. If successful, communication will
no longer be allowed through the specified SAP.
SYNTAX
802.2 DLC_CLOSE_SAP [ADAPTER=adapter_number,] SAP=sap_number
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to the value used in the last
Dir.Open.Adapter command processed by COMET.
SAP is the sap number. It can be specified in hex or decimal. Only
values from 0 to 255 (x'0' to x'ff') are allowed.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.12.6. Dlc_Close_Station ΓòÉΓòÉΓòÉ
Close (deactivate) a link station. If successful, communication will no longer
be allowed through the specified link station.
SYNTAX
802.2 DLC_CLOSE_STATION [ADAPTER=adapter_number,]
SAP=sap_number, STATION=link_station_number
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to the value used in the last
Dir.Open.Adapter command processed by COMET.
SAP is the sap number. It can be specified in hex or decimal. Only
values from 0 to 255 (x'0' to x'ff') are allowed.
STATION is the link station number. It can be specified in hex or
decimal. Only values of 0 to 255 (x'0' to x'ff') are allowed.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.12.7. Dlc_Connect_Station ΓòÉΓòÉΓòÉ
Start communication between a local and a remote link station. If successful,
the link stations enter a data transfer state.
SYNTAX
802.2 DLC_CONNECT_STATION [ADAPTER=adapter_number,]
SAP=sap_number, STATION=link_station_number
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to the value used in the last
Dir.Open.Adapter command processed by COMET.
SAP is the number of the SAP to be used. This is the same number as
was used when issuing the dlc.open.sap command.
STATION is the link station to be used. This is the same number as was
used when issuing the dlc_open_station command. This field should
be specified as a decimal number from 1 to 10, since there is a
maximum of 10 link stations per SAP.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.12.8. Dlc_Flow_Control ΓòÉΓòÉΓòÉ
Set or Reset a local busy condition.
SYNTAX
802.2 DLC_FLOW_CONTROL [ADAPTER=adapter_number,] SAP=sap_number
[,STATION=link_station_number] [,SET_USER_BUSY=YES|NO]
[,RESET=USER|BUFFER|NO] [,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to the value used in the last
Dir.Open.Adapter command processed by COMET.
SAP is the sap number, specified as a decimal number from 1 to 10. Ten
local saps will be allowed. This parameter is used as an index
into a table in which the actual SAP station id will be saved when
it is returned from the 802.2 interface.
STATION is the link station to be used. This is the same number as was
used when issuing the dlc_open_station command. This field should
be specified as a decimal number from 1 to 10, since there is a
maximum of 10 link stations per SAP.
SET_USER_BUSY tells the 802.2 interface whether or not to set a user local
busy condition. The valid options are YES and NO. Either
SET_USER_BUSY or RESET must be specified in order for the flow
control instruction to be called by COMET. SET_USER_BUSY and RESET
together are an invalid combination.
RESET tells the 802.2 interface whether or not to remove a local busy
condition and the type of local busy condition which will be
removed. The valid options are USER, BUFFER, and NO.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.12.9. Dlc_Open_Sap ΓòÉΓòÉΓòÉ
Allocate resources for a link station.
SYNTAX
802.2 DLC_OPEN_SAP [ADAPTER=adapter_number,] SAP=sap_number
[,TIMER_T1=response_timer_value] [,TIMER_T2=acknowledge_timer_value]
[,TIMER_TI=inactivity_timer_value] [,MAXIN=max_receive_count]
[,MAXOUT=max_transmit_count] [,MAX_RETRY=max_retry_count]
[,STATION_COUNT=link_station_count] [,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to the value used in the last
Dir.Open.Adapter command processed by COMET.
SAP is the sap number, specified as a decimal number from 1 to 10. Ten
local saps will be allowed. This parameter is used as an index
into a table in which the actual SAP station id will be saved when
it is returned from the 802.2 interface.
TIMER_T1 is the response timer value (in seconds). Any value from 0 to 255
may be entered, but only values from 0 to 10 are valid. If not
specified, COMET specifies a value of 0, which causes 802.2 to use
its default value.
TIMER_T2 is the acknowledgement timer value (in seconds), which specifies
how long to delay the transmission of an acknowledgement frame.
Any value from 0 to 255 may be entered, but only values from 0 to
10 are valid. If not specified, COMET specifies a value of 0,
which causes 802.2 to use its default value.
TIMER_TI is the inactivity timer value (in seconds), used to determine when
an inactive condition exists on the link. Any value from 0 to 255
may be entered, but only values from 0 to 10 are valid. If not
specified, COMET specifies a value of 0, which causes 802.2 to use
its default value.
MAXIN is the maximum number of information frames that may be received
by this SAP before an acknowledgement must be sent. This
basically corresponds to the number of receive buffers available
for the SAP. Any value from 0 to 255 may be entered, but only
values from 0 to 127 are valid. If not specified, COMET specifies
a value of 0, which causes 802.2 to use its default value.
MAXOUT is the maximum number of frames which may be transmitted before
requiring an acknowledgement from the remote station. Any value
from 0 to 255 may be entered, but only values from 0 to 127 are
valid. If not specified, COMET specifies a value of 0, which
causes 802.2 to use its default value.
MAX_RETRY is the maximum number of times a frame should be retried when it
is not acknowledged by the remote station. This is used in
conjunction with the response timer value (TIMER_T1). Any value
from 0 to 255 may be entered.
STATION_COUNT is the number of link stations to reserve for this SAP. The
maximum value supported by COMET is 100. If not specified, the
default used by COMET is 2.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.12.10. Dlc_Open_Station ΓòÉΓòÉΓòÉ
Allocate resources for a link station.
SYNTAX
802.2 DLC_OPEN_STATION [ADAPTER=adapter_number,]
SAP=sap_number, STATION=link_station_number,
RSAP=remote_sap_number, DEST_NODE_ADDR=destination_node_address
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to the value used in the last
Dir.Open.Adapter command processed by COMET.
SAP is the sap number, specified as a decimal number from 1 to 10. Ten
local saps will be allowed. This parameter is used as an index
into a table in which the actual SAP station id will be saved when
it is returned from the 802.2 interface.
STATION is the link station number, specified as a decimal number from 1
to 10. There are 10 link stations allowed per SAP, so a total of
100 link stations are available (since 10 SAPs are allowed).
RSAP is the remote sap number. This is the sap number used on the
remote PC when issuing the dlc.open.sap command.
DEST_NODE_ADDR is the destination node address. This is the address used by
the LAN adapter on the remote PC. It is set when the remote PC
issues a dir.open.adapter command. This is a 6 byte hex number,
and should be specified with the form: x'nnnnnnnnnnnn'.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.12.11. Dlc_Statistics ΓòÉΓòÉΓòÉ
Display 802.2 resource statistics for a SAP or a link station.
SYNTAX
802.2 DLC_STATISTICS [ADAPTER=adapter_number,] SAP=sap_number
[,STATION=link_station_number] [,COUNTER_RESET=YES|NO]
[,FILE=file_name] [,DISPLAY=YES|NO]
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to the value used in the last
Dir.Open.Adapter command processed by COMET.
SAP is the sap number, specified as a decimal number from 1 to 10. Ten
local saps will be allowed. This parameter is used as an index
into a table in which the actual SAP station id will be saved when
it is returned from the 802.2 interface.
STATION is the link station to be used. This is the same number as was
used when issuing the dlc_open_station command. This field should
be specified as a decimal number from 1 to 10, since there is a
maximum of 10 link stations per SAP.
COUNTER_RESET tells whether or not to reset certain statistics counter values.
The valid options are YES and NO. The default is NO.
FILE is the name of a file in which status information will be stored.
DISPLAY tells COMET to display status information to the screen. The valid
options are YES and NO. YES is the default if this parameter is
not specified.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
ΓòÉΓòÉΓòÉ 4.12.12. Read ΓòÉΓòÉΓòÉ
The READ command is used either to receive a connection from another PC (when
it issues a dlc_connect_station command) or to receive data from another PC
(when it issues a transmit_I_frame command). User and buffer local busy
conditions are implicitly disarmed by having COMET call the flow_control
instruction.
SYNTAX
802.2 READ [ADAPTER=adapter_number,] EVENT_SET=<CONNECT || RECEIVE>
[,SAP=sap_number] [,STATION=link_station_number] [,DATA="user
data string"] [,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to the value used in the last
Dir.Open.Adapter command processed by COMET.
EVENT_SET is the type of event which is expected. If expecting a remote PC
to attempt to open a connection to this PC, then the CONNECT
option should be used. If expecting data from a remote PC, then
the RECEIVE option should be used.
SAP is the number of the sap expecting the link connection. The sap
number is as set in the open sap command.
STATION is the link station number to be used for the expected connection.
DATA is the user defined data which is expected from the remote PC.
This parameter is valid only if the RECEIVE option is specified in
the EVENT_SET parameter (above).
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.12.13. Receive ΓòÉΓòÉΓòÉ
Initiate a receive for a sap or link station. To actually receive data or a
connection request from another PC, use the READ command after issuing the
RECEIVE.
SYNTAX
802.2 RECEIVE [ADAPTER=adapter_number,] SAP=sap_number
[,STATION=link_station_number] [,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to the value used in the last
Dir.Open.Adapter command processed by COMET.
SAP is the sap number, as set in the open sap command.
STATION is the link station number, as used in the open station and
connect station commands.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.12.14. Receive_Cancel ΓòÉΓòÉΓòÉ
Cancels an outstanding receive for a sap or link_station.
SYNTAX
802.2 RECEIVE_CANCEL [ADAPTER=adapter_number,] SAP=sap_number
[,STATION=link_station_number] [,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to the value used in the last
Dir.Open.Adapter command processed by COMET.
SAP is the sap number, as set in the open sap command.
STATION is the link station number, as used in the open station and
connect station commands.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.12.15. Transmit_I_Frame ΓòÉΓòÉΓòÉ
Transmit data to another PC on the LAN.
SYNTAX
802.2 TRANSMIT_I_FRAME [ADAPTER=adapter_number,] SAP=sap_number,
STATION=link_station_number [,FILE=file_name]
[,DATA="data string"] [,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to the value used in the last
Dir.Open.Adapter command processed by COMET.
SAP is the sap number, as set in the open sap command.
STATION is the link station number, as used in the open station and
connect station commands.
DATA is the data string which is to be transmitted.
FILE is the name of the file to be transmitted. This option is not
currently supported.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.12.16. Unsupported 802.2 commands ΓòÉΓòÉΓòÉ
The following 802.2 commands are not supported by COMET
Dir.cancel.timer.group
Dir.define.mif.environment
Dir.interrupt
Dir.modify.open.parms
Dir.read.log
Dir.restore.open.parms
Dir.set.functional.address
Dir.set.user.appendage
Dir.timer.cancel
Dir.timer.set
Dlc.flow.control
Dlc.modify
Dlc.reset
Dlc.statistics
Receive.modify
Transmit.dir.frame
Transmit.test.cmd
Transmit.ui.frame
Transmit.xid.cmd
ΓòÉΓòÉΓòÉ 4.13. NETBIOS API ΓòÉΓòÉΓòÉ
The Communication Manager's NETBIOS API also provides access to local area
networks. It can be used to communicate on Token Ring, PC Network Baseband, or
PC Network Broadband networks. See the Local Area Network Technical Reference
for more detailed information about the Netbios commands.
ΓòÉΓòÉΓòÉ 4.13.1. Add_group_name ΓòÉΓòÉΓòÉ
Add a group name to the local name table. Several different PC's on the LAN
can add the same group name. This allows a datagram to be sent to all of those
PC's using a single send_datagram command.
SYNTAX
NETBIOS ADD_GROUP_NAME [ADAPTER=adapter_number,]
NAME=caller's_name [,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
NAME is the name of the local station which is to be added.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.2. Add_name ΓòÉΓòÉΓòÉ
Add a name to the local name table. This name can be used as the local station
name when issuing a call or listen command. COMET will allow up to 50 names to
be added.
SYNTAX
NETBIOS ADD_NAME [ADAPTER=adapter_number,] NAME=caller's_name
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
NAME is the name of the local station which is to be added.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.3. Call ΓòÉΓòÉΓòÉ
Call a remote PC to establish a communication session.
SYNTAX
NETBIOS CALL [ADAPTER=adapter_number,] NAME=caller's_name,
CALL_NAME=remote_name, SESSION=COMET_session_number
[,RCV_TIMEOUT=receive_timeout] [,SND_TIMEOUT=send_timeout]
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
NAME is the name of the person making the call, as set up with the add
name command.
CALL_NAME is the name of the person being called at the remote station.
SESSION is a COMET session number used with any following commands being
issued for this same session. This may be a number between 1 and
30. COMET limits the number of Netbios calls to 30.
RCV_TIMEOUT is the receive timeout (in seconds) to be set for this session. If
this parameter is not specified, a default of 60 seconds will be
used.
SND_TIMEOUT is the send timeout (in seconds) to be set for this session. If
this parameter is not specified, a default of 60 seconds will be
used.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.4. Delete_name ΓòÉΓòÉΓòÉ
Delete a name which was previously added to the local name table.
SYNTAX
NETBIOS DELETE_NAME [ADAPTER=adapter_number,] NAME=caller's_name
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
NAME is the name of the local station which is to be deleted.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.5. Find_name ΓòÉΓòÉΓòÉ
Find a name on the network, if it exists.
SYNTAX
NETBIOS FIND_NAME [ADAPTER=adapter_number,] NAME=local_name
[,NUMBER_RESPONDING=number] [,NAME_STATUS=<UNIQUE|GROUP>]
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
NAME is the name of the station to search for.
NUMBER_RESPONDING is the number of stations expected to respond to the find.
COMET will compare this value to the number actually returned by
netbios. If the numbers are not the same, an error will be
logged.
NAME_STATUS tells what kind of name was found. The valid options for this
parameter are UNIQUE and GROUP.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.6. Hang_up ΓòÉΓòÉΓòÉ
Disconnect an existing call.
SYNTAX
NETBIOS HANG_UP [ADAPTER=adapter_number,]
SESSION=COMET_session_number [,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
SESSION is a COMET session number, as set in the call or listen command.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.7. Listen ΓòÉΓòÉΓòÉ
Listen for an incoming call.
SYNTAX
NETBIOS LISTEN [ADAPTER=adapter_number,] NAME=caller's_name,
CALL_NAME=remote_name, SESSION=COMET_session_number
[,RCV_TIMEOUT=receive_timeout] [,SND_TIMEOUT=send_timeout]
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
NAME is the name of the local station which is expecting to receive the
call.
CALL_NAME is the name of the remote station from which the call is expected.
If the call name is '*', then the listen will accept a call from
any remote station.
SESSION is a COMET session number used with any following commands being
issued for this same session. This may be a number between 1 and
30. COMET limits the number of Netbios calls to 30.
RCV_TIMEOUT is the receive timeout (in seconds) to be set for this session. If
this parameter is not specified, a default of 60 seconds will be
used.
SND_TIMEOUT is the send timeout (in seconds) to be set for this session. If
this parameter is not specified, a default of 60 seconds will be
used.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.8. Receive ΓòÉΓòÉΓòÉ
Receive data from the remote PC.
SYNTAX
NETBIOS RECV [ADAPTER=adapter_number,] SESSION=COMET_session_number
[,DATA="data string"] [,FILE=file_name]
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
SESSION is a COMET session number used with any following commands being
issued for this same session. This may be a number between 1 and
30. COMET limits the number of Netbios calls to 30.
DATA is a string of characters to be compared to the data which is
actually received. If the two strings are not the same, an error
will be logged. If this parameter is not specified, the FILE
parameter must be used.
FILE is the name of a file into which the received data should be
stored. If this parameter is not specified, the DATA parameter
must be used.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.9. Receive_any ΓòÉΓòÉΓòÉ
Receive data from any of the open sessions.
SYNTAX
NETBIOS RECV_ANY [ADAPTER=adapter_number] [,DATA="data string"]
[,FILE=file_name] [,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
DATA is a string of characters to send. If this parameter is not
specified, the FILE parameter must be used.
FILE is the name of a file to be sent. If this parameter is not
specified, the DATA parameter must be used.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.10. Receive_broadcast_datagram ΓòÉΓòÉΓòÉ
Receive a broadcast datagram which was transmitted by a remote station.
SYNTAX
NETBIOS RECV_BROADCAST_DATAGRAM [ADAPTER=adapter_number,]
NAME=caller's_name [,DATA="data string"]
[,FILE=file_name] [,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
NAME is the name of the local station which is expecting to receive a
datagram. An '*' can be specified to indicate that a datagram
will be accepted from any station.
DATA is a string of characters to be compared to the data which is
actually received. If the two strings are not the same, an error
will be logged. If this parameter is not specified, the FILE
parameter must be used.
FILE is the name of a file into which the received data should be
stored. If this parameter is not specified, the DATA parameter
must be used.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.11. Receive_datagram ΓòÉΓòÉΓòÉ
Receive a datagram from a remote station.
SYNTAX
NETBIOS RECV_DATAGRAM [ADAPTER=adapter_number,]
NAME=caller's_name [,DATA="data string"]
[,FILE=file_name] [,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
NAME is the name of the local station which is expecting to receive a
datagram. An '*' can be specified to indicate that a datagram
will be accepted from any station.
DATA is a string of characters to be compared to the data which is
actually received. If the two strings are not the same, an error
will be logged. If this parameter is not specified, the FILE
parameter must be used.
FILE is the name of a file into which the received data should be
stored. If this parameter is not specified, the DATA parameter
must be used.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.12. Reset ΓòÉΓòÉΓòÉ
Reset the sessions on a specified adapter.
SYNTAX
NETBIOS RESET [ADAPTER=adapter_number] [,SESSIONS=decimal_number]
[,COMMANDS=decimal_number] [,NAMES=decimal_number]
[,NAME1=decimal_number] [,FREE_ALL=<YES||NO>]
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
SESSIONS is the maximum number of sessions to be allowed on the adapter
after the reset. Values from 0 to 255 are allowed. If not
specified or if 0 is specified, this defaults to 16.
COMMANDS is the maximum number of outstanding commands to be allowed on the
adapter after the reset. Values from 0 to 255 are allowed. If not
specified or if 0 is specified, this defaults to 16.
NAMES is the maximum number of names to be allowed in the local name
table after the reset. Values from 0 to 255 are allowed. If not
specified or if 0 is specified, this defaults to 8.
NAME1 ???
FREE_ALL ??? tells Netbios whether to reset the resources for all processes
or just the current process. The valid options are YES or NO.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.13. Send ΓòÉΓòÉΓòÉ
Send data to the remote station. There is currently a limit to the size of a
file which can be sent using this command. That limit is 64K bytes.
SYNTAX
NETBIOS SEND [ADAPTER=adapter_number,] SESSION=COMET_session_number
[,DATA="data string"] [,FILE=file_name]
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
SESSION is a COMET session number used with any following commands being
issued for this same session. This may be a number between 1 and
30. COMET limits the number of Netbios calls to 30.
DATA is a string of characters to send. If this parameter is not
specified, the FILE parameter must be used.
FILE is the name of a file to be sent. There is currently a 64K limit
on the size of a file to be sent with the SEND command. If this
parameter is not specified, the DATA parameter must be used.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.14. Send_broadcast_datagram ΓòÉΓòÉΓòÉ
Send a broadcast datagram. A broadcast datagram will be received by any
station which has issued a receive broadcast datagram command.
SYNTAX
NETBIOS SEND_BROADCAST_DATAGRAM [ADAPTER=adapter_number,]
NAME=caller's_name [,DATA="data string"]
[,FILE=file_name] [,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
NAME is the name of the local station which is sending the datagram.
DATA is a string of characters to send. If this parameter is not
specified, the FILE parameter must be used.
FILE is the name of a file to be sent. There is currently a 64K limit
on the size of a file to be sent with the SEND command. If this
parameter is not specified, the DATA parameter must be used.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.15. Send_datagram ΓòÉΓòÉΓòÉ
Send a datagram.
SYNTAX
NETBIOS SEND_DATAGRAM [ADAPTER=adapter_number,]
NAME=caller's_name, CALL_NAME=remote_name
[,DATA="data string"] [,FILE=file_name]
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
NAME is the name of the local station which is sending the datagram.
CALL_NAME is the name of the remote station to which the datagram is to be
sent.
DATA is a string of characters to send. If this parameter is not
specified, the FILE parameter must be used.
FILE is the name of a file to be sent. There is currently a 64K limit
on the size of a file to be sent with the SEND command. If this
parameter is not specified, the DATA parameter must be used.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.16. Session_Status ΓòÉΓòÉΓòÉ
Get the status of a local session.
SYNTAX
NETBIOS SESSION_STATUS [ADAPTER=adapter_number,] NAME=local_name
[,FILE=file_name] [,DISPLAY]
[,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
NAME is the name of the local station for which status is desired.
FILE is the name of a file into which the status should be stored. If
this parameter is not specified, the status data will be displayed
on the screen.
DISPLAY tells COMET to display the status information on the screen. This
is required only if the FILE parameter is also used, to display
the data in addition to storing it into the specified file. If the
FILE parameter is not used, then the DISPLAY parameter is not
required, since displaying the data to the screen is the default.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.17. Status ΓòÉΓòÉΓòÉ
Get the current status of the Netbios communications.
SYNTAX
NETBIOS STATUS [ADAPTER=adapter_number,] CALL_NAME=caller's_name
[,FILE=file_name] [,DISPLAY] [,RC=expected_return_code];
Where
ADAPTER is the adapter number. The numbers 0 and 1 are valid adapter
numbers, although any number may be specified. The adapter number
is a configuration parameter of the LAN adapter used in the PC. If
not specified, this defaults to 0.
CALL_NAME is the name of the remote station.
FILE is the name of a file into which the status should be stored. The
status information will be appended to the end of the file. If
this parameter is not specified, the status data will be displayed
on the screen.
DISPLAY tells COMET to display the status information on the screen. This
is required only if the FILE parameter is also used, to display
the data in addition to storing it into the specified file. If the
FILE parameter is not used, then the DISPLAY parameter is not
required, since displaying the data to the screen is the default.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 4.13.18. Unsupported Netbios Commands ΓòÉΓòÉΓòÉ
The following Netbios API commands are not supported by COMET
Chain_send
Chain_send_no_ack
Send_no_ack
Trace
ΓòÉΓòÉΓòÉ 4.14. EHLLAPI API ΓòÉΓòÉΓòÉ
The Communication Manager's EHLLAPI API provides user program access to the
3270 Emulator functions. (EHLLAPI stands for Emulator High Level Language
Application Programming Interface.)
ΓòÉΓòÉΓòÉ 4.14.1. EHLLAPI command syntax ΓòÉΓòÉΓòÉ
SYNTAX
The syntax of an EHLLAPI command in the COMET input file is as follows:
EHLLAPI FUNCTION=function [,STRING="string"] [,LENGTH=length]
[,RC=rc];
Where
FUNCTION is the function code to be issued. This is an integer from 0 to
255.
STRING is the data string to pass to the API. The data string must be
enclosed in quotes. If not specified it will default to a NULL
string.
LENGTH is the data length, that is, the length of the STRING parameter.
This is an integer from 0 to 65,535. This is also used as a
numeric parameter to some EHLLAPI function calls. If a STRING
parameter is specified the LENGTH does not need to specified, as
COMET will determine the length of the STRING. If a LENGTH is
specified, COMET will use that LENGTH. If neither STRING nor
LENGTH is specified, LENGTH will default to 0.
RC is the expected return code. This is an integer from 0 to 65,535.
It will default to 0 if not specified.
Sample Code
ΓòÉΓòÉΓòÉ 5. CREATING LAN INPUT FILES ΓòÉΓòÉΓòÉ
This chapter contains the instructions on creating an input file for testing
the OS/2 LAN API functions. The OS/2 LAN API functios are listed by categories.
Information for API functions are described under each function category.
ΓòÉΓòÉΓòÉ 5.1. LAN API - Configuration ΓòÉΓòÉΓòÉ
The functions in the Configuration category retrieve network configuration
information from the IBMLAN.INI file.
ΓòÉΓòÉΓòÉ 5.1.1. NetConfigGet2 (Admin) ΓòÉΓòÉΓòÉ
Retrieve a specified parameter value for a given network component in the
IBMLAN.INI file of a remote server.
Syntax
LAN CONFIG_GET2 [SERVER=\\servername,] [COMPONENT=component,]
[PARAMETER=parameter,] [BUFLEN=buffer_size,]
[OUTFILE=file_name,] [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call
if this parameter is not specified. A NULL pointer is passed
to API call if this parameter has value of NULL. Local
computer is assumed if this parameter contains NULL string or
NULL pointer.
COMPONENT The name of service component to be searched, such as
requester, server, or messenger. A NULL string is passed to
API call if this parameter is not specified and an error
return code is expected.
PARAMETER The parameter whose value is to be returned. A NULL string is
passed to API call if this parameter is not specified and an
error return code is expected.
BUFLEN The size of buffer for the returned parameter's value. If this
parameter is not specified, the default size 256 is assumed.
OUTFILE The name of file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen when the debug is on. The returned
data includes:
the value of the parameter requested
number of bytes returned to buffer
RC is the expected return code. COMET will compare the actual
return code with this value. If they are not the same, an
error will be flagged. If this parameter is not specified, an
error will be flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.1.2. NetConfigGetAll2 (Admin) ΓòÉΓòÉΓòÉ
Retrieve all parameter information for a given network component in the
IBMLAN.INI file of a remote server.
Syntax
LAN CONFIG_GET_ALL2 [SERVER=\\servername,] [COMPONENT=component,]
[BUFLEN=buffer_size,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER The name of service component to be searched, such as
requester, server, or messenger. A NULL string is passed to
API call if this parameter is not specified. A NULL pointer is
passed to API call if this parameter has value of NULL. Local
computer is assumed if this parameter contains NULL string or
NULL pointer.
COMPONENT The name of string to be searched. A NULL string is passed to
API call if this parameter is not specified. and an error
return code is expected.
BUFLEN The size of buffer for the returned parameter's value. If this
parameter is not specified, the default size 256 is assumed.
OUTFILE The name of file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen when the debug is on. The returned
data includes:
all parameter values of the requested component
number of bytes returned to buffer
number of bytes of the available data
RC is the expected return code. COMET will compare the actual
return code with this value. If they are not the same, an
error will be flagged. If this parameter is not specified, an
error will be flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.2. LAN API - Connection ΓòÉΓòÉΓòÉ
The function list all connections made to a server by a requester client, or of
all connections made to a server's shared resource.
ΓòÉΓòÉΓòÉ 5.2.1. NetConnectionEnum (Admin, Server) ΓòÉΓòÉΓòÉ
List all connections made to a server by a requester, or of all connections
made to a server's shared resource.
Syntax
LAN CONNECTION_ENUM [SERVER=\\servername,] PARAMETER=qualifier,
[LEVEL=<0 | 1>,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call
if this parameter is not specified. A NULL pointer is passed
to API call if this parameter has value of NULL. Local
computer is assumed if this parameter contains NULL string or
NULL pointer.
PARAMETER The netname of the shared resource, or the client name of the
requester. This parameter must be specified.
LEVEL Specify the level of detail for the requested information.
Valid value for this parameter is either 0 or 1. Any other
value will cause an error return code. If this parameter is
not specified, the default value 0 is assumed.
BUFLEN The size of buffer that holds the returned data. If not
specified, the default size 256 is assumed.
OUTFILE The file where the returned data is stored. The returned
information will be appended to this file. If this parameter
is not specified, the returned information will be displayed
to the screen when the debug is on. The returned data include:
level 0 or level 1 information of each entry
number of entries returned
number of entries that are available
RC is the expected return code. COMET will compare the actual
return code with this value. If they are not the same, an
error will be flagged. If this parameter is not specified, an
error will be flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.3. LAN API - Mailslot ΓòÉΓòÉΓòÉ
The functions in Mailslot category provide one-way interprocess communication
(IPC).
ΓòÉΓòÉΓòÉ 5.3.1. DosDeleteMailslot (Local) ΓòÉΓòÉΓòÉ
Delete a mailslot and discard all messages.
Syntax
LAN DELETE_MAILSLOT [HANDLE=handle,] [NAME=\mailslot\name,]
[RC=expected_return_code];
Where:
HANDLE is the handle returned from DosMakeMailslot. If this parameter is
not specified, COMET will search the mailslot name specified in
the NAME parameter for the associated handle, and pass the handle
to API call. is
NAME is the name of mailslot to be deleted. The handle that was
associated with the mailslot is passed to API call. If this
mailslot name is not valid, an arbitrary handle (0xFFFF) is passed
to API call and an error return code is expected.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.3.2. DosMailslotInfo (Local) ΓòÉΓòÉΓòÉ
Retrieve information about a particular mailslot.
Syntax
LAN MAILSLOT_INFO [HANDLE=handle,] [NAME=\mailslot\name,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
HANDLE is the handle returned from DosMakeMailslot. If this parameter is
not specified, COMET will search the mailslot name specified in
the NAME parameter for the associated handle, and pass the handle
to API call.
NAME is the name of mailslot to get information from. If this mailslot
name is not valid, an arbitrary handle (0xFFFF) is passed to API
call and an error return code is expected.
OUTFILE is the file name that the returned information on this mailslot is
kept. The returned information will be appended to this file. If
this parameter is not specified, the returned information will be
displayed to the screen when the debug is on. The information
includes:
maximum size of message the mailslot can accept
size of the mailslot
size of the next message in the mailslot
priority of the next message in the mailslot
number of messages the mailslot contains
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.3.3. DosMakeMailslot (Local) ΓòÉΓòÉΓòÉ
Create a mailslot and return its handle.
Syntax
LAN MAKE_MAILSLOT NAME=\mailslot\name, MSGSIZE=size,
SLOTSIZE=size, [RC=expected_return_code];
Where:
NAME is an ASCII string assigning a name to the mailslot. The format is
\mailslot\name for local computer.
MSGSIZE is the maximum message size in bytes the mailslot can accept.
Generally, mailslot cannot accept messages larger then 65,475
bytes.
SLOTSIZE is the size in bytes of the mailslot. This value must equal or
exceed MSGSIZE.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.3.4. DosPeekMailslot (Local) ΓòÉΓòÉΓòÉ
Read the most current message in a mailslot without removing it.
Syntax
LAN PEEK_MAILSLOT [HANDLE=handle,] [NAME=\mailslot\name,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
HANDLE is the handle returned from DosMakeMailslot. If this parameter is
not specified, COMET will search the mailslot name specified in
the NAME parameter for the associated handle, and pass the handle
to API call.
NAME is the name of mailslot to peek. If this mailslot name is not
valid, an arbitrary handle (0xFFFF) is passed to API call and an
error return code is expected.
OUTFILE is the file name that the returned information on this mailslot is
kept. The returned information will be appended to this file. If
this parameter is not specified, the returned information will be
displayed to the screen when the debug is on. The information
includes:
size of buffer allocated for the returned buffer. This size is specified
in the MSGSIZE of DosMakeMailslot.
number of bytes returned
size of next message in the mailslot
priority of next message in the mailslot
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.3.5. DosReadMailslot (Local) ΓòÉΓòÉΓòÉ
Read and remove the most current message from a mailslot.
Syntax
LAN READ_MAILSLOT [HANDLE=handle,] [NAME=\mailslot\name,]
[TIMEOUT=milliseconds,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
HANDLE is the handle returned from DosMakeMailslot. If this parameter is
not specified, COMET will search the mailslot name specified in
the NAME parameter for the associated handle, and pass the handle
to API call.
NAME is the name of mailslot to read message from. If this mailslot
name is not valid, an arbitrary handle (0xFFFF) is passed to API
call and error return code is expected.
TIMEOUT is the the number of milliseconds to wait if a message is not
available immediately. A value of 0 specifies the API does not
wait; -1 specifies the API waits indefinitely. If timeout value is
not specified, the default is 0.
OUTFILE is the file name that the returned information on this milslot is
kept. The returned information will be appended to this file. If
this parameter is not specified, the returned information will be
displayed to the screen when the debug is on. The information
includes:
the message returned
number of bytes read
size of next message in the mailslot
priority of next message in the mailslot
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.3.6. DosWriteMailslot (Local) ΓòÉΓòÉΓòÉ
Write a message to a particular mailslot.
Syntax
LAN WRITE_MAILSLOT NAME=\mailslot\name, MESSAGE=text,
[PRIORITY=priority,] [CLASS= < 0 | 1 > ,]
[TIMEOUT=milliseconds,] [RC=expected_return_code];
Where:
NAME is the name of mailslot to write to. Use \mailslot\name for local
computer. Use \\computername\mailslot\name for a remote mailslot.
Use \\*\mailslot\name for all mailslots with the same name, but on
different computers.
MESSAGE is the ASCII string containing the message to be written to the
mailslot.
PRIORITY is the priority assigned to the message. The value is between 0 to
9. If priority is not specified, the default is 9.
CLASS is the class of mail service to be provided. The class is either 1
or 2. If class is not specified, the default is 2.
TIMEOUT is the the number of milliseconds to attempt writing a message to
a mailslot. A value of 0 specifies the API will attempt to write
the message only once; -1 specifies the API will attempt to write
for an indefinite time. If timeout value is not specified, the
default is 0.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.4. LAN API - Message ΓòÉΓòÉΓòÉ
The functions in the Message category are used to send, receive, read, log, and
forward messages. Ordinary uses can issue these functions locally. The
administrator can execute these functions remotely.
ΓòÉΓòÉΓòÉ 5.4.1. NetMessageBufferSend (Admin) ΓòÉΓòÉΓòÉ
Send a buffer of information to a registered messaging-name.
SYNTAX
LAN MESSAGE_BUFFER_SEND [SERVER=\\servername,] NAME=username,
MESSAGE=text, [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
NAME Name of the registered user or application to receive the message.
An asterisk (*) indicates broadcasting.
MESSAGE The message to be sent.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.4.2. NetMessageFileSend (Admin) ΓòÉΓòÉΓòÉ
Send a file to a registered messaging-name.
SYNTAX
LAN MESSAGE_FILE_SEND [SERVER=\\servername,] NAME=username,
FILE=file_name, [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
NAME Name of the registered user or application to receive the message.
An asterisk (*) indicates broadcasting.
FILE Pathname of the file to be sent.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.4.3. NetMessageLogFileGet(Admin) ΓòÉΓòÉΓòÉ
Retrieve the name of the message log file and the current logging status (on or
off).
SYNTAX
LAN MESSAGE_LOG_FILE_GET [SERVER=\\servername,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
BUFLEN The size of buffer for the returned parameter's value. If this
parameter is not specified, the default size 256 is assumed.
OUTFILE Specify the file name where the returned information will be
stored. The returned information will be appended to this file. If
this parameter is not specified, the returned information will be
displayed to the screen when the debug is on. Information returned
include:
name of the log file
message logging flag ( 1 for enabled, 0 for disabled)
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.4.4. NetMessageLogFileSet (Admin) ΓòÉΓòÉΓòÉ
Specify a file to log messages received by registered users and enable or
disable logging.
SYNTAX
LAN MESSAGE_LOG_FILE_SET [SERVER=\\servername,] [DEVICE=filespec,]
LOGGING=< 0 | 1 >, [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
DEVICE The filename of a file or device (LPTn or COMn) to which the
messages are logged. A NULL string is passed to API call if this
parameter is not specified. A NULL pointer is passed to API call
if this parameter has value of NULL. A NULL pointer indicates the
name of the current message log file does not change. If this
parameter is not specified, the LOGGING parameter must be 0, and
no message file is used for message logging. If the file extension
is not specified, the .LOG file extension is appended.
LOGGING A flag to indicate whether or not logging is enabled. A value of 0
indicates disabled, 1 indicates enabled. Any other value may cause
an error return code.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.4.5. NetMessageNameAdd (Admin) ΓòÉΓòÉΓòÉ
Register a user's name in the message-name table.
SYNTAX
LAN MESSAGE_NAME_ADD [SERVER=\\servername,] NAME=username,
[FWDACTION=< 0 | non-zero >,] [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call
if this parameter is not specified. A NULL pointer is passed
to API call if this parameter has value of NULL. Local
computer is assumed if this parameter contains NULL string or
NULL pointer.
NAME A user name to add to the message-name table.
FWDACTION Specify the action to take if the name. is already forwarded.
If this parameter is 0, the name is added to the message-name
table. A non-zero value causes an error to be returned if the
name has already been forwarded. If this parameter is not
specified, a non-zero value is assumed.
RC is the expected return code. COMET will compare the actual
return code with this value. If they are not the same, an
error will be flagged. If this parameter is not specified, an
error will be flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.4.6. NetMessageNameDel (Admin) ΓòÉΓòÉΓòÉ
Delete a user's name from the message-name table.
SYNTAX
LAN MESSAGE_NAME_DEL [SERVER=\\servername,] NAME=username,
[FWDACTION=< 1 | other value >,] [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call
if this parameter is not specified. A NULL pointer is passed
to API call if this parameter has value of NULL. Local
computer is assumed if this parameter contains NULL string or
NULL pointer.
NAME A user name to be removed from the message-name table.
FWDACTION Specify the action to take if the message for name are being
forwarded to another username. If the value is 1, the
forwarded name is deleted. Any other value prevents the name
from being deleted. If this parameter is not specified, 0 is
assumed.
RC is the expected return code. COMET will compare the actual
return code with this value. If they are not the same, an
error will be flagged. If this parameter is not specified, an
error will be flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.4.7. NetMessageNameEnum (Admin) ΓòÉΓòÉΓòÉ
List the username entries in a message-name table.
SYNTAX
LAN MESSAGE_NAME_ENUM [SERVER=\\servername,] [LEVEL=< 0 | 1 > ,]
[BUFLEN=buffer_size,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
LEVEL Specify the level of detail to be returned. Valid value for this
parameter is either 0 or 1. Any other value will cause an error
return code. If this parameter is omitted, the default value 0 is
assumed.
BUFLEN The size of buffer that holds the returned data. If not specified,
the default size 256 is assumed.
OUTFILE Specify the file name where the returned information will be
stored. The returned information will be appended to this file. If
this parameter is not specified, the returned information will be
displayed to the screen when the debug is on. Information returned
include:
information of level 0 or 1 of each entry
number of entries read
number of entries available
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.4.8. NetMessageNameFwd (Admin) ΓòÉΓòÉΓòÉ
Modify the message-name table to forward a user's message to another user.
SYNTAX
LAN MESSAGE_NAME_FWD [SERVER=\\servername,] [NAME=username,]
[FWDNAME=name,] [ACTION=< 1 | other value>,]
[RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
NAME The username receiving messages. If this parameter is not
specified, a NULL string is passed to API and an error return code
is expected.
FWDNAME The username to receive name's forwarded message. If this
parameter is not specified, a NULL string is passed to API and an
error return code is expected.
ACTION Specify the action to take if name forwards messages to another
username. If 1, any previous forwarded username is deleted; any
other value will return an error. If this parameter is not
specified, default value 0 is assumed.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.4.9. NetMessageNameGetInfo (Admin) ΓòÉΓòÉΓòÉ
Retrieve information about a user's entry in the message-name table.
SYNTAX
LAN MESSAGE_NAME_GET_INFO [SERVER=\\servername,] [NAME=name,]
[LEVEL=< 0 | 1 >,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
NAME The name of the user of interest. If this parameter is not
specified, a NULL string is passed to API and an error return code
is expected.
LEVEL Specify the level of detail to be returned. Valid value for this
parameter is either 0 or 1. Any other value will cause an error
return code. If this parameter is not specified, 0 is assumed for
this parameter.
BUFLEN The size of buffer that holds the returned data. If not specified,
the default size 256 is assumed.
OUTFILE Specify the file name where the returned information will be
stored. The returned information will be appended to this file. If
this parameter is not specified, the returned information will be
displayed to the screen when the debug is on. Information returned
include:
information in the data structure of level 0 or 1
number of bytes of information were available
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.4.10. NetMessageNameUnFwd (Admin) ΓòÉΓòÉΓòÉ
Stop forwarding a user's message to another user.
SYNTAX
LAN MESSAGE_NAME_UN_FWD [SERVER=\\servername,] [NAME=name,]
[RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
NAME The username whose message forwarding is to be cancelled. If this
parameter is not specified, a NULL string is passed to API and an
error return code is expected.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.5. LAN API - Server ΓòÉΓòÉΓòÉ
The functions in the Server category allow an application to perform remote
administrative tasks on a local or remote server.
ΓòÉΓòÉΓòÉ 5.5.1. NetServerAdminCommand (Admin, Server) ΓòÉΓòÉΓòÉ
Execute a command on a server.
Syntax
LAN SERVER_ADMIN_COMMAND [SERVER=\\servername,] COMMAND=command,
[BUFLEN=buffer_size,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
COMMAND The command to execute.
BUFLEN The size of buffer allocated for the returned information. If this
parameter is not specified, the default size 256 is assumed.
OUTFILE The file where the returned data is stored. The returned
information will be appended to this file. If this parameter is
not specified, the returned information will be displayed to the
screen when the debug is on. The information include:
returned exit code of the executed command.
returned command's output.
number of bytes of information returned.
number of bytes of information available.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.5.2. NetServerDiskEnum (Admin) ΓòÉΓòÉΓòÉ
Retrieve a list of disk drives on a server.
Syntax
LAN SERVER_DISK_ENUM [SERVER=\\servername,] [LEVEL=0,]
[BUFLEN=buffer_size,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
LEVEL This parameter must be 0. Other value will cause an error return
code. If this parameter is not specified, 0 is assumed.
BUFLEN The size of buffer allocated for the returned information. If this
parameter is not specified, the default size 256 is assumed.
OUTFILE The file where the returned data is stored. The returned
information will be appended to this file. If this parameter is
not specified, the returned information will be displayed to the
screen when the debug is on. The information include:
list of disk drive names returned
number of entries returned
number of entries that are available
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.5.3. NetServerEnum2 ΓòÉΓòÉΓòÉ
Enumate the set of all machine names visible on the network.
Syntax
LAN SERVER_ENUM2 [SERVER=\\servername,] [TYPE=service_type,]
[LEVEL=< 0 | 1 >,] [BUFLEN=buffer_size,] [DOMAIN=domain_name,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
TYPE Bit mask type to find. See the API FPFS for detailed description.
This parameter can be entered as hex value, e.g. 0x80, or integer.
The default is 2.
LEVEL Specify the level of details for the returned information. Valid
value for this parameter is either 0 or 1. Any other value will
cause an error return code. If this parameter is not specified, 0
is assumed.
BUFLEN The size of buffer allocated for the returned information. If this
parameter is not specified, the default size 256 is assumed.
Name of the domain to logon to. A null pointer is passed to API if
this parameter is not specified.
DOMAIN Name of the domain to search for the server type. A null pointer
is passed to API if this parameter is not specified, and the
default domain of this requester is assumed.
OUTFILE The file where the returned data is stored. The returned
information will be appended to this file. If this parameter is
not specified, the returned information will be displayed to the
screen when the debug is on. The information include:
information of level 0 or 1 of each entry
number of entries returned
number of entries that are available
list of servers in the domain
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.5.4. NetServerGetInfo (Partially admin, Server) ΓòÉΓòÉΓòÉ
Retrieve information about a particular server.
Syntax
LAN SERVER_GET_INFO [SERVER=\\servername,] [LEVEL=<0 | 1 | 2 | 3>,]
[BUFLEN=buffer_size,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
LEVEL Specify the level of detail for the returned information. The
value is either 0, 1, 2, or 3. Any other value will cause an error
return code. If this parameter is omitted, the default value 0 is
assumed.
BUFLEN The size of buffer allocated for the returned information. If this
parameter is not specified, the default size 256 is assumed.
OUTFILE The file where the returned data is stored. The returned
information will be appended to this file. If this parameter is
not specified, the returned information will be displayed to the
screen when the debug is on. The information include:
information of level 0, 1, 2, or 3
number of bytes of information returned
number of bytes of information available
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.5.5. NetServerSetInfo (Admin, Server) ΓòÉΓòÉΓòÉ
Set a server's operation parameters.
Syntax
LAN SERVER_SET_INFO [SERVER=\\servername,] [LEVEL=<1 | 2 | 3>,]
[BUFLEN=buffer_size,] PARMNUM=parameter_position,
[PARMVAL=parameter_value,] [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
LEVEL Specify the level of detail for the returned information. Valid
value for this parameter is either 1, 2 or 3. Any other value will
cause an error return code. If this parameter is not specified,
the default value is 1.
BUFLEN The size of buffer allocated for the returned information. If this
parameter is not specified, the default size 256 is assumed.
PARMNUM Specifies the ordinal position value for the data structure
component. The value can be one of the following: 0, 5, 10, 11,
17, 18, 37, 38, 39, 40, 41, 42, 43. Any other value may cause an
error return code. When this parameter is 0, the current data
structure of server_info of the server is passed to API call, and
the value of PARMVAL is ignored.
PARMVAL The value of the parameter specified by PARMNUM. This parameter
can be omitted only when PARMNUM is 0.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.6. LAN API - Services ΓòÉΓòÉΓòÉ
The functions in the Service category start and control network service
programs. All functions can be called on a local machine with ordinary user's
privilege. Administrator's privilege is required for remote execution.
ΓòÉΓòÉΓòÉ 5.6.1. NetServiceControl (Admin) ΓòÉΓòÉΓòÉ
Control the operation of network services.
Syntax
LAN SERVICE_CONTROL [SERVER=\\servername,] SERVICE=service_name,
OPCODE=code, ARG=arg, [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
SERVICE Name of the network service being controlled.
OPCODE The action to perform on the service.
0 - interrogate service status
1 - pause service
2 - continue service
3 - uninstall service
ARG Specify which service-specific operation to perform. The values
are:
1 - disk resource
2 - print resource
4 - serial device
BUFLEN Size of buffer to allocate for the returned information. If this
parameter is not specified, the default size 256 is assumed.
OUTFILE The file where the returned data is stored. The returned
information will be appended to this file. If this parameter is
not specified, the returned information will be displayed to the
screen when the debug is on. The returned information include:
status of the service
error code
service's program ID (PID)
error message if any when the service is stopped
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
REMARKS:
If the operation requested by the control opcode takes a long time
to complete, the status and code values returned by the API may be
intermediate. For long-running operations, an application should
issue successive calls to NetServiceControl to verify that the
operation has completed.
Sample Code
ΓòÉΓòÉΓòÉ 5.6.2. NetServiceEnum ΓòÉΓòÉΓòÉ
Retrieve information about all network services that are started.
Syntax
LAN SERVICE_ENUM [SERVER=\\servername,] [LEVEL=< 0 | 1 | 2 >,]
[BUFLEN=buffer_size,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
LEVEL The level of detail requested. The value can be 0, 1, or 2. Any
other value will cause an error return code. If this parameter is
omitted, the default value 2 is assumed.
BUFLEN Size of buffer to allocate for the returned information. If this
parameter is not specified, the default size 256 is assumed.
OUTFILE The file where the returned data is stored. The returned
information will be appended to this file. If this parameter is
not specified, the returned information will be displayed to the
screen when the debug is on. The information include:
returned data of level 0, 1 or 2 of each entry
number of entries returned
number of entries available
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.6.3. NetServiceGetInfo (Admin) ΓòÉΓòÉΓòÉ
Retrieve information about a particular installed network service.
Syntax
LAN SERVICE_GET_INFO [SERVER=\\servername,] [SERVICE=servicename,]
[LEVEL=< 0 | 1 | 2 >,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
SERVICE Name of the network service being requested. If this parameter is
not specified, a NULL string is passed to the API and an error
return code is expected.
LEVEL The level of detail requested. The value can be 0, 1, or 2. Any
other value will cause an error return code. If this parameter is
omitted, the default value 2 is assumed.
BUFLEN Size of buffer to allocate for the returned information. If this
parameter is not specified, the default size 256 is assumed.
OUTFILE The file where the returned data is stored. The returned
information will be appended to this file. If this parameter is
not specified, the returned information will be displayed to the
screen when the debug is on. The information include:
returned data of level 0, 1 or 2
number of bytes of available information
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.6.4. NetServiceInstall (Admin) ΓòÉΓòÉΓòÉ
Start a network service.
Syntax
LAN SERVICE_INSTALL [SERVER=\\servername,] [SERVICE=servicename,]
[CMDARGS=parameter_lists,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
SERVICE Name of the network service being requested. If this parameter is
not specified, a NULL string is passed to the API and an error
return code is expected.
CMDARGS Specify the command arguments of the specified service. This
parameter can contain one or several arguments. When more than one
arguments are specified, one space must exists between the
arguments. e.g.
CMDARGS="COMPUTER:NEW CHARWAIT:30", or
CMDARGS=COMPUTERNAME=NEW, A NULL pointer is passed to API call if
this parameter is not specified, or has value of NULL.
BUFLEN Size of buffer to allocate for the returned information. If this
parameter is not specified, the default size 256 is assumed.
OUTFILE The file where the returned data is stored. The returned
information will be appended to this file. If this parameter is
not specified, the returned information will be displayed to the
screen when the debug is on. The information include:
status of the service
error code
service's program identification number (PID)
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.6.5. NetServiceStatus ΓòÉΓòÉΓòÉ
Set status and code information for a network service.
(Note: Only the service application programs can call this API to update their
status and code table. In COMET, this API will return with error code 2184.)
Syntax
LAN SERVICE_STATUS [SERVICE=service,] [STATUS=status,]
[CODE1=error_code,] [CODE2=error_code,]
[RC=expected_return_code];
Where:
SERVICE Specify the name of service application. The default is NULL
string.
STATUS The bit mask of status of the service. This parameter is entered
as hex format. The default value is 0.
CODE1 Specify the high word error code when a service uninstalls or
fails to install properly. This parameter is entered as integer
format. The default value is 0.
CODE2 Specify the low word error code when a service uninstalls or fails
to install properly. This parameter is entered as integer format.
The default value is 0. CODE1 and CODE2 are combined to an
unsigned long interger and passed to API.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.7. LAN API - Sessions ΓòÉΓòÉΓòÉ
The functions in the Sessions category control network sessions established
between requesters and servers.
ΓòÉΓòÉΓòÉ 5.7.1. NetSessionDel (Admin, Server) ΓòÉΓòÉΓòÉ
End a session between a requester and a server.
Syntax
LAN SESSION_DEL [SERVER=\\servername,] CNAME=computer_name,
[RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
CNAME Name of the computer that established the session being
discontinued.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.7.2. NetSessionEnum (Partially Admin, Server) ΓòÉΓòÉΓòÉ
Provide information on all current sessions to a server. Non-admin users can
get session information at level 0 or level 10.
Syntax
LAN SESSION_ENUM [SERVER=\\servername,] [LEVEL=< 0 | 1 | 2 | 10 >,]
[BUFLEN=buffer_size,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
LEVEL Specify the level of detail for the requested information. Valid
value for this parameter is either 0, 1, 2, or 10. Any other value
will cause an error return code. If this parameter is no
specified, the default value 0 is assumed.
BUFLEN Size of buffer to allocate for the returned information. If this
parameter is not specified, the default size 256 is assumed.
OUTFILE The file where the returned data is stored. The returned
information will be appended to this file. If this parameter is
not specified, the returned information will be displayed to the
screen when the debug is on. The returned data include:
level 0 , level 1 or level 10 information of each entry
number of entries returned
number of entries that are available
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.7.3. NetSessionGetInfo(Partially Admin, Server) ΓòÉΓòÉΓòÉ
Retrieve information about a session established between a requester and
server. Non-admin users can get session information at level 0 or level 10.
Syntax
LAN SESSION_GET_INFO [SERVER=\\servername,] CNAME=compueter_name,
[LEVEL=< 0 | 1 | 2 | 10 >,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
CNAME Name of the computer whose session is to be monitored.
LEVEL Specify the level of detail for the requested information. Valid
value for this parameter is either 0, 1, 2, or 10. Any other value
will cause an error return code. If this parameter is no
specified, the default value 0 is assumed.
BUFLEN Size of buffer to allocate for the returned information. If this
parameter is not specified, the default size 256 is assumed.
OUTFILE The file where the returned data is stored. The returned
information will be appended to this file. If this parameter is
not specified, the returned information will be displayed to the
screen when the debug is on. The returned data include:
level 0, level 1 or level 10 information
number of bytes of the available information
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.8. LAN API - Requester ΓòÉΓòÉΓòÉ
The functions in the Requester category control the operation of requesters.
ΓòÉΓòÉΓòÉ 5.8.1. NetWkstaGetInfo (Partially Admin) ΓòÉΓòÉΓòÉ
Retrieve information about a requester's configuration components.
Syntax
LAN WKSTA_GET_INFO [SERVER=\\servername,] [LEVEL=<0 | 1 | 10>,]
[BUFLEN=buffer_size,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
LEVEL Specify the level of detail for the returned information. The
value is either 0, 1, or 10. Any other value will cause an error
return code. If this parameter is not specified, the default value
is 0.
BUFLEN Size of buffer to allocate for the returned information. If this
parameter is not specified, the default size 256 is assumed.
OUTFILE The file where the returned data is stored. The returned
information will be appended to this file. If this parameter is
not specified, the returned information will be displayed to the
screen when the debug is on. The information include:
information in level 0, 1, or 10.
number of bytes of information available.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.8.2. NetWkstaSetInfo (Admin) ΓòÉΓòÉΓòÉ
Configure a requester.
Syntax
LAN WKSTA_SET_INFO [SERVER=\\servername,] [LEVEL=<0 | 1 | 10>,]
[BUFLEN=buffer_size,] PARMNUM=parameter_number,
[PARMVAL=parameter_value,] [RC=expected_return_code];
Where:
SERVER Name of the remote server. A NULL string is passed to API call if
this parameter is not specified. A NULL pointer is passed to API
call if this parameter has value of NULL. Local computer is
assumed if this parameter contains NULL string or NULL pointer.
LEVEL Specify the level of detail for the returned information. Valid
value for this parameter is either 0, 1, or 10. Any other value
will cause an error return code. If this parameter is not
specified, the default value is 0.
BUFLEN The size in bytes of buffer allocated for the returned
information. If not specified, the default size 256 is assumed.
PARMNUM Specifies the ordinal position value for the wksta_info data
structure. Valid value for this parameter are: 0, 10, 11, 12, 27,
28, and 32. Any other value may cause an error return code. When
this parameter is 0, the current data structure of wksta_info of
the requester is passed to API call, and the value of PARMVAL is
ignored.
PARMVAL The value of the parameter specified by PARMNUM. This parameter
can be omitted only when PARMNUM is 0.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.8.3. NetWkstaSetUID2 (Admin) ΓòÉΓòÉΓòÉ
Logon or logoff to the network, or change a username's password.
Syntax
LAN WKSTA_SET_UID2 [DOMAIN=domain_name,] [USER=username,]
[PASSWORD=password,] [ACTION=<0 | 1 | 2 | 3>,] [LEVEL=1,]
[BUFLEN=buffer_size,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
DOMAIN Name of the domain to logon to. A null pointer is passed to
API if this parameter is not specified, and the default domain
of this requester is assumed.
USER A username to be logged onto the requester. When this
parameter is not specified, a NULL pointer is passed to API
call, and the current username is logged off the requester.
PASSWORD The password for user logon. A NULL string is passed to API
when this parameter is not specified. A NULL pointer is passed
to API if this parameter has value of NULL. A NULL string or
NULL pointer in this parameter indicates no password is
needed.
ACTION Specify which action to take if another username is logged on
the requester.
0 - Do not change UID and the function call fails.
1 - Logoff current user, disconnect any connections to redirected
resources, and logon the new username.
2 - Cancel any connections and other pending activities. The function call
fails if any connection is used by a process as the current drive.
3 - Always succeed by forcing all disconnections.
LEVEL This parameter must be 1. If this parameter is not specified,
the default value 1 is assumed. Any other value may cause an
error return code.
BUFLEN Size of buffer to allocate for the returned information. If
this parameter is not specified, the default size 256 is
assumed.
OUTFILE The file where the returned data is stored. The returned
information will be appended to this file. If this parameter
is not specified, the returned information will be displayed
to the screen when the debug is on. The returned data include:
level 1 information
number of bytes of the available information
RC is the expected return code. COMET will compare the actual
return code with this value. If they are not the same, an
error will be flagged. If this parameter is not specified, an
error will be flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.9. LAN API - Auditing ΓòÉΓòÉΓòÉ
The functions in the Auditing category control the audit log file, which
contains an audit trail of operations that occur on a server.
ΓòÉΓòÉΓòÉ 5.9.1. NetAuditClear (admin) ΓòÉΓòÉΓòÉ
This function clears (and optionally saves) a server's audit log file.
SYNTAX
LAN AUDIT_CLEAR [SERVER=\\servername,] [BACKUP=backup_file_name,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
BACKUP is a filename for an optional backup file. If the filename has a
relative pathname, it is assumed to be relative to the IBMLAN\LOG
directory. If BACKUP is not specified then the audit log entries
will not be saved.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.9.2. NetAuditRead (admin) ΓòÉΓòÉΓòÉ
This function opens and returns an OS/2 file handle to a server's audit log
file.
SYNTAX
LAN AUDIT_READ [SERVER=\\servername,] [OFFSET=offset,]
[FLAG=<0|1|2|3>,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
OFFSET is used to determine the number of records from the beginning of
the of the audit log to start reading.
FLAG is used to determine which direction the log file is to be read.
The following table shows how FLAGS affects the read.
FLAG RESULT
---- ---------------------------------------------------
0 File read normally oldest entry first
1 File read normally newest entry first
2 File read starting at OFFSET from the oldest record
3 File read starting at OFFSET from the newest record
If FLAG is not specified, 0 will be used.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the audit record information
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.9.3. NetAuditWrite (admin, local, server) ΓòÉΓòÉΓòÉ
This function writes an audit trail entry to the local audit log file.
SYNTAX
LAN AUDIT_WRITE TYPE=<0|1|2|3|4|5|6|7|8|9|11|12|13|14|15|16|17|1000>,
[RC=expected_return_code];
Where:
TYPE is the type of audit entry to write to the audit log file. The
following table describes the different types of entries.
TYPE ENTRY
---- -----
0 Status of server changed
1 Session logged on
2 Session logged off
3 Password error
4 Connection started
5 Connection stopped
6 Password rejected
7 Access granted
8 Access rejected
9 File/device/pipe closed
11 Service status code or text changed
12 Access control list modified
13 User Profile Management database modified
14 Network logon of the user
15 Network logoff of the user
16 Network logon denied
17 Account limit exceeded
1000 Unique application defined entry
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.10. LAN API - Error Logging (admin) ΓòÉΓòÉΓòÉ
The functions in the Error Logging category control the error log file.
ΓòÉΓòÉΓòÉ 5.10.1. NetErrorLogClear ΓòÉΓòÉΓòÉ
This function clears and optionally saves a computer's error log file.
SYNTAX
LAN ERROR_LOG_CLEAR [SERVER=\\servername,] [BACKUP,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
BACKUP is the name of the backup file used to save the audit trail
entries. If no BACKUP is specified then not entries will be saved.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.10.2. NetErrorLogRead (admin) ΓòÉΓòÉΓòÉ
This function opens and returns an OS/2 file handle to a computer's error log
file.
SYNTAX
LAN ERROR_LOG_READ [SERVER=\\servername,] [OFFSET=offset,]
[FLAG=<0|1|2|3>,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
OFFSET is used to determine the number of records from the beginning of
the of the audit log to start reading.
FLAG is used to determine which direction the log file is to be read.
The following table shows how FLAGS affects the read.
FLAG RESULT
---- ---------------------------------------------------
0 File read normally oldest entry first
1 File read normally newest entry first
2 File read starting at OFFSET from the oldest record
3 File read starting at OFFSET from the newest record
If FLAG is not specified, 0 will be used.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the error log record
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.10.3. NetErrorLogWrite (admin, local) ΓòÉΓòÉΓòÉ
This function writes an entry to a computer's error log file.
SYNTAX
LAN ERROR_LOG_WRITE [COMPONENT=component_name,] [CODE=<0-9999>,]
[TEXT=error_text,] [DATA=raw_error_data,]
[BUFLEN=buffer_size,] [RC=expected_return_code];
Where:
COMPONENT is the name of the component that logged the error. Any string may
be specified. The default is COMET.
CODE is the error code. The default is 9999.
TEXT is the error text to be logged. Any string can be specified. The
default is no text. If a string is not specified, then a NULL
string will be passed to the function.
DATA is the raw error data associated with the error. Any string can be
specified. The default is one null character. If a string is not
specified, one NULL character will be passed as data to the
function.
BUFLEN is the buffer length of the DATA being passed. If BUFLEN is not
specified then the buffer length will be set to the size of the
DATA that was specified.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.11. LAN API - Files ΓòÉΓòÉΓòÉ
The functions in the Files category provide a system for monitoring which file,
device, and pipe resources are opened on a server, and closing one of these
resources if necessary.
ΓòÉΓòÉΓòÉ 5.11.1. NetFileClose2 (admin, server) ΓòÉΓòÉΓòÉ
This function forces a resource closed.
SYNTAX
LAN FILE_CLOSE2 [SERVER=\\servername,] FILE=file_name,
[FILEID=file_id,] [RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
FILE is the name of the file to close.
FILEID is the id number of the file to close. If FILEID is specified,
then the FILE parameter is ignored.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.11.2. NetFileGetInfo2 (admin, server) ΓòÉΓòÉΓòÉ
This function retrieves information about a particular opening of a server
resource.
SYNTAX
LAN FILE_GET_INFO2 [SERVER=\\servername,] FILE=file_name,
[FILEID=file_id,] [LEVEL=<0|1>,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
FILE is the name of the file for which information is being requested.
FILEID is the id number of the file for which information is being
requested. If FILEID is specified, then the FILE parameter is
ignored.
LEVEL is the level of detail returned. 0 is the lowest level of detail.
1 is the highest. 0 and 1 are the only acceptable values. If LEVEL
is not specified, then 0 is used.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
how many bytes of information were available
the file id number
the opening application's access permissions
how many file-locks are on the file
the pathname to the file
the user that opened the file
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.11.3. NetFileEnum2 (admin) ΓòÉΓòÉΓòÉ
This function supplies information about some or all open files on the server,
allowing the user to supply a key to get the required information through
iterated calls to the API.
SYNTAX
LAN FILE_ENUM2 [SERVER=\\servername,] [BASEPATH=pathname,]
[USER=username,] [LEVEL=<0|1>,] [BUFLEN=buffer_size,]
[ITERATIONS=max_iterations,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
BASEPATH is the base pathname for all list entries. If no BASEPATH is
specified, then all entries will be returned regardless of where
they reside on the server.
USER is the name of a user that can be specified as a quantifier for
the enumeration. If no USER is specified then no user will be used
as a quantifier.
LEVEL is the level of detail returned. 0 is the lowest level of detail.
1 is the highest. 0 and 1 are the only acceptable values. If LEVEL
is not specified, then 0 is used.
ITERATIONS is the maximum number of times NetFileEnum2 will be called to
retrieve information. When this parameter is specified,
NetFileEnum2 will be called until all file information has been
retrieved or the number of ITERATIONS has been reached, whichever
occurs first. If this parameter is not specified then the
NetFileEnum2 function will be called until all file information
has been returned.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
how many entries were returned
how many entries were available
the file id number
the opening application's access permissions
how many file-locks are on the file
the pathname to the file
the user that opened the file
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.12. LAN API - Handle ΓòÉΓòÉΓòÉ
The functions in the Handle category are provided to get and set information on
a per-handle basis.
ΓòÉΓòÉΓòÉ 5.12.1. NetHandleGetInfo ΓòÉΓòÉΓòÉ
This function gets handle-specific information.
SYNTAX
LAN HANDLE_GET_INFO NAME=identification, LEVEL=<1|2>,
[BUFLEN=buffer_size,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
NAME is the identification of a communication device queue or a named
pipe.
LEVEL is the level of detail returned. 1 is for Communication Device
handle information. 2 is for Named Pipe handle information.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
how many bytes of information were available
the amount of time, in milliseconds, the requester collects data to send
to a shared serial device queue or a named pipe
the number of characters, in bytes, the requester stores before sending
data to a serial device queue or named pipe
the username of the user attached to the named pipe
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.12.2. NetHandleSetInfo ΓòÉΓòÉΓòÉ
This function sets handle-specific information.
SYNTAX
LAN HANDLE_SET_INFO NAME=identification, LEVEL=1,
CHARTIME=milliseconds, CHARCOUNT=bytes,
[BUFLEN=buffer_size,] [RC=expected_return_code];
Where:
NAME is the identification of a communication device queue or a named
pipe.
LEVEL is the level of detail returned. 1 is for Communication Device
handle information.
CHARTIME is the number of milliseconds the requester collects data to send
to a shared serial device queue or a named pipe.
CHARCOUNT is the number of characters, in bytes, the requester stores before
sending data to a serial device queue or named pipe.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.13. LAN API - Remote Utilities ΓòÉΓòÉΓòÉ
The functions in the Remote Utilities category enable applications to copy and
move remote files, remotely execute a program, and access the time-of-day
information on a remote server.
ΓòÉΓòÉΓòÉ 5.13.1. NetRemoteCopy (local) ΓòÉΓòÉΓòÉ
This function copies one or more files from one location to another on a remote
server.
SYNTAX
LAN REMOTE_COPY SOURCE=source_pathname,
DESTINATION=destination_pathname, [OPENFLAG=open_flags,]
[COPYFLAG=copy_flags,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SOURCE is the pathname, including the remote server's name, of the
file(s) to be copied (wildcards can be used).
DESTINATION is the pathname to which the SOURCE is to be copied. For a
wildcard SOUCE and DESTINATION must be directories.
OPENFLAG specifies how DESTINATION will be opened. Acceptable values are 0,
1, 2, 16 17, and 18. The following table shows how OPENFLAG
affects the opening of DESTINATION.
OPENFLAG RESULT
---------------------------- -------------------------------------
0,16 If DESTINATION already exists, the open
will fail.
1,17 If DESTINATION already exists, the file
will be appended.
2,18 If DESTINATION already exists, the file
will be overwritten.
0,1,2 If DESTINATION does not exist, the open
will fail.
16,17,18 If DESTINATION does not exist, the file
will be created.
If OPENFLAG is not specified, then 18 is used.
COPYFLAG specifies how the file copy is done. Acceptable values are 1, 2,
5, 6, 9, 10, 13, 14, 17, 18, 21, 22, 25, 26, 29, or 30. The
following table describes how the copy is affected by the COPYFLAG
value. The table shows the values which produce the desired
results.
COPYFLAG RESULT
---------------------------- -------------------------------------
odd value (i.e. 1,5,etc...) DESTINATION must be a file.
even value DESTINATION must be a directory.
1,2,5,6,17,18,21,22 SOURCE is opened in binary mode.
9,10,13,14,25,26,29,30 SOURCE is opened in text mode.
1,2,9,10,17,18,25,26 DESTINATION is opened in binary mode.
5,6,13,14,21,22,29,30 DESTINATION is opened in text mode.
17-30 All writes are verified.
If COPYFLAG is not specified, then 1 is used.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the number of files copied
any error information pertaining to the file copy
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.13.2. NetRemoteExec (local,server) ΓòÉΓòÉΓòÉ
This function executes a program located on a remote server.
SYNTAX
LAN REMOTE_EXEC [ASYNCTRACEFLAG=<0|1|2>,]
[ARGUMENTS=program_arguments,] [ENVIRONMENT=program_environment,]
PROGRAM=program_name, [REMEXECFLAG=<0|1|2|3|4|5|6|7>,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
ASYNCTRACEFLAG specifies the asynchronous and trace flags. 0, 1, and 2 are
acceptable values. 0 indicates a Synchronous process. 1 is an
Asynchronous process without a result code. 2 is an Asynchronous
process with a result code. If ASYNCTRACEFLAG is not specified
then 0 is used.
ARGUMENTS is a list of program arguments. If no arguments are specified,
none will be passed to the program being executed.
ENVIRONMENT specifies the environment for the program to be executed.
PROGRAM is the name and extension of the program to be executed. No drive
or path should be specified.
REMEXECFLAG specifies the remote executable flags that control program
execution. The acceptable values are 0, 1, 2, 3, 4, 5, 6, and 7.
The following table describes how the REMEXECFLAG affects
execution.
REMEXECFLAG RESULT
---------------------------- -------------------------------------
odd value (i.e. 1,3,etc...) A character mode pipe is used for
standard input.
even value A message mode pipe is used for
standard input.
0,1,4,5 OS/2 DosCWait function waits for
the child process to finish
before returning.
2,3,6,7 OS/2 DosCWait function waits for all
spawned processes to finish
before returning.
4-7 OS/2 signals SIGINTR and SIGBREAK are
sent as they are received.
0-3 OS/2 signals SIGINTR and SIGBREAK are
mapped to SIGKILL when remoting
standard signals.
If REMEXECFLAG is not specified, then 6 is used.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
return codes
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.13.3. NetRemoteMove (local) ΓòÉΓòÉΓòÉ
This function moves one or more files from one location to another on a remote
server.
SYNTAX
LAN REMOTE_MOVE SOURCE=source_pathname,
DESTINATION=destination_pathname, [OPENFLAG=<0|1|2|16|17|18>,]
[MOVEFLAG=<0|1>,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SOURCE is the pathname, including the remote server's name, of the
file(s) to be copied (wildcards can be used).
DESTINATION is the pathname to which the SOURCE is to be copied. For a
wildcard SOUCE and DESTINATION must be directories.
OPENFLAG specifies how DESTINATION will be opened. Acceptable values are 0,
1, 2, 16 17, and 18. The following table shows how OPENFLAG
affects the opening of DESTINATION.
OPENFLAG RESULT
---------------------------- -------------------------------------
0,16 If DESTINATION already exists, the open
will fail.
1,17 If DESTINATION already exists, the file
will be appended.
2,18 If DESTINATION already exists, the file
will be overwritten.
0,1,2 If DESTINATION does not exist, the open
will fail.
16,17,18 If DESTINATION does not exist, the file
will be created.
If OPENFLAG is not specified, then 16 is used.
MOVEFLAG specifies how the file move is done. Acceptable values are 1 or 2.
If MOVEFLAG is 1 then DESTINATION must be a file. If MOVEFLAG is 2
then DESTINATION must be a directory. If MOVEFLAG is not
specified, then 1 is used.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
how many files were moved
any error information pertaining to the move operation
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.13.4. NetRemoteTOD (local) ΓòÉΓòÉΓòÉ
This function returns a server's time of day.
SYNTAX
LAN REMOTE_TOD [SERVER=\\servername,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
how many seconds have elapsed since January 1, 1970
the current millisecond
the current hour
the current minute
the current second
the current hundredths of a second
the timezone of the server; calculated (in minutes) from the Greenwich
Mean Time (GMT) zone
the time interval for each tick of the clock. Each integral integer
represents 0.0001 second
the day of the month
the month
the year, starting with 1980
the day of the week (0=Sunday, 6=Saturday)
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.14. LAN API - Serial Device ΓòÉΓòÉΓòÉ
The functions in the Serial Device category control shared serial devices and
their associated queues.
ΓòÉΓòÉΓòÉ 5.14.1. NetCharDevControl (admin, server) ΓòÉΓòÉΓòÉ
This function forces closed a serial device.
SYNTAX
LAN CHAR_DEV_CONTROL [SERVER=\\servername,] DEVICE=devicename,
[OPCODE=0,] [RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
DEVICE is the name of the device to modify.
OPCODE specifies how to modify the DEVICE. The only acceptable value is 0
which means close the serial device. If OPCODE is not specified,
then 0 is used.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
ΓòÉΓòÉΓòÉ 5.14.2. NetCharDevEnum (admin, server) ΓòÉΓòÉΓòÉ
This function provides information on all available serial devices pooled in
shared serial device queues on a server.
SYNTAX
LAN CHAR_DEV_ENUM [SERVER=\\servername,] [LEVEL=<0|1>,]
[BUFLEN=buffer_size,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
LEVEL specifies the level of detail returned. The acceptable values are
0 and 1. 0 is the least amount of data. If LEVEL is not specified,
then 0 is used.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
how many entries were returned
how many entries were available
the devicename associated with the serial device
the status of the device
the device's current user
how many seconds the current application has been connected to the serial
device
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
ΓòÉΓòÉΓòÉ 5.14.3. NetCharDevGetInfo (server) ΓòÉΓòÉΓòÉ
This function provides information about a particular serial device in a shared
serial device queue on a server.
SYNTAX
LAN CHAR_DEV_GET_INFO [SERVER=\\servername,] DEVICE=devicename,
[LEVEL=<0|1>,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
DEVICE is the name of the serial device.
LEVEL specifies the level of detail returned. The acceptable values are
0 and 1. 0 is the least amount of data. If LEVEL is not specified,
then 0 is used.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
how many bytes of information were available
the devicename associated with the serial device
the status of the device
the device's current user
how many seconds the current application has been connected to the serial
device
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
ΓòÉΓòÉΓòÉ 5.14.4. NetCharDevQEnum (server) ΓòÉΓòÉΓòÉ
This function enumerates all serial device queues on a server.
SYNTAX
LAN CHAR_DEV_Q_ENUM [SERVER=\\servername,] [USER=username,]
[LEVEL=<0|1>,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
USER is the name of a user which can be used to calculate how many
requests are pending ahead in the queue. The default is no USER
specified.
LEVEL specifies the level of detail returned. The acceptable values are
0 and 1. 0 is the least amount of data. If LEVEL is not specified
then 0 is used.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
how many entries were returned
how many entries were available
the queuename
the queue priority
the devicenames assigned to the queue
the number of usernames in the queue
the number of users in front of a particular user
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
ΓòÉΓòÉΓòÉ 5.14.5. NetCharDevQGetInfo (server) ΓòÉΓòÉΓòÉ
This function retrieves information about a particular serial device queue on a
server.
SYNTAX
LAN CHAR_DEV_Q_GET_INFO [SERVER=\\servername,] QUEUE=queuename,
[USER=username,] [LEVEL=<0|1>,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
QUEUE is the serial device queue for which information is being
requested.
USER is the name of a user which can be used to calculate how many
requests are pending ahead in the queue. The default is no USER
specified.
LEVEL specifies the level of detail returned. The acceptable values are
0 and 1. 0 is the least amount of data. If LEVEL is not specified,
then 0 is used.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
how many bytes of information were available
the queuename
the queue priority
the devicenames assigned to the queue
the number of usernames in the queue
the number of users in front of a particular user
the devicename associated with the serial device
the status of the device
the device's current user
how many seconds the current application has been connected to the serial
device
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
ΓòÉΓòÉΓòÉ 5.14.6. NetCharDevQPurge (admin, server) ΓòÉΓòÉΓòÉ
This function deletes all pending requests on a serial device queue.
SYNTAX
LAN CHAR_DEV_Q_PURGE [SERVER=\\servername,] QUEUE=queuename,
[RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
QUEUE is the serial device queue to purge pending requests.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
ΓòÉΓòÉΓòÉ 5.14.7. NetCharDevQPurgeSelf (server) ΓòÉΓòÉΓòÉ
This function deletes all pending requests on a serial device queue which were
submitted by a particular computer.
SYNTAX
LAN CHAR_DEV_Q_PURGE_SELF [SERVER=\\servername,]
QUEUE=queuename, COMPUTER=computername;
[RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
QUEUE is the serial device queue to purge pending requests.
COMPUTER is the name of the computer whose requests are to be deleted from
the QUEUE.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
ΓòÉΓòÉΓòÉ 5.14.8. NetCharDevQSetInfo (admin, server) ΓòÉΓòÉΓòÉ
This function modifies the state of a serial device queue on a server.
SYNTAX
LAN CHAR_DEV_Q_SET_INFO [SERVER=\\servername,] QUEUE=queuename,
[LEVEL=1,] [PARAMNUM=<0|2|3>,]
[PRIORITY=<1|2|3|4|5|6|7|8|9>,] [DEVICE=devicename,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
QUEUE is the serial device queue to set.
LEVEL is the level of detail supplied. 1 is the only acceptable value.
If LEVEL is not specified, then 1 is used.
PARAMNUM determines which components are to be set. 0 means all components
are to be set. In this case both PRIORITY and DEVICE should be
specified. 2 means only set PRIORITY and 3 means only set DEVICE.
If PARAMNUM is not specified, then 0 is used.
PRIORITY specifies the queue priority. Acceptable values are 1 though 9,
where 1 has the highest priority. If PRIORITY is not specified,
then 9 is used.
DEVICE is a list of devices assigned to the queue (e.g. COM1, COM3,
etc...).
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
ΓòÉΓòÉΓòÉ 5.15. LAN API - Statistics ΓòÉΓòÉΓòÉ
The function in the Statistics category retrieve and clear the opera ting
statistics for requesters and servers.
ΓòÉΓòÉΓòÉ 5.15.1. NetStatisticsGet2 (admin) ΓòÉΓòÉΓòÉ
This function gets and optionally clears operating statistics for a service.
SYNTAX
LAN STATISTICS_GET_2 [SERVER=\\servername,]
[SERVICE=<REQUESTER|SERVER>,] [LEVEL=0,]
[OPTIONS=<0|1>,] [BUFLEN=buffer_size,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
SERVICE is the name of the service for which to get the statistics. Then
only valid values are REQUESTER and SERVER. If SERVICE is not
specified, then REQUESTER is used.
LEVEL is the level of detail returned. 0 is the only acceptable value.
If LEVEL is not specified, then 0 is used.
OPTIONS specifies whether or not to clear the statistics. 0 means keep the
statistics. 1 means clear them. If OPTIONS is not specified then 0
is used.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
how many byte of information were available
a timestamp telling the period of time over which statistics were
gathered
how many network control blocks (NCBs) the requester submitted
how many NCBs failed issue
how many NCBs failed completion
how many requester sessions were started
how many requester sessions failed
how many requester connections were started
how many requester connections failed
how many sessions were broken and then automatically reestablished
the number of redirector NCBs issued
the number of server NCB's issued
the number of NCBs issued
how many files or named pipes have been opened on the server
how many communication devices have been opened on the server
how many print jobs have been spooled on the server
how many how many sessions were started on the server
how many sessions were disconnected automatically due to timeout on the
server
how many sessions disconnected due to an error on the server
how many bad password violations the server encountered
how many access permission errors the server encountered
how many system errors the server encountered
how many bytes were sent the network from the server
how many bytes were received from the network
the average response time (in milliseconds)
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.16. LAN API - Use ΓòÉΓòÉΓòÉ
The functions in the Use category examine or control connections (uses) between
requesters and servers. Ordinary users can call these functions locally. It
requires administrator's privilege to call them remotely.
ΓòÉΓòÉΓòÉ 5.16.1. NetUseAdd (admin) ΓòÉΓòÉΓòÉ
This function establishes a connection between a local or NULL devicename and a
shared resource by redirecting the local or NULL (UNC) devicename to the shared
resource.
SYNTAX
LAN USE_ADD [SERVER=\\servername,] [LEVEL=1,]
[DEVICE=local_devicename,] NETNAME=remote_netname,
TYPE=<-1|0|1|2|3>, [BUFLEN=buffer_size,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
LEVEL is the level of detail provided. 1 is the only acceptable value.
If LEVEL is not specified, then 1 is used.
DEVICE is the name of the local device to be redirected. If DEVICE is not
specified then NULL is used by default.
NETNAME is the UNC name of the remote resource being accessed. It must be
in the form \\servername\netname.
TYPE specifies the type of remote resource being accessed. The
acceptable values are -1, 0, 1, 2, and 3. -1 matches with the
server's share. This is only valid when DEVICE is NULL. 0 means a
Disk resource. 1 means a Spooled printer. 2 means a Serial device.
3 means an Interprocess communication (IPC).
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.16.2. NetUseDel (admin) ΓòÉΓòÉΓòÉ
This function ends a connection between a local or UNC devicename and a shared
resource.
SYNTAX
LAN USE_DEL [SERVER=\\servername,] [DEVICE=local_devicename,]
[FORCE=<0|1|2>,] [RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
DEVICE is the name of the local device that was redirected. If DEVICE is
not specified then NULL is used by default.
FORCE is the amount of force used for the disconnection. the acceptable
values are 0, 1, and 2. 0 uses no force. In this case, the
connection is actually maintained in a dormant state. A dormant
session can quickly be activated as soon as reconnection is
needed, improving system performance. 1 is normal force. Here the
connection will be removed only is no file, directory, or drive is
opened. 2 means use lots of force. All files, directories, and
drives on the connection are forced closed. If FORCE is not
specified, then 1 is used.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.16.3. NetUseEnum (admin) ΓòÉΓòÉΓòÉ
This function lists all the current connections between the local computer and
resources on a remote server.
SYNTAX
LAN USE_ENUM [SERVER=\\servername,] [LEVEL=<0|1>,]
[BUFLEN=buffer_size,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
LEVEL is the level of detail returned. The acceptable values are 0 and
1. 0 is the least amount of information. If LEVEL is not specified
then 0 is used.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
how many entries were returned
how many entries were available
the devicename being redirected
the remote server being accessed
the status of the connection
the type of remote resource being accessed
how many files, directories, and other processes are open on the remote
resource
how many explicit connections (redirection of a local devicename) or
implicit UNC connections (redirection of a NULL local device name) are
established with the resource.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.16.4. NetUseGetInfo (admin) ΓòÉΓòÉΓòÉ
This function retrieves information about a connection between a local computer
and a shared resources.
SYNTAX
LAN USE_GET_INFO [SERVER=\\servername,]
[DEVICE=redirected_devicename_or_UNC_name,] [LEVEL=<0|1>,]
[BUFLEN=buffer_size,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote server on which the function is to
execute. If this parameter is not specified then a local computer
will be used.
DEVICE is the name of the redirected device or a UNC name for the
resource. If DEVICE is not specified then NULL is used by default.
LEVEL is the level of detail returned. The acceptable values are 0 and
1. 0 is the least amount of information. If LEVEL is not specified
then 0 is used.
BUFLEN is the size of the buffer allocated for the information returned
from the API. The default size is 256 bytes.
OUTFILE is the file name where returned information is stored. The
returned information will be appended to the file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
how many bytes of information were available
the devicename being redirected
the remote server being accessed
the status of the connection
the type of remote resource being accessed
how many files, directories, and other processes are open on the remote
resource
how many explicit connections (redirection of a local devicename) or
implicit UNC connections (redirection of a NULL local device name) are
established with the resource.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.17. LAN API - Alert ΓòÉΓòÉΓòÉ
The functions in the ALERT category provide a system for notifying network
service programs and applications of network events. An event is a particular
instance of a process or state of hardware defined by an application or by the
OS/2 LAN Server software. The OS/2 LAN Server sends out an alert, in the form
of a message or the resetting of a semaphore, when certain events occur. Other
programs, network services, or internal network components use the
NetAlertRaise function to raise an alert, notifying various applications or
users when a particular type of event occurs.
The OS/2 LAN Server defines five types of alerts: "ADMIN", "ERRORLOG",
"MESSAGE", "PRINTING", "USER".
ΓòÉΓòÉΓòÉ 5.17.1. NetAlertRaise (Local) ΓòÉΓòÉΓòÉ
The NetAlertRaise function notifies all clients registered in the alert table
that a particular event occurred.
SYNTAX
LAN ALERT_RAISE EVENT = event_type, [TIMEOUT = milliseconds,]
[OUTFILE = output_filename,] [RC = expected_return_code];
Where:
EVENT is a string telling which type of alert to raise.
TIMEOUT is the length of time in milliseconds to wait for event
information to be written to the mailslot. Default time length is
10000.
OUTFILE is the output file name containing the information of a defined
alert type. The information includes:
timestamp, tells the time and date of the event
eventname, tells the alert type
servicename, tells which application is raising the alert
information specific to the type of event
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.17.2. NetAlertStart (Local) ΓòÉΓòÉΓòÉ
The NetAlertStart function registers a client to be notified of a particular
type of network event.
SYNTAX
LAN ALERT_START EVENT = event_type, RECIPIENT = client_name,
[MAXDATA = bytes,] [RC = expected_return_code];
Where:
EVENT is a string telling which type of event the client is to be
notified of.
RECIPIENT is a string specifying the mailslot or semaphore client to receive
the alerts. A local mailslot name is in the format of
"\mailslot\name", where "name" is a unique set of characters
distinguishing the mailslot from other mailslots on the computer.
A remote mailslot name is in the format of
"\\computername\mailslot\name". A system created semaphore name is
in the format of "\SEM\name", where "name" is consisted of up to
eight letters followed by an optional three-letter extention.
MAXDATA is the limit (in bytes) to the information the mailslot client
will receive about events in that type. Default is 1024.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.17.3. NetAlertStop (Local) ΓòÉΓòÉΓòÉ
The NetAlertStop function removes a registered client from the alert table.
SYNTAX
LAN ALERT_STOP EVENT = event_type, RECIPIENT = client_name,
[RC = expected_return_code];
Where:
EVENT is a string telling which type of alerts the registered client is
to be excluded from.
RECIPIENT is a string containing the username of the client whose
registration is to be canceled.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
flagged. If this parameter is not specified, an error will be
flagged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.18. LAN API - Spooler ΓòÉΓòÉΓòÉ
The functions in the Spooler category control the print jobs, the spooler queue
or the spooler queue manager, and the spooler queue processor.
ΓòÉΓòÉΓòÉ 5.18.1. SplQmAbort ΓòÉΓòÉΓòÉ
This function stops the generation of the spool file(s). It automatically
closes the spooler queue manager.
SYNTAX
LAN QM_ABORT [RC = expected_return_code];
Where:
RC is the expected return code. The return code TRUE (1) indicates
successful completion, FALSE (0) indicates error occurred. COMET
will compare the actual return code with this value. If they are
not the same, an error will be flagged. If this parameter is not
specified, an error will be flagged if the return code is not
good.
ΓòÉΓòÉΓòÉ 5.18.2. SplQmClose ΓòÉΓòÉΓòÉ
This function corresponds to the DevCloseDC function: it closes the spooler
Queue Manager.
SYNTAX
LAN QM_CLOSE [RC = expected_return_code];
Where:
RC is the expected return code. The return code TRUE (1) indicates
successful completion, FALSE (0) indicates error occurred. COMET
will compare the actual return code with this value. If they are
not the same, an error will be flagged. If this parameter is not
specified, an error will be flagged if the return code is not
good.
ΓòÉΓòÉΓòÉ 5.18.3. SplQmEndDoc ΓòÉΓòÉΓòÉ
This function corresponds to the DevEscape (DEVESC_ENDDOC) function: it ends a
print job, and returns JOB, that is a unique number to identify the job.
SYNTAX
LAN QM_END_DOC [OUTFILE = output_filename,] [RC =
expected_return_code];
Where:
OUTFILE is the output filename containing the returned JOB#.
RC is the expected return code. The return code 0 indicates error
occurred and Nonzero indicates the job-id. COMET will compare the
actual return code with this value. If they are not the same, an
error will be flagged. If this parameter is not specified, an
error will be flagged if the return code is not good.
ΓòÉΓòÉΓòÉ 5.18.4. SplQmOpen ΓòÉΓòÉΓòÉ
This function corresponds to the DevOpenDC function: it opens the spooler Queue
Manager for generating a print job.
SYNTAX
LAN QM_OPEN [TOKEN = string,] [LOGADDR = print queue name,]
[DRIVER = print device driver name,] [DATATYPE = queued datatype,]
[COMMENT = file description,] [OUTFILE = output_filename,] [RC =
expected_return_code];
Where:
TOKEN is a string containing a token (nickname) which identifies Spooler
information held in the PRESSERV.INI file. If not specified, "*"
is used.
LOG_ADDR is the logical address of the output print queue (eg. LPT1Q). Use
'\\servername\queuename' for a remote print queue and 'queuename'
for a local print queue. If not specified, LPT1Q is used.
DRIVER is a string containing the name of the Device Driver (eg.
"IBM4201"). If not specified, "IBM4201" is used.
DATATYPE defines the type of data which is to be queued, as follows:
PM_Q_STD
PM_Q_ESC
PM_Q_RAW if not specified, PM_Q_RAW is used.
COMMENT is a natural language description of the file. This may be
displayed by the spooler to the end user. If not specified, "File
comment goes here" is used. *.
NETWORK_PARMS *.are the network options for spooler queues. The values must
be in *.upper case, and take the form of OPTION=VALUE. Valid
option value is *.USER="XXXXXXXX". The default value is a blank
string.
OUTFILE is the output filename containing the information of the specified
device driver and queue processor.
RC is the expected return code. The return code TRUE (1) indicates
successful completion, FALSE (0) indicates error occurred. COMET
will compare the actual return code with this value. If they are
not the same, an error will be flagged. If this parameter is not
specified, an error will be flagged if the return code is not
good.
ΓòÉΓòÉΓòÉ 5.18.5. SplQmStartDoc ΓòÉΓòÉΓòÉ
This function corresponds to the DevEscape (DEVESC_STARTDOC) function: it
signifies the start of a print job. It allows the application to specify a
document name to be associated withe the print job.
SYNTAX
LAN QM_START_DOC DOCNAME = document_name, [RC =
expected_return_code];
Where:
DOC_NAME is the document name that is part of the job description displayed
to the end user by the spooler.
RC is the expected return code. The return code TRUE (1) indicates
successful completion, FALSE (0) indicates error occurred. COMET
will compare the actual return code with this value. If they are
not the same, an error will be flagged. If this parameter is not
specified, an error will be flagged if the return code is not
good.
ΓòÉΓòÉΓòÉ 5.18.6. SplQmWrite ΓòÉΓòÉΓòÉ
This function writes a buffer to the spool file for the print job.
SYNTAX
LAN QM_WRITE [DATA = input_data,] [RC = expected_return_code];
Where:
DATA is the buffer of data to be written to the spool file.
RC is the expected return code. The return code TRUE (1) indicates
successful completion, FALSE (0) indicates error occurred. COMET
will compare the actual return code with this value. If they are
not the same, an error will be flagged. If this parameter is not
specified, an error will be flagged if the return code is not
good.
ΓòÉΓòÉΓòÉ 5.19. LAN API - Share ΓòÉΓòÉΓòÉ
The Shares category control shared resources.
ΓòÉΓòÉΓòÉ 5.19.1. NetShareAdd (Server, Admin) ΓòÉΓòÉΓòÉ
The NetShareAdd shares a Server's resource.
SYNTAX
LAN SHARE_ADD [SERVER=\\servername,] [LEVEL=2,]
NETNAME=sharename, DEVICE=path_or_device, TYPE=>0|1|2|3<,
[MAXUSES=max_uses,] [REMARK=remark,] [BUFLEN=buffer_length,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
LEVEL is the level of detail provided. Level 2 is the only valid level,
although any number may be specified. Level 2 is the default.
NETNAME is the share name of the resource. No default provided, a netname
must be provided.
DEVICE is the path of a disk type share or a device name if the share is
a character device. If the share is a printer, then the path and
the netname must be that of an existing print queue. If the share
is an IPC, then path must be NULL. Note, a pipe must be created
before it can be shared.
TYPE is the type of share. Numbers 0,1,2, and 3 are valid share types.
Types are mapped as follows: disk share =0, print queue = 1,
character device = 2, and an IPC share = 3.
MAXUSES is the maximum number of concurrent connections that the shared
resource can accommodate. Default is 10.
REMARK is a string which is an optional comment about the shared
resource. The default is no remark.
BUFLEN is the length of the buffer that will be supplied to the API call.
The default buffer is dynamically calculated and set large enough
for any share.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.19.2. NetShareEnum (Server, Admin user if level 2 is requested) ΓòÉΓòÉΓòÉ
The NetShareEnum function retrieves share information about each shared
resource on a Server.
SYNTAX
LAN SHARE_ENUM [SERVER=\\servername,] [LEVEL=>0|1|2<,]
[OUTFILE=output_file_name,] [BUFLEN=buffer_length,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
LEVEL is the level of detail returned. Levels 0, 1, or 2 are the only
valid levels, although any number may be specified. Level 2 is
the default.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the number of bytes returned
the total number of bytes available
the contents of the returned data structure.
BUFLEN is the length of the buffer that will be supplied to the API call.
The default buffer length is set large enough for 50 users,
however, this buffer will probably be sufficient for more than 50
users if the variable length data is not used. Increase this
value if a return code of 234 is returned.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.19.3. NetShareDel (Server,Admin) ΓòÉΓòÉΓòÉ
NetShareDel deletes a sharename from a Server's list of shared resources.
SYNTAX
LAN SHARE_DEL [SERVER=\\servername,] NETNAME=sharename,
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
NETNAME is the share name of the resource. No default provided, a netname
must be provided.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.19.4. NetShareCheck (Server) ΓòÉΓòÉΓòÉ
NetShareCheck queries the server whether a specified device is shared.
SYNTAX
LAN SHARE_CHECK [SERVER=\\servername,] DEVICE=device_name,
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
DEVICE is the name of the device to be checked. Valid devices sample
types are A:\, COM1, LPT1, and etc. Although, any string may be
entered.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the server name
the device name
the type of device, disk share =0, print queue = 1, character device = 2,
and IPC = 3
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.19.5. NetShareGetInfo ΓòÉΓòÉΓòÉ
NetShareGetInfo retrieves information about a particular shared resource on a
Server.
SYNTAX
LAN SHARE_GET_INFO [SERVER=\\servername,] NETNAME=sharename,
[LEVEL=>0|1|2<,] [OUTFILE=output_file_name,]
[BUFLEN=buffer_length,] [RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
NETNAME is the share name of the resource. No default provided, a netname
must be provided.
LEVEL is the level of detail provided by the share_info_x data
structure. Levels 0, 1, or 2 are valid values and the default is
2. Although, any number can be used.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the total number of bytes available
the contents of the returned data structure.
BUFLEN is the length of the buffer that will be supplied to the API call.
The default buffer length is dynamically calculated and allocated
to satisfy the ShareGetInfo API call.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.19.6. NetShareSetInfo ΓòÉΓòÉΓòÉ
NetShareSetInfo sets a shared resource's parameters.
SYNTAX
LAN SHARE_SET_INFO [SERVER=\\servername,] NETNAME=sharename,
[LEVEL=>1|2<,] [MAXUSES=max_uses,] [REMARK=remark,]
[PARMNUM=>0|4|6<,] [BUFLEN=buffer_length]
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
NETNAME is the share name of the resource. No default provided, a netname
must be provided.
LEVEL is the level of detail provided by the share_info_x data
structures. Valid level values are 1 or 2 (2 is the default).
Although any number can be used.
MAXUSES is the maximum number of concurrent connections that the shared
resource can accommodate. Default is 10.
REMARK is a string which is an optional comment about the shared
resource. The default remark is NULL, no remark.
PARMNUM specifies if NetShareSetInfo will specify a single share_info
component or if an entire share_info data structure. If PARMNUM
is 0, or absent, then an entire data structure will be used. In
this instance both MAXUSES and REMARK are expected. PARNMUM can
specify the following data structure components:
VALUE COMPONENT
4 level 1 or 2 remark
6 level 2 maxuses
So, if values 4 or 6 will be used, then the level must correspond
and a REMARK or MAXUSES should be entered. Any value can be used
for PARMNUM, however.
BUFLEN is the length of the buffer that will be supplied to the API call.
The default buffer length is dynamically calculated to satisfy the
ShareSetInfo API call.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, and error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.20. Access Permissions APIs ΓòÉΓòÉΓòÉ
The APIs in the Access Permissions category examine or modify user or group
access permission records for server resources. The Access Permission category
consist of the following seven functions: NetAccessAdd, NetAccessCheck,
NetAccessDel, NetAccessEnum, NetAccessGetInfo, NetAccessGetUserPerms, and
NetAccessSetInfo.
ΓòÉΓòÉΓòÉ 5.20.1. NetAccessAdd (Admin or have Perm permission, Server) ΓòÉΓòÉΓòÉ
The NetAccessAdd function defines a username or groupname access permission
record for a new resource. One to three users and or groups can be added added
to a resources access permission record with this routine.
SYNTAX
LAN ACCESS_ADD [SERVER=\\servername,] [LEVEL=1,]
RESOURCE=resource_type, [AUDIT=> 1 | 0 <,] COUNT=> 1 | 0 <,
UGNAME=ugname:Perms [ugname:Perms] [ugname:Perms],
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
LEVEL is the level of detail provided. The number 1 is the expected
level, although any number may be specified. Level 1 is the
default.
RESOURCE is an ASCII string specifying the name of a particular resource
type.
Resource Type Name Format
Directory drive:pathname
File drive:pathname
Pipe \pipe\pipename
Printer queue \print\queuename
Character device queue \comm\chardevqueue
AUDIT is one of the following: The default is 0, no auditing.
Audit None 0
Audit All 1
Audit Successful Closes CL
Audit Successful Opens SO
Audit Successful Writes SW
Audit Successful Deletes SD
Audit Successful Changes SP
Audit Failed Opens FO
Audit Failed Writes FW
Audit Failed Deletes FD
Audit Failed Changes FP
COUNT is either 1 or 0. If COUNT is 0, then UGNAME and PERMS are not
required and will be ignored if provided. When COUNT is 0, then
an access permission record is created for the resource but, no
users or groups will permissions will be added.
UGNAME is the user or group name and permissions to be added to
resource's access permission record. can be specified. Up to
three user or group names and their permissions may be listed.
This is a limitaion of COMET and not the API. UGNAME is not
required if COUNT is 0. If COUNT is zero, then an access
permission record is created for the resource but no users are
defined in the access list. If COUNT is non-zero, then a user or
group name and a colon (:) Must be supplied. The permission
string that follows the UGNAME is optional. If the permission
string is not provided, then that user's permissions will be None
(no access).
Perms is a string that describes the user's or group's permissions
described as follows. Example "PERMS=RWC" for Read, Write and
Create permissions.
PERMS letter Meaning
R Read, and by default execute.
W Write permission.
C Create an instance of the resource; data may
be written to the resource when creating it.
X Execute permission.
D Delete the permission.
A Permission to modify resource's attributes
(such as date and time).
P Permission to modify the permissions (read,
write, create, execute, and delete) assigned to
a resource for a user or application.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.20.2. NetAccessCheck (Admin, Local) ΓòÉΓòÉΓòÉ
NetAccessCheck verifies that a username or groupname has the requested
permissions for a particular resource.
SYNTAX
LAN ACCESS_CHECK UGNAME=user_or_group_name, RESOURCE=resource_name,
[OPERATION=>RWCXDAP<,[ [OUTFILE=output_file_name,]
[RC=expected_return_cod]
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
UGNAME is the user or group name to be checked against a resource's
access permission record.
RESOURCE is an ASCII string specifying the name of a particular resource
type. See the description for valid resource names in the LAN
ACCESS_ADD discussion.
OPERATION is a string that describes the type of access operation requested.
Example, "OPERATION=RWC" for Read, Write and Create access. Any
combination of the following may be requested. The default is
"P".
OPERATION letter Meaning
R Read, and by default execute.
W Write permission.
C Create an instance of the resource; data may
be written to the resource when creating it.
X Execute permission.
D Delete the permission.
A Permission to modify resource's attributes
(such as date and time).
P Permission to modify the permissions (read,
write, create, execute, and delete) assigned to
a resource for a user or application.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the user name
the resource
the operation requested
and the result returned from the API
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good. A zero (0) return code
means the requested operation is permitted.
The "result" returned by the API is only valid when the LAN return code is
zero. When both the result and the LAN return code are 0, this indicates the
requested OPERATION is allowed.
Sample Code
ΓòÉΓòÉΓòÉ 5.20.3. NetAccessDel (Admin, Server) ΓòÉΓòÉΓòÉ
NetAccessDel deletes all access permission records for a particular shared
resource.
SYNTAX
LAN ACCESS_DEL [SERVER=\\servername,] RESOURCE=resource_type,
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
RESOURCE is an ASCII string specifying the name of a particular resource
type. See the description for valid resource names in the LAN
ACCESS_ADD discussion.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.20.4. NetAccessEnum (partially Admin) ΓòÉΓòÉΓòÉ
NetAccessEnum enumerates all access permission records.
SYNTAX
LAN ACCESS_ENUM [SERVER=\\servername] [BASEPATH=path_name,]
[LEVEL=>O | 1<,] [RECURSIVE=> 0 | 1<,]
[BUFLEN=buffer_length,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
BASEPATH is a base pathname for a shared resources. If this entry is
absent, then no base path will be used. The default is no base
path (NULL).
LEVEL specifies the level of detail (0 or 1) requested for the returned
data structure. The default is 0 although, any number may be
entered.
RECURSIVE enables or disables recursive searching. If RECURSIVE is 0,
NetAccessEnum returns entries only for the resource named as
basepath. If RECURSIVE is 1 (or non-zero), then entries for all
access control records whose resource matches basepath will be
returned.
BUFLEN is the length of the buffer provided to the API. The default is
1024 although, any value may be entered.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the server name
the basepath
the level requested
the API return code
the number of entries returned
the total number of entries available
the resource(s)
all user names and their permissions in the access list, if level 1 is
requested
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good. A zero (0) return code
means the requested operation is permitted.
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
Sample Code
ΓòÉΓòÉΓòÉ 5.20.5. NetAccessGetInfo (Admin or have Perm permission, Server) ΓòÉΓòÉΓòÉ
NetAccessGetInfo retrieves information about a resource's access permission
record.
SYNTAX
LAN ACCESS_GET_INFO [SERVER=\\servername,] RESOURCE=resource_type,
[LEVEL=1,] [BUFLEN=buffer_length,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
RESOURCE is an ASCII string specifying the name of a particular resource
type. See the description for valid resource names in the LAN
ACCESS_ADD discussion.
LEVEL is the level of detail returned. The number 1 is the expected
level, although any number may be specified. Level 1 is the
default.
BUFLEN is the length of the buffer that will be supplied to the API call.
The default buffer length will be dynamically allocated to satisfy
a successful API call so, the size is unknown.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the name of the resource
the total number of bytes available
a list of all users and groups, and their permissions, who are in the
resource's access permission record
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.20.6. NetAccessGetUserPerms ( partially Admin) ΓòÉΓòÉΓòÉ
NetAccessGetUserPerms supplies a specified user's or group's permission to a
resource.
SYNTAX
LAN ACCESS_GET_USER_PERMS [SERVER=\\servername,]
UGNAME=user_or_group_name, RESOURCE=resource_type,
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
UGNAME is the user or group name to be inquired.
RESOURCE is an ASCII string specifying the name of a particular resource
type. See the description for valid resource names in the LAN
ACCESS_ADD discussion.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the name of the resource
a list of all users and groups, and their permissions, who are in the
resource's access permission record
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Remarks
The permissions returned are based on the user's entry and any groups to which
the use belongs. Priority is always given to the user's entry if one exists.
Sample Code
ΓòÉΓòÉΓòÉ 5.20.7. NetAccessSetInfo (Admin, Server) ΓòÉΓòÉΓòÉ
NetAccessSetInfo changes an access permission record for a resource.
SYNTAX
LAN ACCESS_SET_INFO [SERVER=\\servername,] RESOURCE=resource_type,
[LEVEL=>0|1<,] [BUFLEN=buffer_length,] [PARMNUM=>0|2<,]
[AUDIT=> 1 | 0 <,] [UGNAME=ugname:Perms [ugname:Perms]
[ugname:Perms,] [COUNT=number_of_access_list,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
RESOURCE is an ASCII string specifying the name of a particular resource
type. See the description for valid resource names in the LAN
ACCESS_ADD discussion.
LEVEL is the level of detail provided. The number 1 is the expected
level, although any number may be specified. Level 1 is the
default.
BUFLEN is the length of the buffer that will be supplied to the API call.
The default buffer length is 100 bytes???????????????????????
PARMNUM if PARMNUM is 0, specifies if a user or group name and permissions
are to be added to the resources access permission record. An
UGNAME should be provided if PARMNUM is 0. If PARMNUM is 2, then
specifies only if auditing to be on or off for the resource.
AUDIT is either 1 (turn auditing on), or 0 (no auditing). The default
is 0, no auditing.
UGNAME is the user or group name and permissions to be added to
resource's access permission record. can be specified. Up to
three user or group names and their permissions may be listed.
This is a limitaion of COMET and not the API. UGNAME is not
required if COUNT is 0. If COUNT is zero, then an access
permission record is created for the resource but no users are
defined in the access list. If COUNT is non-zero, then a user or
group name and a colon (:) Must be supplied. The permission
string that follows the UGNAME is optional. If the permission
string is not provided, then that user's permissions will be None
(no access).
Perms is a string that describes the user's or group's permissions
described as follows. Example "PERMS=RWC" for Read, Write and
Create permissions.
COUNT is the number of ugname:Perms lists in the UGNAME parameter.
Default is 0.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Remarks
Care must be taken when using this COMET command. If more than 3 access lists
(user or group name and their associated permission(s)) exist for a resource,
this command will re-set the access lists with the new UGNAME and permissions.
For example, suppose the following resource had these access lists:
Resource Name : C:
Attribute : Audit OFF
Access Lists : 3
User Name : PAM
Permissions : RWC
Group Name : GROUP2
Permissions : None
Group Name : GROUP1
Permissions : P
Now if the following command is executed by COMET:
LAN ACCESS_SET_INFO resource=c:, level=1,count=1,
ugname=PAM:P, parmnum=0;
this is what the new access list would look like:
Resource Name : C:
Attribute : Audit OFF
Access Lists : 1
User Name : PAM
Permissions : P
Notice that Group2 and Group1 no longer appear in the Access List.
Sample Code
ΓòÉΓòÉΓòÉ 5.21. Groups APIs ΓòÉΓòÉΓòÉ
Description
A group is a set of users sharing common permissions in the User Profile
Management (UPM) database. The Groups functions create or delete groups and
review or adjust their membership.
ΓòÉΓòÉΓòÉ 5.21.1. NetGroupAdd ( Admin ) ΓòÉΓòÉΓòÉ
NetGroupAdd creates a new group account in the User Profile Management (UPM)
database.
SYNTAX
LAN GROUP_ADD [SERVER=\\servernamename,] [LEVEL=>0|1<,]
GNAME=group_name, [REMARK=comment,] [BUFLEN=buffer_length,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
LEVEL is the level of detail provided. The numbers 0 and 1 are valid
levels, although any number may be specified. If a REMARK is
specified then the Level should be 1. Level 0 is the default.
GNAME is the name of the group to add.
REMARK is an optional comment or remark about the group. If a Remark is
specified, then Level should be set to 1.
BUFLEN is the length of the buffer that will be supplied to the API call.
The default buffer length is the size of a group_info_1 data
structure plus the variable length data.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.21.2. NetGroupAddUser ( Admin ) ΓòÉΓòÉΓòÉ
NetGroupAddUser adds a user to a group in the UPM database.
SYNTAX
LAN GROUP_ADD_USER [SERVER=\\servernamename,] GNAME=group_name,
UNAME=user_name, [RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
GNAME is the name of the group the user will join.
UNAME is the user to add to the group.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.21.3. NetGroupDel ( Admin ) ΓòÉΓòÉΓòÉ
NetGroupDel removes a group account from the UPM database.
SYNTAX
LAN GROUP_DEL [SERVER=\\servernamename,] GNAME=group_name,
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
GNAME is the name of the group the user will join.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.21.4. NetGroupDelUser ( Admin ) ΓòÉΓòÉΓòÉ
NetGroupDelUser removes a user from a particular group in the UPM database.
SYNTAX
LAN GROUP_DEL_USER [SERVER=\\servernamename,] GNAME=group_name,
UNAME=user_name, [RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
GNAME is the name of the group the user will removed from.
UNAME is the user to remove from the group.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.21.5. NetGroupEnum ( Admin ) ΓòÉΓòÉΓòÉ
NetGroupEnum lists all group accounts on the UPM database.
SYNTAX
LAN GROUP_ENUM [SERVER=\\servernamename,] [LEVEL=>0|1<,]
[BUFLEN=buffer_length,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
LEVEL is the level of detail returned. The numbers 0, and 1 are valid
level numbers, although any number may be specified. Level 0
provides the least amount of information while level 2 provides
the most. Level 2 is the default.
BUFLEN is the length of the buffer that will be supplied to the API call.
The default buffer length is 1000 bytes.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the number of entries returned
the total number of entries available
all group accounts in the UPM database.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.21.6. NetGroupGetInfo ( Admin ) ΓòÉΓòÉΓòÉ
NetGroupGetInfo gets group-related information
SYNTAX
LAN GROUP_GET_INFO [SERVER=\\servernamename,] GNAME=group_name,
[LEVEL=>0|1<,] [BUFLEN=buffer_length,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
GNAME is the name of the group to get information from.
LEVEL is the level of detail returned. The numbers 0 and 1 are valid
level numbers, although any number may be specified. Level 0
provides the least amount of information while level 1 provides
the most. Level 0 is the default.
BUFLEN is the length of the buffer that will be supplied to the API call.
The default buffer length is 1024 bytes.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the total number of bytes available
the contents of the returned data structure, level 0 or 1.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.21.7. NetGroupGetUsers ( Partially Admin ) ΓòÉΓòÉΓòÉ
NetGroupGetUsers returns a list of members of a particular group in the UPM
database.
SYNTAX
LAN GROUP_GET_USERS [SERVER=\\servernamename,] GNAME=group_name,
[LEVEL=0,] [BUFLEN=buffer_length,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
GNAME is the name of the group whose members will be listed.
LEVEL is the level of detail returned. The number 0 is the only valid
level, although any number may be specified. Level Level 0 is the
default.
BUFLEN is the length of the buffer that will be supplied to the API call.
The default buffer length is 1024 bytes.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the number of entries returned
the total number of entries available
all members in the group of interest.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.21.8. NetGroupSetInfo ( Admin ) ΓòÉΓòÉΓòÉ
NetGroupSetInfo sets group related information.
SYNTAX
LAN GROUP_SET_INFO [SERVER=\\servernamename,] GNAME=group_name,
[REMARK=comment,] [LEVEL=>0|1<,] [PARMNUM=>0|2<,]
[BUFLEN=buffer_length,] [RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
GNAME is the name of the group whose members will be listed.
LEVEL is the level of detail returned. The numbers 0 and 1 are the
valid only valid levels, although any number may be specified.
Level Level 0 is the default.
PARMNUM is the ordinal position of data structure components. If PARMNUM
is zero, or absent, then an entire data structure is passed. The
only settable field is the remark parameter hence, the only valid
nonzero value for parmnum is 2. If PARMNUM is 2, then only the
Group's comment is changed. A REMARK should be specified if
PARMNUM is 2, and LEVEL should be set to 1.
BUFLEN is the length of the buffer that will be supplied to the API call.
The default buffer length is dynamically calculated to satisfy the
call.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.21.9. NetGroupSetUsers ( Admin ) ΓòÉΓòÉΓòÉ
NetGroupSetUsers sets information about users who belong to a group, i.e. this
function acts much like NetGroupUserAdd execept, this function allows multiple
users to be added to a group through one API call.
SYNTAX
LAN GROUP_SET_USERS [SERVER=\\servernamename,] GNAME=group_name,
UNAMES=name [name] [name] COUNT=user_count [LEVEL=0,]
[BUFLEN=buffer_length,] [RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
GNAME is the name of the group to set the users. No default, a group
name must be provided.
UNAME is the name of the user(s). If more than one user is provided,
they should be seperated by a blank space. At least one user must
be provided, no default.
COUNT is the number of users supplied at the UNNAME parameter. The
COUNT must be supplied, no default.
LEVEL Level 0 is the only valid level although and the default, although
any number may be used.
BUFLEN is the length of the buffer that will be supplied to the API call.
The default buffer length is 1024 bytes.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.22. LAN API - User ΓòÉΓòÉΓòÉ
Description
In the User Profile Management (UPM), each user or application that accesses
the resources must have a user account in the system. The system users this
account to verify that the user or application has permission to connect to any
shared resource. The functions in the User category control a user's account
in the UPM. The User category consist of the following 15 functions:
NetUserAdd, NetUserDel, NetUserEnum, NetUserGetGroups, NetUserGetInfo,
NetUserInit, NetUserModalsGet, NetUserModalsSet, NetUserPasswordSet,
NetUserPrimaryDBGet, NetUserPrimaryDBSet, NetUserSetGroups, NetUserSetInfo,
NetUserValidate, and NetUserValidate2.
ΓòÉΓòÉΓòÉ 5.22.1. NetUserAdd ( Admin ) ΓòÉΓòÉΓòÉ
NetUserAdd function establishes an account for a user in the User Profile
Management (UPM) and assigns a password and privilege level.
SYNTAX
LAN USER_ADD [SERVER=\\servernamename,] [LEVEL=>1|2<,]
[BUFLEN=buffer_length,] UNAME=user_name, [PASSWD=password,]
[PRIV=privilage,] [HOMEDIR=home_directory,] [REMARK=comment,]
[FLAGS=value,] [SCRIPTPATH=pathname,]
2[FULLNAME=full_name_of_user,] 2[UCOMMENT=user_settable_comment,]
2[REQUESTERS=requesters,] 2[EXPIRES=expiration_time,]
2[MAXSTOR=home_dir_max_size,] 2[LOGONHRS=day:hour
2[LOGONSVR=servername,] 2[CNTRYCODE=country_code,]
2[CODEPG=code_page,] [RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
LEVEL is the data structure level supplied to the API call. Valid
levels are 1 and 2, although any level may be entered. The
default is level 1. Note, those parameters that have a 2 on the
left are used only when the level is 2, if the level is 1,
entries in these parameters will be ignored.
BUFLEN is the buffer length supplied to the API call. The default is is
dynamically allocated to satisfy the call, however, and value may
be entered.
UNAME is the name of the user the account is to be established for.
PASSWD is the users password. The default is no password (NULL).
PRIV is the user's privilege. The default is User. It may be one of the
following:
Value Privilege
0 Guest
1 User
2 Administrator
HOMEDIR is the user's home directory. The absolute path may be local or
UNC. The default is no home directory.
REMARK is a remark or comment. It may contain any text. The default is
no remark.
FLAGS determines several features of a user's account. If more than one
of the features below is desired, the sum of the desired features
should be entered. Example, if a user is required to have a home
dir and have his logon script enabled, a value of 9 should be
entered for flags. The default value is 33, logon script enabled
and no password required.
Meaning decimal value Bit mask
logon script enabled 1 0x1
user's account disabled 2 0x2
home directory required 8 0x8
password not required 32 0x20
password cannot change 64 0x40
SCRIPTPATH is the a string telling the pathname of the user's logon script.
The default is no scriptpath (NULL).
FULLNAME is the full name of the user. The default is NULL.
UCOMMENT is a user-settable comment field. The default is NULL.
REQUESTERS is a list of requesters from which a user is permitted to log on.
If this entry is absent then the default is NULL which means all
requesters are allowed.
EXPIRES is the date and time the the account will expire in the following
format: mm/dd/yy hh:mn:ss . An expired account is equivalent of
a disabled account. The default value is never (0xFFFFFFFF).
MAXSTOR is the maximum storage, in K bytes, allotted for the home
directory. The default is unlimited (0xFFFFFFFF).
LOGONHRS are the hours of the week the user is allowed to logon. If not
given, the default is all hours.
LOGONSVR is the server to handle logon requests for a user. The default is
the domain controller (NULL).
CNTRYCODE is the OS /2 country code for the user's language choice. This is
used by the OS/2 LAN Server software to generate messages in the
appropriate language whenever possible. The default is the
current country code on the server.
CODEPG is the OS/2 code page for the language choice of the user. The
valid values are the values used to indicate a code page.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.22.2. NetUserDel (Admin) ΓòÉΓòÉΓòÉ
NetUserDel removes an account from the User Account database, ending all access
to the resources in the system.
SYNTAX
LAN USER_DEL [SERVER=\\servernamename,] UNAME=user_name,
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
UNAME is the name of the user the account is to be established for.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.22.3. NetUserEnum (Partially Admin) ΓòÉΓòÉΓòÉ
NetUserEnum returns information about all accounts on a server.
SYNTAX
LAN USER_ENUM [SERVER=\\servernamename,] [LEVEL=>0|1|2|10<,]
[BUFLEN=buffer_length,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
LEVEL is the level of detail returned. Valid levels are 0, 1, 2, or 10.
A non-admin user may only call this API with levels 0, or 10. The
default level is 1.
BUFLEN is the buffer length supplied to the API call. The default is
dynamically determined to satisfy the API call.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the number of entries returned
the contents of the returned data structure.
all user accounts in the UPM database.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.22.4. NetUserGetGroups (Partially Admin) ΓòÉΓòÉΓòÉ
NetUserGetGroups lists all groups in the UPM to which a particular user belongs
to.
SYNTAX
LAN USER_GET_GROUPS [SERVER=\\servernamename,] UNAME=user_name,
[LEVEL=0,] [BUFLEN=buffer_length,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
UNAME is the name of the user to search for in each group account.
LEVEL is the level of detail returned. Level 0 is the only valid level
although, and value may be entered. The default level is 0.
BUFLEN is the buffer length supplied to the API call. The default is
dynamically determined to satisfy the API call.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the number of entries returned
the total number of entries available
all the groups the user is a member of
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.22.5. NetUserGetInfo ΓòÉΓòÉΓòÉ
NetUserGetInfo retrieves information about a particular account on a server.
SYNTAX
LAN USER_GET_INFO [SERVER=\\servernamename,] UNAME=user_name,
[LEVEL=>0|1|2|10|11<,] [BUFLEN=buffer_length,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
UNAME is the name of the user to search for in each group account.
LEVEL is the level of detail returned. Valid levels are 0, 1, 2, 10, or
11. A non-admin user may only call this API with levels 0, 10, or
11. Level 11 is available only for the account the user us logged
on to. The default level is 1.
BUFLEN is the buffer length supplied to the API call. The default is
dynamically determined to satisfy the API call.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the number of entries returned
the total number of entries available
the contents of the appropriate level of data structure (levels 0, 1, 2,
10 , or 11)
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.22.6. NetUserInit ΓòÉΓòÉΓòÉ
NetUserInit allocates, initializes, and maps the UPM cache of the database.
SYNTAX
LAN USER_INIT LANROOT=IBMLAN_root, [MAXSESSIONS=max_users_for_session,]
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
LANROOT is the root of the IBMLAN tree.
MAXSESSIONS is the maximum number of users for the session cache. The default
is NULL.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the LAN root
the Max Sessions
the API return code
and the cache address
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Remarks
Not supported by OS/2 Extended Edition Version 1.3
Sample Code
ΓòÉΓòÉΓòÉ 5.22.7. NetUserModalsGet ΓòÉΓòÉΓòÉ
NetUserModalsGet gets global modals-related information for all users and
groups in the UPM database.
SYNTAX
LAN USER_MODALS_GET [SERVER=\\servernamename,] [LEVEL=0|1]
[BUFLEN=buffer_length,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
LEVEL is the level of detail returned. Levels 0 and 1 are valid levels
although, and value may be entered. The default level is 0.
BUFLEN is the buffer length supplied to the API call. The default is
dynamically determined.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the total number of bytes available
the contents of the user_modals_info data structure
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.22.8. NetUserModalsSet (Admin) ΓòÉΓòÉΓòÉ
NetUserModalsSet sets global modals-related information for all users and
groups in the UPM database.
SYNTAX
LAN USER_MODALS_SET [SERVER=\\servernamename,]
[MINPWDLEN=minumum_password_length,] [MAXPWDAGE=maximum_password_age,]
[MINPWDAGE=minumum_password_age,] [FORCEOFF=force_off_time,]
[PWDHIST=password_history_length,] [DOMAIN=domain_name,]
[ROLE=database_role,] [PARMNUM=>1|2|3|4|5|6|7<] [LEVEL=0|1,]
[BUFLEN=buffer_length,] [RC=expected_return_code,]
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
MINPWDLEN is the is the minimum password length. The valid range of values
is 0 to MAXPSWDLEN.
MAXPWDAGE is the maximum time (in days) since the password was last changed,
and for which the current password is valid. A value of -1 will
allow the password to valid forever. The minimum value is one
day.
MINPWDAGE is the minimum time (in seconds) since the password was last
changed, before which the current password is allowed to be
changed. A value of 0 means there is no delay required between
password updates.
FORCEOFF is the length of time (in seconds) after the valid logon hours
that the user should be forced off the network. If the value of
-1 is used, the user will never be forced off.
PWDHIST is the number of passwords in the history buffer. The range of
valid values is 0 to 8.
DOMAIN is the name of the primary domain to which this database belongs.
It should match the primary domain name of the requester software
on the local machine. This parameter is for level 1 data
structures only.
ROLE is the role of this database under a single system image (SSI). It
can be one of the following:
MANIFEST VALUE
STANDALONE 0
MEMBER 1
BACKUP 2
PRIMARY 3
Without SSI, this field should always be set to STANDALONE. The
default value is 1 (MEMBER).
PARMNUM specifies if an entire data structure will be passed to the API or
if only a single component of a data structure will be passed. If
PARMNUM is 0, then an entire user_modals_info_0 or
user_modals_info_1 data structure is passed, if the level is 0 (or
absent), or 1 respectively.
If PARMNUM is 0 or absent, then internally (in COMET),
NetUserModalsGet will be called before UserModalsSet to load the
current default modal values into the data structure that will be
used in the call to UserModalsSet. If this were not done, then
every call to UserModalsSet with a PARMNUM value of 0, would reset
all the modal values. This would mean that all of the parameters
above would have to be supplied when PARMNUM is 0.
If PARMNUM is non-zero, then only one component of a data
structure is changed and only one should be supplied. The
following tables describes what the values of PARMNUM and LEVEL
should be to change a single data structure components.
For user_modals_info_0 data structure components, the level should
be 0 and PARMNUM is:
Component PARMNUM value
usrmod0_min_passwd_len 1
usrmod0_max_passwd_age 2
usrmod0_min_passwd_age 3
usrmod0_force_logoff 4
usrmod0_password_hist_len 5
For user_modals_info_1 data structure components, the level should
be 1 and PARMNUM is:
Component PARMNUM value
usrmod1_primary 6
usrmod1_role 7
For instance, to set only the MINPASSWDLEN to a new value of 4 on
a local server, the syntax would look as follows:
LAN USER_MODALS_SET MINPASSWDLEN=4,
DOMAIN=whatever,
ROLE=whatever,
PARMNUM=1,
LEVEL=0;
LEVEL is the level of detail supplied. LevelS 0 and 1 are the only
valid levels although, and value may be entered. The default level
is 0.
BUFLEN is the buffer length supplied to the API call. The default is
dynamically determined.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Remarks
This function can be called even when the UPM system is not active, provided a
valid UPM database exists. The accounts system must be inactive in order to
change the name of the database domain. NETLOGON may not be running when
setting the ROLE parameter. The Domain and Role parameters are for level 1
data structures only. All other parameters are for level 0 data structures
only.
Sample Code
ΓòÉΓòÉΓòÉ 5.22.9. NetUserPasswordSet (Partially Admin) ΓòÉΓòÉΓòÉ
NetUserPasswordSet changes the password stored in a user's account in the
system.
SYNTAX
LAN USER_PASSWORD_SET [SERVER=\\servernamename,] UNAME=username,
OLDPW=old_password, NEWPW=new_password,
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
UNAME is the name of the user whose password will be changed.
OLDPASSWD is the user's current password.
NEWPASSWD is the new password for the user.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Remarks
Passwords are case sensitive.
Sample Code
ΓòÉΓòÉΓòÉ 5.22.10. NetUserRestrict ΓòÉΓòÉΓòÉ
NetUserRestrict registers the process itself as a user-oriented process with
privileges.
SYNTAX
LAN USER_RESTRICT ACCMODE=access_mode,
[RC=expected_return_code];
Where:
ACCMODE has the value of the privilege for this process.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Remarks
Not supported by OS/2 Extended Edition Version 1.3
Sample Code
ΓòÉΓòÉΓòÉ 5.22.11. NetUserSetGroups (Admin) ΓòÉΓòÉΓòÉ
NetUserSetGroups sets the groups of which a user is a member.
SYNTAX
LAN USER_SET_GROUPS [SERVER=\\servernamename,] UNAME=username,
GROUP=groupname [groupname], [LEVEL=0,]
ENTRIES=number_of_groups, [BUFLEN=buffer_length,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
UNAME is the name of the user who is to be added to the GROUP(s).
GROUP is the name of the group(s) of which the user is a member. At
least one group must be specified. If more than one group is
provided, then the group name must be separated by a space. There
is a limitation in the number of groups that may be specified.
This is a COMET restriction. Up to five medium sized group names
can be entered and even more may work.
LEVEL is the data structure level to provide to the API. The default
and the only valid value is zero, however, any value may be used.
ENTRIES is the number of group names provided to the API. The only valid
values are 1 and 2, although any value may be used.
BUFLEN is the length of the buffer supplied to the API. The default
value is ?????? (will be determined).
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.22.12. NetUserSetInfo (Partially Admin) ΓòÉΓòÉΓòÉ
NetUserSetInfo modifies a user's account in the system.
SYNTAX
LAN USER_SET_INFO [SERVER=\\servernamename,] [LEVEL=>1|2<,]
[BUFLEN=buffer_length,] UNAME=user_name [PASSWORD=password,]
[PRIV=privilage,] [HOMEDIR=home_directory,] [REMARK=comment,]
[FLAGS=value,] [SCRIPTPATH=pathname,] [FULLNAME=full_name_of_user,]
[UCOMMENT=user_settable_comment,] [PARMS=parameter_string,]
[REQUESTERS=requesters,] [EXPIRES=expiration_time,]
[MAXSTOR=home_dir_max_size,] [LOGONHRS=d:h,] [LOGONSVR=servername,]
[CNTRYCODE=country_code,] [CODEPG=code_pagee,] [PARMNUM=>0|3|5|6|7|8|9
|11|12|13|14|17|18|20|23< |24<|25<,] [RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
LEVEL is the data structure level supplied to the API call. Valid
levels are 1 and 2, although any level may be entered. The
default is level 1.
BUFLEN is the buffer length supplied to the API call. The default is
2048 bytes.
UNAME is the name of the user the account is to be established for.
(Level 1 and 2)
PASSWORD is the users password. The default is no password (NULL). (Level
1 and 2)
PRIV is the user's privilege. It may be one of the following: (Level 1
and 2)
Value Privilege
0 Guest
1 User
2 Administrator
HOMEDIR is the user's home directory. The absolute path may be local or
UNC. The default is no home directory. (Level 1 and 2)
REMARK is a remark or comment. It may contain any text. The default is
no remark. (Level 1 and 2)
FLAGS determine if the logon script is enabled and if the user's account
is enabled. The following matrix describes valid values
(0,1,2,3), although any value may be entered. The default value
is 1. (Level 1 and 2)
Meaning decimal value Bit mask
logon script enabled 1 0x1
user's account disabled 2 0x2
home directory required 8 0x8
password not required 32 0x20
password cannot change 64 0x40
SCRIPTPATH is the a string telling the pathname of the user's logon script.
The default is no scriptpath (NULL). (Level 1 and 2)
PARMNUM determines if an entire data structure or a single component will
be passed to the API. If PARMNUM is zero, the default, or absent,
then an entire data structure will be passed to the API. In this
instance, the LEVEL must be 1 or 2. Otherwise, if only a single
component is to be modified then PARMNUM must be the ordinal
position of the component. The following describes which
parameters are settable and PARNUM's value (which is the ordinal
position). LEVEL must be set to 2 if any of the PARNUM values
after SCRIPTPATH are used. Level 1 or 2 can be used for the
PARMNUM values between and including PASSWORD and SCRIPTPATH.
Warning, COMET will return an error if an ordinary user tries to
call NetUserSetInfo with a 0 value for PARMNUM. This is because
COMET calls NetUserGetInfo before calling SetInfo and an ordinary
user does not have the authority to call NetUserGetInfo with level
set to 1 or 2. This is really not a problem though because, an
ordinary user is not allowed to call NetUserSetInfo with PARNUM
set to 0, it would have been nice to do this for testing purposes
however.
Parameter PARNUM's value
PASSWORD 3
PRIVILEGE 5
HOMEDIR 6
REMARK 7
FLAGS 8
SCRIPTPATH 9
FULLNAME 11
USER COMMENT 12
PARMS 13
REQUESTERS 14
EXPIRES 17
MAX STORAGE 18
LOGON HOURS 20
LOGON SERVER 23
COUNTRY CODE 24
CODE PAGE 25
FULLNAME is the full name of the user. (Level 2 only)
UCOMMENT is a user-settable comment field. (Level 2 only)
PARMS is an ASCIIZ string not used by LAN Server but, available for use
by applications.
REQUESTERS is a list of requesters from which a user is permitted to log on.
If this entry is absent then the default is NULL which means all
requesters are allowed. (Level 2 only)
EXPIRES is date and time the account will expire in the following format:
mm/dd/yy hh/mn/ss. An expired account is equivalent of a disabled
account. The default value is never (0xFFFFFFFF). (Level 2 only)
MAXSTOR is the maximum storage, in K bytes, allotted for the home
directory. The default is unlimited (0xFFFFFFFF). (Level 2 only)
LOGONHRS are the hours of the week the user is allowed to logon. The input
must be in the form "d:h", where d is the day of the week.
Starting with Sunday, valid values for d are S,M,T,W,H,F,A. The
value for d can be upper or lower case. The h is the hour of the
day, valid values are 0-23. The 0th hour is 0:00 to 0:59. Only
one hour at a time can be set, this is a limitation of COMET not
the API. The logonhrs supplied are exclusive-or'ed to the logon
hours bitmap. This allows the user to set a bit if it is cleared,
or clear a bit if it is set. (Level 2 only)
LOGONSVR is the server to handle logon requests for a user. The default is
the domain controller (0xFFFFFFFF).??????????? Albert
investigating if this parameter applies to IBM. (Level 2 only)
CNTRYCODE is the OS/2 country code for the user's language choice. This is
used by the OS/2 LAN Server software to generate messages in the
appropriate language whenever possible. The default is the
current country code on the server. (Level 2 only)
CODEPG is the OS/2 code page for the language choice of the user. The
valid values are the values used to indicate a code page.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Remarks
An admin type user can set all settable fields. Any user may change the
UCOMMENT, PARMS, CODEPG, or the CNTRYCODE for his own account. To do this the
user must supply the correct value for PARMNUM . An ordinary user must supply
a value for PARMNUM and it may not be zero.
If an admin uses 0 for parmnum, then an entire user_info data structure is
passed. Internally, COMET calls NetUserGetInfo to provide defaults for any
entries the user does not supply. Therefore, a user does not have to supply
all of the datastructure components when a 0 PARMNUM values is used.
Sample Code
ΓòÉΓòÉΓòÉ 5.22.13. NetUserValidate ΓòÉΓòÉΓòÉ
NetUserValidate verifies that there is an account with a particular username
and password in the system. It does not check logon restrictions.
SYNTAX
LAN USER_VALIDATE UNAME=user_name, PASSWD=user's_password,
[OUTFILE=output_file_name,] [RC=expected_return_code];
Where:
UNAME is the name of the user whose account is being verified.
PASSWD is the user's password to be verified.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the user's name and privilege
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Remarks
This API returns the user's privilege if the password is correct. If the
password is not valid, the password will be matched against the password of
the GUEST user account. If the passwords match, guest privileges will be
returned. IF the GUEST user account has a NULL
Sample Code
ΓòÉΓòÉΓòÉ 5.22.14. NetUserValidate2 ΓòÉΓòÉΓòÉ
NetUserValidate2 validates a user with its password. It checks if the user can
log on based on logon restrictions defined for the account.
SYNTAX
LAN USER_VALIDATE2 UNAME=user_name, [PASSWD=user's_password,]
[REQUESTER=user_machine,] [LEVEL=1,]
[BUFLEN=buffer_length,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
UNAME is the name of the account is trying to log on to.
PASSWD is the user's password to be verified.
REQUESTER is the name of the requester from which the user is logging on. If
this parameter is absent, then the local machine will be assumed
(this is also the default). If this parameter is -1, then the
requester is unknown.
LEVEL is the data structure level supplied to the API. The default and
the only valid value is 1, although any value may be used.
BUFLEN is the length of the buffer supplied to the API. The default value
has yet to be determined.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the logon code
the total number of bytes available
If the RC is zero and the logon code is a Validated_Logon value, then the
contents of the user_logon_info_1 will be out put.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.23. LAN API - Domain ΓòÉΓòÉΓòÉ
The Doamin category deals with domain-specific information.
ΓòÉΓòÉΓòÉ 5.23.1. NetGetDCName ΓòÉΓòÉΓòÉ
The NetGetDCName function returns the name of the domain controller if there is
any.
SYNTAX
LAN GET_DC_NAME [SERVER=\\servername,] [DOMAIN=domain_name,]
[BUFLEN=buffer_length] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
DOMAIN is the name of the domain where the name of the domain controller
is desired. A NULL domain name is taken to mean to get the domain
controller name of the primary domain.
BUFLEN is the length of the buffer supplied to the API. The default value
is 256 bytes.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the API return code.
and the domain controller's name if the API return code is 0.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 5.23.2. NetLogonEnum (partially Admin) ΓòÉΓòÉΓòÉ
NetLogonEnum supplies information about logged on users.
SYNTAX
LAN Logon_Enum [SERVER=\\servername,] [LEVEL=>0|1|2<,]
[BUFLEN=buffer_length,] [OUTFILE=output_file_name,]
[RC=expected_return_code];
Where:
SERVER is the name of the remote servername where the function is to
execute. Server is a UNC styled servername string, i.e.
\\Servername. If servername is absent then a local server is
assumed.
LEVEL is the level of detail returned. Valid levels are 0, 1, or 2. A
non-admin user may only call this API with level 0 or 2 only. The
default level is 0.
BUFLEN is the buffer length supplied to the API call. The default is
dynamically determined to satisfy the API call.
OUTFILE the name of the file where the returned data is stored. The
returned information will be appended to this file. If this
parameter is not specified, the returned information will be
displayed to the screen if LAN DEBUG is on. The returned data
includes:
the API return code.
the number of entries returned.
the contents of the returned data structure.
if the API return code is 0, a list of the logged on users at either
level 0 or 1.
RC is the expected return code. COMET will compare the actual return
code with this value. If they are not the same, an error will be
logged. If this parameter is not specified, an error will be
logged if the return code is not good.
Sample Code
ΓòÉΓòÉΓòÉ 6. Sample COMET Input Files ΓòÉΓòÉΓòÉ
Input file issuing some COMET Utility, OS2_SHELL, and OS2_API Commands.
Input file issuing Database Manager and SQL commands
Input file issuing the SRPI command
Input files issuing APPC verbs to send and receive a file.
Input files issuing ACDI verbs to send and receive a file.
Input file issuing a combination of API driver commands.
ΓòÉΓòÉΓòÉ 6.1. Input file issuing some COMET Utility, OS2_SHELL, and OS2_API Commands. ΓòÉΓòÉΓòÉ
This input file is a combination of COMET Utility, OS2_SHELL, and OS2_API
commands. For more information on these commands refer to COMET Utility
Commands for COMET Utility commands, OS/2 Shell commands for OS2_SHELL
commands, and OS2_API commands for OS2_API commands.
OS2_SHELL "ECHO START OF COMET INPUT FILE: SAMPLE.CMT ...";
COMET DISPLAY_ON;
#COMET DEBUG_ON ALL; <- This line is commented.
OS2_API DOSBEEP 200,200;
OS2_SHELL "STARTDBM";
OS2_API DOSSLEEP SECONDS=30;
OS2_SHELL "DIR C:";
OS2_SHELL "ECHO End of testcase";
ΓòÉΓòÉΓòÉ 6.2. Input file issuing Database Manager and SQL commands ΓòÉΓòÉΓòÉ
This sample input file goes through the required steps to create a database,
insert a record, perform a Dynamic Select (writing the output of the select to
a file), then drop the table, drop the database, and exit the Database Manager.
Refer to DBM (Database Manager) commands, and SQL (Structured Query Language)
commands for more information on the specific DBM and SQL command syntax and a
brief explanation on each command supported. You may also want to refer to the
Database Manager User documentation for indepth information on DBM and SQL
commands.
#COMET DEBUG_ON DBM, SQL; <- This line is commented.
OS2_SHELL "ECHO START OF COMET INPUT FILE: DBMSQL.FIL ...";
DBM STARTDBM;
DBM CREATE_DB DB=cmtdb, PW=new, RC=0;
DBM ALTER_DB DB=cmtdb, OLDPW=new, NEWPW=NONE, RC=0;
DBM START_USING_DB DB=cmtdb, USE=s, RC=0;
SQL "CREATE TABLE testtab
(name VARCHAR(10),
dept SMALLINT)";
SQL "INSERT INTO testtab (name, dept) VALUES ('Chuck', 644)";
SQL "SELECT name FROM testtab",
FILE=cmttest.out,
RC=0;
OS2_SHELL "TYPE cmttest.out";
OS2_API DOSBEEP 200,200;
SQL "DROP TABLE testtab";
DBM STOP_USING_DB;
DBM DROP_DB DB=cmtdb;
DBM STOPDBM;
ΓòÉΓòÉΓòÉ 6.3. Input file issuing the SRPI command ΓòÉΓòÉΓòÉ
This is a sample input file specifying the required, and some optional
parameters for making a SRPI call with COMET. Please refer to SRPI
(Server/Requester Programming Interface) commands for a description of each
parameter. Further SRPI information can be obtained from Communication Manager
documentation.
OS2_SHELL "ECHO Issuing SRPI call next";
SRPI SENDREQ SERVER="driver3 ",
FUNCTION = x'0000',
PARM="12345678",
DATA="0987654321",
RCSRPI=x'00000000',
RCSRVR=x'00000000',
RPFILE=parm.r,
RDFILE=data.r;
OS2_SHELL "ECHO SRPI call done";
ΓòÉΓòÉΓòÉ 6.4. Input files issuing APPC verbs to send and receive a file. ΓòÉΓòÉΓòÉ
This input file is an example of the sending side of an APPC Communication
session. Please refer to APPC (Advanced Program to Program Communications)
commands for a brief description of the supported APPC commands. For more
indepth information on APPC commands refer to Communication Manager
documentation.
OS2_SHELL "echo tpstarted";
APPC TP_STARTED LOCAL_LU = "LU1",
TP = "TP1",
PRC=x'0';
OS2_SHELL "echo alloc";
APPC MC_ALLOC CONV=1,
REMOTE_LU="LU2",
MODE="MODE1",
TP="TP1",
SYNC=confirm,
PRC=x'0';
OS2_SHELL "echo send_data";
APPC MC_SEND_DATA DATA="hi there";
OS2_SHELL "echo confirm";
APPC MC_COMFIRM;
OS2_SHELL "echo send_data";
APPC MC_SEND_DATA DATA="This is another test\
one, two, three";
OS2_SHELL "echo send file";
APPC MC_SEND_DATA FILE=myfile.txt;
OS2_SHELL "echo receive_wait (crc)";
APPC MC_RCV_WAIT CRC=myfile.txt; # check CRC
OS2_SHELL "echo receive (what=send)";
APPC MC_RCV_WAIT WHAT=SEND;
0S2_SHELL "echo dealloc";
APPC MC_DEALLOC CONV=1;
OS2_SHELL "echo tpended";
APPC TP_ENDED;
This input file is an example of the receiving side of an APPC Communication
session. Please refer to APPC (Advanced Program to Program Communications)
commands for a brief description of the supported APPC commands. For more
indepth information on APPC commands refer to Communication Manager
documentation.
OS2_SHELL "ECHO Issuing APPC call next";
APPC RECEIVE_ALLOC SYNC=confirm,
TP="tp1",
CONV=1,
MODE="mode1",
PARTNER_LU="LU1",
TYPE=mapped;
APPC MC_RCV_WAIT DATA="hi there.",
WHAT=data_comp;
APPC MC_RCV_WAIT WHAT=conf;
APPC MC_CONFIRMED;
APPC TP_ENDED;
ΓòÉΓòÉΓòÉ 6.5. Input files issuing ACDI verbs to send and receive a file. ΓòÉΓòÉΓòÉ
This input file is an example of the sending side of an ACDI Communication
session. Please refer to ACDI (Asynchronous Communication Device Interface)
commands for a brief description of the supported ACDI commands. For more
indepth information on ACDI commands refer to Communication Manager
documentation.
OS2_API DOSBEEP 1000, 100;
OS2_SHELL "ECHO Issuing APPC call next";
ACDI OPEN DEV=com1;
ACDI SETBIT SEND=1200, RCV=1200;
ACDI SETLINECTRL STOPBITS=1,
PARITY=none,
DATABITS=8;
ACDI CONNECT TYPE=4,
TIMEOUT1=0,
TIMEOUT2=15;
ACDI SEND FILE=myfile.txt;
OS2_API DOSSLEEP SECONDS=30;
OS2_SHELL "ECHO End of testcase";
This input file is an example of the receiving side of an ACDI Communication
session. Please refer to ACDI (Asynchronous Communication Device Interface)
commands for a brief description of the supported ACDI commands. For more
indepth information on ACDI commands refer to Communication Manager
documentation.
OS2_SHELL "echo type 'myfile.txt'";
OS2_SHELL "type myfile.txt";
ACDI OPEN DEV=com1;
ACDI SETBIT SEND=1200, RCV=1200;
ACDI SETLINECTRL STOPBITS=1,
PARITY=none,
DATABITS=8;
ACDI CONNECT TYPE=4,
TIMEOUT1=0,
TIMEOUT2=15;
OS2_SHELL "echo SLEEP for 2 minutes";
OS2_API DOSSLEEP MINUTES=2;
OS2_SHELL "dir myfile.txt";
os2_shell "type myfile.txt";
ΓòÉΓòÉΓòÉ 6.6. Input file issuing a combination of API driver commands. ΓòÉΓòÉΓòÉ
This input file example issues a combination of COMET Utility, OS2 API,
OS2 SHELL, Database Manager, and Communication Manager API driver commands.
#COMET DEBUG_ON DBM, SQL; <- This line is commented.
OS2_SHELL "ECHO START OF COMET INPUT FILE: CMTTEST.FIL ...";
DBM STARTDBM;
OS2_SHELL "ECHO Issuing APPC call next";
APPC RECEIVE_ALLOC SYNC=confirm,
TP="tp1",
CONV=1,
MODE="mode1",
PARTNER_LU="LU1",
TYPE=mapped;
DBM CREATE_DB DB=cmtdb, PW=new, RC=0;
DBM ALTER_DB DB=cmtdb, OLDPW=new, NEWPW=NONE, RC=0;
DBM START_USING_DB DB=cmtdb, USE=s, RC=0;
SQL "CREATE TABLE testtab
(name VARCHAR(10),
dept SMALLINT)";
SQL "INSERT INTO testtab (name, dept) VALUES ('Chuck', 644)";
SQL "SELECT name FROM testtab",
FILE=cmttest.out,
RC=0;
OS2_API DOSBEEP 200,200;
APPC MC_RCV_WAIT DATA="hi there.",
WHAT=data_comp;
SQL "DROP TABLE testtab";
APPC MC_RCV_WAIT WHAT=conf;
DBM STOP_USING_DB;
APPC MC_CONFIRMED;
DBM DROP_DB DB=cmtdb;
APPC TP_ENDED;
DBM STOPDBM;
ΓòÉΓòÉΓòÉ 7. Sample COMET Log File ΓòÉΓòÉΓòÉ
This is a sample COMET log file which is the file written by COMET as a result
of the Input file processing. The name of this file would be the name you
specified as the output_file when running COMET, the default file name is
COMETLOG.TXT.
This sample log file corresponds to the processing of the input file issuing
Database Manager and Structured Query Language commands in Appendix A. LOGFILE
created on Fri Feb 12 10:52 1988 Input file : DBMSQL.CMT
------------------------------------------------------
Line Time: Command type: Parameters/Info:
---- -------- -------------------- ----------------
1 10:53 OS2_SHELL "ECHO START OF COMET INPUT FILE:
6 10:54 DBM STARTDBM
7 10:59 DBM CREATE_DB DB=cmtdb2, PW=new, RC=0
8 10:03 DBM ALTER_DB DB=cmtdb2, OLDPW=new, NEWPW=NONE
9 10:04 DBM START_USING_DB DB=cmtdb2, USE=s, RC=0
10 10:10 SQL "CREATE TABLE testtab(name VARCHAR(10),dept SM
13 10:13 SQL "INSERT INTO testtab (name, dept) VALUES ('Chu
14 10:13 SQL FILE=cmttest.out RC=0
17 10:14 OS2_API DOSBEEP 200, 200
18 10:14 SQL "DROP TABLE testtab".
19 10:15 DBM STOP_USING_DB
20 10:16 DBM DROP_DB DB=cmtdb2
21 10:21 DBM STOPDBM
22 10:21 COMET terminating...
ΓòÉΓòÉΓòÉ 8. COMET Version Level Descriptions. ΓòÉΓòÉΓòÉ
This Appendix describes the changes made to the different COMET version levels.
ΓòÉΓòÉΓòÉ 8.1. COMET Version 1.3 changes ΓòÉΓòÉΓòÉ
The following changes are for COMET version 1.3, which contains enhancements to
support new functions provided by OS/2 Extended Edition Version 1.3.
Version 1.301
The following LAN User APIs not supported by OS/2 Extended Edition
Version 1.3:
NetUserInit
NetUserRestrict
The following changes are for COMET version 1.3, which contains enhancements
to support new functions provided by OS/2 Extended Edition Version 1.2.
Version 1.300
COMET loads DLL files on call.
Add support to allow the CONTINUE and RETRY execution of COMET cmds
after COMET has encountered an error in testcase execution.
Allow for RESTART of COMET at a specified line in the file.
EHLLAPI upgrade to later tool code.
Restructured COMET code/data segments more efficiently.
Inclusion of other input files into an input file.
ΓòÉΓòÉΓòÉ 8.1.1. COMET Version 1.2 changes ΓòÉΓòÉΓòÉ
The following changes are for COMET version 1.2, which contains enhancements to
support new functions provided by OS/2 Extended Edition Version 1.2.
Version 1.20
COMET converted to Presentation Manager Application.
Lan Server API Support added and maintained by Dept. 639.
ACDI code redesigned and rewritten.
Query Manager Callable Interface support added to COMET
Database Manager commands: Catalog_Node, Catalog_Db, Restore_Db,
Uncatalog_Node, and Uncatalog_Db added to COMET in order to support
Remote Database Services enhancement to OS/2 EE 1.2.
IEEE 802.2 Statistics command was completed.
COMET Entry_points command updated for new Presentation Mgr. file.
COMET INT3 command is removed.
The 802.2 Dlc_Flow_Control code in the 802.2 Read command and in the
external 802.2 Dlc_Flow_Control command was completed.
The COMET Log command rewrite was completed.
The Action parameter replaced the Pause parameter. The values for
Action are pause, resume, and reset.
ΓòÉΓòÉΓòÉ 8.1.2. COMET Version 1.1 changes ΓòÉΓòÉΓòÉ
The following changes are for COMET version 1.1, which contains enhancements to
support new functions provided by OS/2 Extended Edition Version 1.1.
Version 1.101 Sept 21, 1988. The following new functions were added to
support OS/2 EE 1.1 functions:
IEEE 802.2 API support was completed. Added Receive_Cancel command.
Netbios API support no longer is dependent on outdated NETB header files.
Comet Entry_points command updated for new comet routines.
Version 1.100 September 10, 1988. First 1.1 Driver. The following new
functions were added to support new OS/2 EE 1.1 functions:
IEEE 802.2 API support, which allows access to LAN services.
Netbios API support, which allows access to LAN services, based on the
original IBM PC Network Netbios interface.
EHLLAPI (3270 Emulator High Level Language API) support, which allows
access to 3270 sessions from user programs.
The following internal COMET function enhancements were also added to
COMET version 1.100:
MSG command - display a message.
EXIT command - terminate comet with a user specified error level.
WAIT command - wait for input from the keyboard before continuing.
Subroutine CALL/RETURN commands.
Conditional and unconditional jumps.
Clear error condition to allow a test to continue.
Looping - timed and counted loops, breaking out of loops.
Line labeling, for jumps within the input file, or optional input file
entry point when starting COMET
Logging options: nolog, change log file name, stop and re-start logging.
Process an included COMET input file (@include).
User defined constants in the input file (@define).
Some minor changes in existing functions were also made:
The entire input file is now read into storage before starting execution,
to expedite the test once it is started.
The SUCCESS message in the log file has been removed. Logging the start
of the next statement implies the successful completion of the previous
statement.
The Help panel (COMET ?) was updated with the new command syntax
description.
A default input file extension (.CMT) was added. Input files must now
either specify a different file extension, or use this one.
Got rid of CMTAPPCR.DAT file, which contained APPC return code
information. That file is now compiled directly into the code.
ΓòÉΓòÉΓòÉ 8.1.3. COMET Version 1.0 changes ΓòÉΓòÉΓòÉ
The following changes are for COMET Version 1.0 changes. COMET Version 1.0 is
used to test OS/2 Extended Edition Version 1.0.
COMET Version 1.04 April 19, 1988. Fix ACDI buffer overwrite problem.
COMET Version 1.03 March 25, 1988. Added COMET Utility Commands Entry_Points
and INT3.
COMET Version 1.02 March 10, 1988. Added New Drive parameter ('C:') to
Database API calls which required this new parameter. Also made some
APPC code changes to satisfy the new APPC header file changes.
COMET Version 1.01 Febuary 26, 1988. Compiled and linked with the Database
Manager build D07048 due to changes in Database Manager dynamic link
files.
ΓòÉΓòÉΓòÉ 9. Description of Namepipe API Test ΓòÉΓòÉΓòÉ
Named Pipes
ΓòÉΓòÉΓòÉ 9.1. Named Pipes ΓòÉΓòÉΓòÉ
A named pipe is a bi-directional interprocess communication facility that
allows two processes, either local or remote, to communicate with each other
over the network. A process that creates a named pipe is known as a Server
Process (or Parent Process), and a process that establishes a connection to a
named pipe is known as a Clinet Process (or Child Process).
There are total twenty-three Named Pipes (12) and DOS (11) funcitons supported
in the B/L release 1.2. For a list and details of the Named Pipes functions,
refer to IBM OS/2 Technical Reference Version 1.2 Programmer Reference Vol.1.
A series of application programs were written in C to test these functions:
L12AP300.C
L12AP301.C
L12AP302.C
L12AP303.C
L12AP304.C
L12AP305.C
L12AP306.C
L12AP307.C
L12AP308.C
ΓòÉΓòÉΓòÉ 9.1.1. L12AP300.C ΓòÉΓòÉΓòÉ
This program creates the named pipe on a server machine.
/***************************************************************/
/* FILE: L12AP300 */
/* */
/* FUNCTION: Process IBM OS/2 LAN NAMED PIPES API CALLS.*/
/* This file has to be run on a server machine while */
/* L12AP301.C runs on a requester machine. */
/* Before running the program, make sure that LAN is started*/
/* and users are logged on to the server and the requester. */
/* */
/* Named Pipe functions covered in this file: */
/* DosMakeNmPipe, */
/* DosSetNmPHandState, */
/* DosConnectNmPipe, */
/* DosPeekNmPipe, */
/* DosQNmPHandState, */
/* DosQNmPipeInfo, */
/* DosSetNmPipeSem, */
/* DosQNmPipeSemState, */
/* DosDisConnectNmPipe. */
/* */
/* Dos functions used in this file: */
/* DosSleep, */
/* DosWrite, */
/* DosCreateSem */
/* */
/* Author: Tai C. Beal */
/* Last Edited: 6/7/89 */
/* */
/***************************************************************/
/*-------------------------------*/
/* include files */
/*-------------------------------*/
#define INCL_DOS#define INCL_DOSSIGNALS
#define INCL_DOSERRORS
#define INCL_DOSSEMAPHORES
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
#include <os2.h>
#include <memory.h>
#define WRT_BEHIND 0x0000 /* default */
#define NO_WRT_BEHIND 0x4000
#define INHERITANCE 0x0000 /* default */
#define NO_INHERITANCE 0x0080
#define ACCESS_INBOUND 0x0000 /* default */
#define ACCESS_OUTBOUND 0x0001
#define ACCESS_DUPLEX 0x0002
#define BLOCK 0x0000 /* & Mask */
#define NO_BLOCK 0x8000 /* Default */
#define EPO_SERVER 0x4000 /* & Mask */
#define EPO_CLIENT 0x0000 /* Default */
#define TYPE_AND_MASK 0x0c00
#define T_BYTE_STREAM 0x0000
/* Pipe/Type is Byte Stream */
#define T_MESSAGE_STREAM 0x0400
/* Pipe/Type is Message Stream */
#define READ_AND_MASK 0x0300
#define RM_BYTE_STREAM 0x0000
/* Read Mode is Byte Stream */
#define RM_MESSAGE_STREAM 0x0100
/* Read Mode is Message Stream */
#define ICNT_AND_MASK 0x00ff
#define ICNT_INFINITE 0xffff
#define ICNT_UNIQUE 0x0001
typedef struct _NPSS
{ /* QNmPipeSemState information record */
BYTE npss_status;
/* type of record, 0 = EOI, 1 = read ok, */
/* 2 = write ok, 3 = pipe closed */
BYTE npss_flag;
/* additional info, 01 = waiting thread */
USHORT npss_key;
/* user's key value */
USHORT npss_avail;
/* available data/space if status = 1/2 */
} NPSS; /* npss */
main()
{
PSZ pipe_name;
HFILE pipe_handle;
USHORT pipe_open_mode;
USHORT pipe_mode;
USHORT outbuf_size;
USHORT inbuf_size;
ULONG timeout;
USHORT ret;
HFILE open_pipe_handle;
/* used by DosOpen to open pipe */
USHORT action_taken, file_size, file_attribute;
USHORT file_open_flag, file_open_mode;
ULONG time_out; /* used by DosWrite */
PVOID outbuf;
USHORT buf_len;
USHORT bytes_written;
PCH inbuf, write_buf;
USHORT inbuf_len, outbuf_len, max_data_size;
USHORT bytesout;
BYTE output_buf; /* DosPeekNmPipe */
USHORT bytes_to_be_written;
USHORT bytes_read, bytes_avail;
USHORT pipe_state;
typedef struct _NPINFO_DATA1 {
/* PipeInfo data block (returned, level 1) */
USHORT npi_obuflen; /* length of outgoing I/O buffer */
USHORT npi_ibuflen; /* length of incoming I/O buffer */
BYTE npi_maxicnt; /* maximum number of instances */
BYTE npi_curicnt; /* current number of instances */
BYTE npi_namlen; /* length of pipe name */
CHAR npi_name[256]; /* start of name */
} NPINFO_DATA1; /* npi_data1 */
NPINFO_DATA1 pipe_info; /* DosQNmPipeInfo */
USHORT handle_type, flag_word;
USHORT pipe_hand_state;
HSEM sem_handle;
PSZ sem_name;
NPSS infobufΓòÆ3Γûá;
pipe_name = "\\pipe\\pipe1";
pipe_open_mode = 0;
pipe_mode = 0;
/* set pipe mode to MESSAGE mode, and allow DUPLEX access */
pipe_open_mode = WRT_BEHIND | INHERITANCE | ACCESS_DUPLEX;
pipe_mode = BLOCK | T_MESSAGE_STREAM | RM_MESSAGE_STREAM
| 0X0020;
outbuf_size = 512;
inbuf_size = 512;
timeout = 50L;
printf("Make named pipe\n");
ret = DosMakeNmPipe((PSZ)pipe_name,
(PHFILE)&pipe_handle,
(USHORT)pipe_open_mode,
(USHORT)pipe_mode,
(USHORT)outbuf_size,
(USHORT)inbuf_size,
(ULONG)timeout);
printf(" DosMakeNmPipe rc = %d\n", ret);
/*-------------------------------------------------------------*/
printf("Set name pipe handle state\n");
ret = DosSetNmPHandState((HFILE)pipe_handle,
(USHORT)0x0100);
/* message stream */
printf(" DosSetNmPHandState rc = %d\n", ret);
ret = DosSetNmPHandState((HFILE)pipe_handle,
(USHORT)0x0000);
/* byte stream */
printf(" DosSetNmPHandState rc = %d\n", ret);
/*-------------------------------------------------------------*/
printf("Connect named pipe\n");
ret = DosConnectNmPipe(pipe_handle);
printf(" DosConnectNmPipe rc = %d\n", ret);
/*-------------------------------------------------------------*/
/* outbuf = (PBYTE)malloc(512); */
bytes_to_be_written = 512;
printf("Peek named pipe\n");
ret = DosPeekNmPipe((HFILE)pipe_handle,
(PBYTE)&output_buf,
(USHORT)bytes_to_be_written,
(PUSHORT)&bytes_read,
(PUSHORT)&bytes_avail,
(PUSHORT)&pipe_state);
printf(" DosPeekNmPipe rc = %d\n", ret);
/*-------------------------------------------------------------*/
printf("Query named pipe handle state\n");
ret = DosQNmPHandState((HFILE)pipe_handle,
(PUSHORT)&pipe_hand_state);
printf(" DosQNmPHandState rc = %d\n", ret);
/*--------------------------------------------------------------*/
printf("Query named pipe info\n");
ret = DosQNmPipeInfo((HFILE)pipe_handle,
(USHORT)1, /* info level */
(PBYTE)&pipe_info,
(USHORT)sizeof(pipe_info));
printf(" DosQNmPipeInfo rc = %d\n", ret);
/*--------------------------------------------------------------*/
ret = DosSleep(20000L);
/*--------------------------------------------------------------*/
outbuf = "write a string to the named pipe";
buf_len = strlen(outbuf)+1;
printf("Write a string to named pipe\n");
ret = DosWrite((HFILE)pipe_handle,
(PVOID)outbuf,
(USHORT)buf_len,
(PUSHORT)&bytes_written);
printf(" DosWrite rc = %d\n", ret);
/*-------------------------------------------------------------*/
ret = DosSleep(20000L);
/*-------------------------------------------------------------*/
/* DosSetNmPipeSem call works for local named pipes only */
sem_name = "\\sem\\sem1";
printf(" Create a System Semaphore\n");
ret = DosCreateSem((USHORT) 1,
(PHSEM)&sem_handle,
(PSZ)sem_name);
printf(" DosCreateSem rc = %d\n", ret);
printf(" Initialize the System Semaphore\n");
ret = DosSemSet((HSEM)sem_handle);
printf(" DosSemSet rc = %d\n", ret);
printf("Set named pipe semaphore\n");
ret = DosSetNmPipeSem((HFILE)pipe_handle,
(HSEM)sem_handle,
(USHORT)10); /* pipe number */
printf(" DosSetNmPipeSem rc = %d\n", ret);
/*---------------------------------------------------------*/
printf("Query named pipe semaphore state\n");
ret = DosQNmPipeSemState((HSEM)sem_handle,
/* system semaphore */
(PBYTE)&infobufΓòÆ0Γûá,
/* INFOBUF output */
(USHORT)sizeof(NPSS)*3);
/* Size of INFOBUF */
printf(" DosQNmPipeSemState rc = %d\n", ret);
/*---------------------------------------------------------*/
outbuf = "write a string to the named pipe";
buf_len = strlen(outbuf)+1;
printf("Write a string to named pipe\n");
ret = DosWrite((HFILE)pipe_handle,
(PVOID)outbuf,
(USHORT)buf_len,
(PUSHORT)&bytes_written);
printf(" DosWrite rc = %d\n", ret);
/*-----------------------------------------------------------*/
DosSleep(60000L);
printf("Disconnect named pipe\n");
ret = DosDisConnectNmPipe((HPIPE)pipe_handle);
printf(" DosDisConnectNmPipe rc = %d\n", ret);
/*------------------------------------------------------------*/
printf("Close named pipe\n");
ret = DosClose((HPIPE)pipe_handle);
printf(" DosClose rc = %d\n", ret);
}
ΓòÉΓòÉΓòÉ 9.1.2. L12AP301.C ΓòÉΓòÉΓòÉ
This program accesses the named pipe on a
server machine from a requester
machine.
/************************************************************/
/* */
/* FILE: L12AP301.C */
/* */
/* FUNCTION: Processes IBM OS/2 LAN */
/* NAMED PIPES API CALLS. */
/* This file has to be run on a requester machine while */
/* L12AP300.C runs on a server machine. */
/* Before running the program, make sure that LAN is */
/* started and users are logged on to the server */
/* and the requester. */
/* Named Pipe functions covered in this file: */
/* DosWaitNmPipe, */
/* DosWriteNmPipe, */
/* DosQFHandState, */
/* DosQHandType, */
/* DosDupHandle, */
/* DosBufReset, */
/* DosSetFHandState, */
/* DosQNmPipeInfo, */
/* DosReadAsync. */
/* */
/* Dos functions used in this file: */
/* DosOpen, */
/* DosWrite, */
/* DosRead, */
/* DosSleep, */
/* DosSemset, */
/* DosSemClear, */
/* DosClose. */
/* */
/* Author: Tai C. Beal */
/* Last Edited: 6/7/89 */
/* */
/************************************************************/
#define INCL_DOS#define INCL_DOSSIGNALS
#define INCL_DOSERRORS
/*----------------------------*/
/* include files */
/*----------------------------*/
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
#include <os2.h>
#include <string.h>
#include <memory.h>
HSEM pipe_async_ram_semaphore; /*RAM semaphore */
main(argc,argv)
int argc;
char *argvΓòÆΓûá;
{
char temp1ΓòÆ20Γûá;
char *temp2, *temp3;
PSZ pipe_name;
HFILE pipe_handle;
USHORT ret, waitret;
HFILE open_pipe_handle; /* used by DosOpen to open pipe */
USHORT action_taken, file_size, file_attribute;
USHORT file_open_flag, file_open_mode;
HFILE dup_open_pipe_handle;
PVOID buf, outbuf;
USHORT buf_length, outbuf_len;
USHORT bytes_written, bytesout, bytes_read;
USHORT open_pipe_handle_state;
USHORT hand_type, flag_word;
USHORT file_handle_state;
ULONG timeout;
USHORT pipe_async_return_code;
typedef struct _NPINFO_DATA1 {
/* PipeInfo data block (returned, level 1) */
USHORT npi_obuflen; /* length of outgoing I/O buffer */
USHORT npi_ibuflen; /* length of incoming I/O buffer */
BYTE npi_maxicnt; /* maximum number of instances */
BYTE npi_curicnt; /* current number of instances */
BYTE npi_namlen; /* length of pipe name */
CHAR npi_name[256]; /* start of name */
} NPINFO_DATA1; /* npi_data1 */
NPINFO_DATA1 pipe_info; /* DosQNmPipeInfo */
if (argc !=2 ) {
printf("*** Input syntax:",
" PROC11 Machinename ***\n\n");
printf(" Machinename is the name of the",
" server on which the named pipe is created.\n");
exit(1);
}
strcpy(temp1,"\\\\");
temp2 = strcat(temp1,argv[1]);
pipe_name = strcat(temp1,"\\pipe\\pipe1");
/* use DosOpen to open pipe */
file_size = 0L;
file_attribute = 0;
file_open_flag = 1; /* open existing pipe (file) only */
file_open_mode = 0xB2; /* Deny none access */
/* sharing mode = 2, access mode = 2 */
/* inheritance = 1, private to the current process */
printf("Open named pipe\n");
ret = DosOpen((PSZ)pipe_name,
(PHFILE)&open_pipe_handle,
(PUSHORT)&action_taken,
(ULONG)file_size,
(USHORT)file_attribute,
(USHORT)file_open_flag,
(USHORT)file_open_mode,
0L);
printf(" DosOpen rc = %d\n", ret);
if (ret != 0) {
timeout = 30000L;
waitret = DosWaitNmPipe((PSZ)pipe_name,
(ULONG)timeout);
if (waitret == 0) {
ret = DosOpen((PSZ)pipe_name,
(PHFILE)&open_pipe_handle,
(PUSHORT)&action_taken,
(ULONG)file_size,
(USHORT)file_attribute,
(USHORT)file_open_flag,
(USHORT)file_open_mode,
0L);
if (ret == 0)
printf(" DosOpen rc = %d\n", ret);
else {
printf(" DosOpen rc = %d,",
" failed to open named pipe.\n",ret);
exit(1);
}
} /* endif (waitret == 0) */
else {
printf(" DosWaitNmPipe rc = %d,",
" failed to wait on named pipe.\n",
waitret);
exit(1);
}
} /* end if */
/*-------------------------------------------------------*/
printf("Reset buffer\n");
ret = DosBufReset((HFILE)open_pipe_handle);
printf(" DosBufReset rc = %d\n", ret);
/*--------------------------------------------------------*/
printf("Query file handle state\n");
ret = DosQFHandState((HFILE)open_pipe_handle,
(PUSHORT)&open_pipe_handle_state);
printf(" open_pipe_handle_state = %d\n",
open_pipe_handle_state);
printf(" DosQFHandState rc = %d\n", ret);
/*---------------------------------------------------------*/
printf("Query file handle type\n");
ret = DosQHandType((HFILE)open_pipe_handle,
(PUSHORT)&hand_type,
(PUSHORT)&flag_word);
printf(" DosQHandType rc = %d\n", ret);
/*----------------------------------------------------------*/
buf = "write a string to the named pipe";
buf_length = strlen(buf);
printf("Write a string to named pipe\n");
ret = DosWrite((HFILE)open_pipe_handle,
/* handle returned from DosOpen */
(PVOID)buf,
(USHORT)buf_length,
(PUSHORT)&bytes_written);
printf(" DosWrite rc = %d\n", ret);
/*----------------------------------------------------------*/
printf("Duplicate pipe handle\n");
printf(" open_pipe_handle = %d\n",
open_pipe_handle);
ret = DosDupHandle((HFILE)open_pipe_handle,
(PHFILE)&dup_open_pipe_handle);
printf(" DosDupHandle rc = %d\n", ret);
printf(" dup_open_pipe_handle = %d\n",
dup_open_pipe_handle);
printf("Duplicate pipe handle\n");
printf(" open_pipe_handle = %d\n",
open_pipe_handle);
ret = DosDupHandle((HFILE)open_pipe_handle,
(PHFILE)&dup_open_pipe_handle);
printf(" DosDupHandle rc = %d\n", ret);
printf(" dup_open_pipe_handle = %d\n",
dup_open_pipe_handle);
/*-----------------------------------------------------------*/
printf("Set file handle state\n");
open_pipe_handle_state = 0X4080; /* set W=1, I=1 */
ret = DosSetFHandState((HFILE)open_pipe_handle,
(USHORT)file_handle_state);
printf(" DosSetFHandState rc = %d\n", ret);
/*-------------------------------------------------------------*/
buf = "write another string to the named pipe";
buf_length = strlen(buf);
printf("Write another string to the named pipe",
" using duplicated handle\n");
printf(" dup_open_pipe_handle = %d\n",
dup_open_pipe_handle);
ret = DosWrite((HFILE)dup_open_pipe_handle,
(PVOID)buf,
(USHORT)buf_length,
(PUSHORT)&bytes_written);
printf(" DosWrite rc = %d\n", ret);
/*-------------------------------------------------------------*/
/* RamSemaphore must be set to 0L before it is used */
printf(" Set Ram Semaphore\n");
pipe_async_ram_semaphore = 0L;
ret = DosSemSet((HSEM)&pipe_async_ram_semaphore);
printf(" DosSemSet rc = %d\n", ret);
printf("Read Asynchronously\n");
buf = "read a string from the named pipe";
buf_length = strlen(buf)+1;
ret = DosReadAsync((HFILE)dup_open_pipe_handle, /* input */
(PULONG)&pipe_async_ram_semaphore,
/* input */
(PUSHORT)&pipe_async_return_code,
/* output */
(PVOID)buf,
/* output */
(USHORT)buf_length,
/* input */
(PUSHORT)&bytes_read);
/* output */
printf(" DosReadAsync rc = %d\n", ret);
/*--------------------------------------------------------------*/
printf(" Clear Ram Semaphore\n");
timeout = 10000;
ret = DosSemClear((HSEM)&pipe_async_ram_semaphore);
printf(" DosSemClear rc = %d\n", ret);
/*-------------------------------------------------------------*/
/* sleep so that TEST1 can write data to the named pipe */
DosSleep(40000L);
/*-------------------------------------------------------------*/
printf("Query named pipe info\n");
ret = DosQNmPipeInfo((HFILE)pipe_handle,
(USHORT)1, /* info level */
(PBYTE)&pipe_info,
(USHORT)sizeof(pipe_info));
printf(" DosQNmPipeInfo rc = %d\n", ret);
printf(" npi_obuflen = %d\n", pipe_info.npi_obuflen);
printf(" npi_ibuflen = %d\n", pipe_info.npi_ibuflen);
printf(" npi_maxicnt = %d\n", pipe_info.npi_maxicnt);
printf(" current num icnt = %d\n", pipe_info.npi_curicnt);
printf(" pipename len = %d\n", pipe_info.npi_namlen);
printf(" start of name = %s\n", pipe_info.npi_name);
(CONTINUED)
ΓòÉΓòÉΓòÉ 9.1.3. L12AP301.C (continued) ΓòÉΓòÉΓòÉ
/*------------------------------------------------------------*/
/* read data sent to named pipe by TEST1 DosWrite */
buf = "read a string from the named pipe";
buf_length = strlen(buf)+1;
printf("Read Data from named pipe\n");
ret = DosRead((HFILE)open_pipe_handle, /* input */
(PVOID)buf, /* output */
(USHORT)buf_length, /* input */
(PUSHORT)&bytes_read); /* output */
printf(" DosRead rc = %d\n");
/*-----------------------------------------------------------*/
printf("Close Pipe Handle\n");
ret = DosClose(open_pipe_handle);
printf(" DosClose rc = %d\n", ret);
}
ΓòÉΓòÉΓòÉ 9.1.4. L12AP302.C ΓòÉΓòÉΓòÉ
This program accesses the named pipe on a server machine
from a requester
machine.
/***************************************************************/
/* */
/* FILE: L12AP302.C */
/* */
/* FUNCTION: Processes IBM OS/2 */
/* LAN NAMED PIPES API CALLS. */
/* This file has to be run on a server machine while */
/* L12AP303.C or L12AP304.C runs on a requester machine. */
/* Before running the program, make sure that LAN is */
/* started and users are logged on to the server */
/* and the requester. */
/* */
/* Named Pipe functions covered in this file: */
/* DosMakeNmPipe, */
/* DosConnectNmPipe, */
/* DosDisConnectNmPipe. */
/* */
/* Dos functions used in this file: */
/* DosSleep, */
/* DosWrite, */
/* DosClose. */
/* */
/* Author: Tai C. Beal */
/* Last Edited: 6/7/89 */
/* */
/***************************************************************/
#define INCL_DOS#define INCL_DOSSIGNALS
#define INCL_DOSERRORS
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
#include <os2.h>
#include <string.h>
#include <memory.h>
#define WRT_BEHIND 0x0000 /* default */
#define NO_WRT_BEHIND 0x4000
#define INHERITANCE 0x0000 /* default */
#define NO_INHERITANCE 0x0080
#define ACCESS_INBOUND 0x0000 /* default */
#define ACCESS_OUTBOUND 0x0001
#define ACCESS_DUPLEX 0x0002
#define BLOCK 0x0000 /* & Mask */
#define NO_BLOCK 0x8000 /* Default */
#define T_BYTE_STREAM 0x0000 /* Pipe/Type is Byte Stream*/
#define T_MESSAGE_STREAM 0x0400 /* Pipe/Type is Message Stream*/
#define READ_AND_MASK 0x0300
#define RM_BYTE_STREAM 0x0000 /* Read Mode is Byte Stream*/
#define RM_MESSAGE_STREAM 0x0100 /* Read Mode is Message Stream*/
#define ICNT_AND_MASK 0x00ff
#define ICNT_INFINITE 0xffff
#define ICNT_UNIQUE 0x0001
main()
{
PSZ pipe_name;
HFILE pipe_handle;
USHORT pipe_open_mode;
USHORT pipe_mode;
USHORT outbuf_size;
USHORT inbuf_size;
ULONG timeout;
USHORT ret;
PVOID outbuf;
USHORT buf_len;
USHORT bytes_written;
pipe_name = "\\pipe\\pipe2";
pipe_open_mode = 0;
pipe_mode = 0;
/* set to MESSAGE moce */
pipe_open_mode = WRT_BEHIND | INHERITANCE | ACCESS_DUPLEX;
pipe_mode = BLOCK | T_MESSAGE_STREAM | RM_MESSAGE_STREAM |
0X0020;
outbuf_size = 512;
inbuf_size = 512;
timeout = 50L;
printf("Make a message name pipe\n");
ret = DosMakeNmPipe((PSZ)pipe_name,
(PHFILE)&pipe_handle,
(USHORT)pipe_open_mode,
(USHORT)pipe_mode,
(USHORT)outbuf_size,
(USHORT)inbuf_size,
(ULONG)timeout);
printf(" DosMakeNmPipe rc = %d\n", ret);
/*----------------------------------------------------------*/
printf("Connect named pipe\n");
ret = DosConnectNmPipe(pipe_handle);
printf(" DosConnectNmPipe rc = %d\n", ret);
/*-----------------------------------------------------------*/
ret=DosSleep(20000L);
outbuf = "write a string to the named pipe";
buf_len = strlen(outbuf)+1;
printf("Write a string to the named pipe\n");
ret = DosWrite((HFILE)pipe_handle,
(PVOID)outbuf,
(USHORT)buf_len,
(PUSHORT)&bytes_written);
printf(" DosWrite rc = %d\n", ret);
DosSleep(30000L);
/*-----------------------------------------------------------*/
printf("Disconnect name pipe\n");
ret = DosDisConnectNmPipe((HPIPE)pipe_handle);
printf(" DosDisConnectNmPipe rc = %d\n", ret);
/*-----------------------------------------------------------*/
printf("Close named pipe\n");
ret = DosClose((HPIPE)pipe_handle);
printf(" DosClose rc = %d\n", ret);
}
ΓòÉΓòÉΓòÉ 9.1.5. L12AP303.C ΓòÉΓòÉΓòÉ
This program accesses the named pipe on a server machine from a requester
machine.
/*************************************************************/
/* */
/* FILE: L12AP303.C */
/* */
/* FUNCTION: Processes IBM OS/2 LAN */
/* NAMED PIPES API CALLS. */
/* This file has to be run on a requester machine while */
/* L12AP302.C runs on a server machine. */
/* Before running the program, make sure that LAN is */
/* started and users are logged on to the server and the */
/* requester. */
/* */
/* Named Pipe functions covered in this file: */
/* DosWaitNmpipe, */
/* DosTransactNmPipe. */
/* */
/* Dos functions used in this file: */
/* DosOpen, */
/* DosClose. */
/* */
/* Author: Tai C. Beal */
/* Last Edited: 6/7/89 */
/* */
/*************************************************************/
/*-------------------------------*/
/* include files */
/*-------------------------------*/
#define INCL_DOS#define INCL_DOSSIGNALS
#define INCL_DOSERRORS
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
#include <os2.h>
#include <string.h>
#include <memory.h>
main(argc,argv)
int argc;
char *argvΓòÆΓûá;
{
char temp1[20];
char *temp2, *temp3;
PSZ pipe_name;
HFILE pipe_handle;
USHORT ret, waitret;
HFILE open_pipe_handle; /*used by DosOpen to open pipe */
USHORT action_taken, file_size, file_attribute;
USHORT file_open_flag, file_open_mode;
HFILE dup_open_pipe_handle;
ULONG timeout;
PVOID inbuf, outbuf;
USHORT inbuf_len, outbuf_len;
USHORT bytesout, bytes_written;
if (argc !=2 ) {
printf("*** Input syntax: PROC21",
" Machinename ***\n\n");
printf(" Machinename is the name of ",
"the server on which the named pipe is created.\n");
exit(1);
}
strcpy(temp1,"\\\\");
temp2 = strcat(temp1,argv[1]);
pipe_name = strcat(temp1,"\\pipe\\pipe2");
/* use DosOpen to open pipe */
file_size = 0L;
file_attribute = 0;
file_open_flag = 1; /* open existing pipe (file) only */
file_open_mode = 0xB2; /* Deny none access */
/* sharing mode = 2, access mode = 2 */
/* inheritance = 1, private to the current process */
printf("Open named pipe\n");
ret = DosOpen((PSZ)pipe_name,
(PHFILE)&open_pipe_handle,
(PUSHORT)&action_taken,
(ULONG)file_size,
(USHORT)file_attribute,
(USHORT)file_open_flag,
(USHORT)file_open_mode,
0L);
printf(" DosOpen rc = %d\n", ret);
if (ret != 0) {
timeout = 30000L;
waitret = DosWaitNmPipe((PSZ)pipe_name,
(ULONG)timeout);
if (waitret == 0) {
ret = DosOpen((PSZ)pipe_name,
(PHFILE)&open_pipe_handle,
(PUSHORT)&action_taken,
(ULONG)file_size,
(USHORT)file_attribute,
(USHORT)file_open_flag,
(USHORT)file_open_mode,
0L);
if (ret == 0)
printf(" DosOpen rc = %d\n", ret);
else {
printf(" DosOpen rc = %d, failed to open",
" named pipe.\n",ret);
exit(1);
}
} /* endif (waitret == 0) */
else {
printf(" DosWaitNmPipe rc = %d, ",
"failed to wait on named pipe.\n",
waitret);
exit(1);
}
} /* end if */
/*------------------------------------------------------*/
inbuf = "Write a string to the named pipe";
inbuf_len = strlen(inbuf)+1;
outbuf = (PVOID)malloc(sizeof(inbuf)+1);
outbuf_len = inbuf_len;
printf("Performs a write/read tranaction\n");
ret = DosTransactNmPipe((HFILE)open_pipe_handle,
(PVOID)inbuf,
(USHORT)inbuf_len,
(PVOID)outbuf,
(USHORT)outbuf_len,
(PUSHORT)&bytesout);
printf(" DosTransactNmPipe rc = %d\n", ret);
printf(" bytesout = %d\n", bytesout);
/*--------------------------------------------------------*/
DosSleep(10000L);
printf("Close Pipe Handle\n");
ret = DosClose(open_pipe_handle);
printf(" DosClose rc = %d\n", ret);
}
ΓòÉΓòÉΓòÉ 9.1.6. L12AP304.C ΓòÉΓòÉΓòÉ
This program accesses the named pipe on a server machine from a requester
machine.
/*************************************************************/
/* */
/* FILE: L12AP304.C */
/* */
/* FUNCTION: Processes IBM OS/2 LAN */
/* NAMED PIPES API CALLS. */
/* This file has to be run on a requester machine while */
/* L12AP302.C runs on a server machine. */
/* Before running the program, make sure that LAN is */
/* started and users are logged on to the server and the */
/* requester. */
/* */
/* Named Pipe functions covered in this file: */
/* DosCallNmPipe. */
/* */
/* Author: Tai C. Beal */
/* Last Edited: 6/7/89 */
/* */
/*************************************************************/
/*-------------------------------*/
/* include files */
/*-------------------------------*/
#define INCL_DOS#define INCL_DOSSIGNALS
#define INCL_DOSERRORS
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
#include <os2.h>
#include <string.h>
#include <memory.h>
main(argc,argv)
int argc;
char *argvΓòÆΓûá;
{
char temp1ΓòÆ20Γûá;
char *temp2, *temp3;
PSZ pipe_name;
ULONG time_out;
PCH buf, outbuf;
USHORT buf_length, outbuf_len, bytesout;
USHORT ret;
/* this call is intended for use only on duplex message pipes */
if (argc !=2 ) {
printf("*** Input syntax: PROC22",
" Machinename ***\n\n");
printf(" Machinename is the name of the ",
"server on which the named pipe is created.\n");
exit(1);
}
strcpy(temp1,"\\\\");
temp2 = strcat(temp1,argvΓòÆ1Γûá);
pipe_name = strcat(temp1,"\\pipe\\pipe2");
/* pipe_name = "\\\\b-7-4\\pipe\\pipe2"; */
printf("Call name pipe to open, close and transact\n");
time_out = 30000L;
buf = "write buffer address ";
buf_length = strlen(buf);
outbuf = " read buffer address ";
outbuf_len = strlen(outbuf);
ret = DosCallNmPipe((PSZ)pipe_name,
/* Pipe Name */
(PCH)buf,
/* Write Buffer Address */
(USHORT)buf_length,
/* Write Buffer Length */
(PCH)outbuf,
/* Read Buffer Address */
(USHORT)outbuf_len,
/* Read Buffer Length */
(PUSHORT)&bytesout,
/* Bytes Read (returned) */
(ULONG)time_out);
/* Max Wait Time */
printf(" DosCallNmPipe rc = %d\n", ret);
}
ΓòÉΓòÉΓòÉ 9.1.7. L12AP305.C ΓòÉΓòÉΓòÉ
This program accesses the named pipe on a server machine from a requester
machine.
/*************************************************************/
/* */
/* FILE: L12AP305.C */
/* */
/* FUNCTION: Processes IBM OS/2 LAN */
/* NAMED PIPES API CALLS. */
/* This file has to be run on a requester machine while */
/* L12AP306.C runs on a requester machine. */
/* Before running the program, make sure that LAN is */
/* started and users are logged on to the server and the */
/* requester. */
/* */
/* Named Pipe functions covered in this file: */
/* DosMakeNmPipe, */
/* DosConnectNmPipe, */
/* DosDisConnectNmPipe. */
/* */
/* Dos functions used in this file: */
/* DosSleep, */
/* DosClose. */
/* */
/* Author: Tai C. Beal */
/* Last Edited: 6/7/89 */
/* */
/*************************************************************/
#define INCL_DOS#define INCL_DOSSIGNALS
#define INCL_DOSERRORS
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
#include <os2.h>
#include <string.h>
#include <memory.h>
#define WRT_BEHIND 0x0000 /* default */
#define NO_WRT_BEHIND 0x4000
#define INHERITANCE 0x0000 /* default */
#define NO_INHERITANCE 0x0080
#define ACCESS_INBOUND 0x0000 /* default */
#define ACCESS_OUTBOUND 0x0001
#define ACCESS_DUPLEX 0x0002
#define BLOCK 0x0000 /* & Mask */
#define NO_BLOCK 0x8000 /* Default */
#define T_BYTE_STREAM 0x0000
/* Pipe/Type is Byte Stream */
#define T_MESSAGE_STREAM 0x0400
/* Pipe/Type is Message Stream */
#define READ_AND_MASK 0x0300
#define RM_BYTE_STREAM 0x0000
/* Read Mode is Byte Stream */
#define RM_MESSAGE_STREAM 0x0100
/* Read Mode is Message Stream */
#define ICNT_AND_MASK 0x00ff
#define ICNT_INFINITE 0xffff
#define ICNT_UNIQUE 0x0001
main()
{
PSZ pipe_name;
HFILE pipe_handle;
USHORT pipe_open_mode;
USHORT pipe_mode;
USHORT outbuf_size;
USHORT inbuf_size;
ULONG timeout;
USHORT ret;
PVOID outbuf;
USHORT buf_len;
USHORT bytes_written;
pipe_name = "\\pipe\\pipe3";
pipe_open_mode = 0;
pipe_mode = 0;
/* set to MESSAGE moce */
pipe_open_mode = WRT_BEHIND | INHERITANCE | ACCESS_DUPLEX;
pipe_mode = BLOCK | T_MESSAGE_STREAM | RM_MESSAGE_STREAM
| 0X0020;
outbuf_size = 512;
inbuf_size = 512;
timeout = 50L;
printf("Make a message name pipe\n");
ret = DosMakeNmPipe((PSZ)pipe_name,
(PHFILE)&pipe_handle,
(USHORT)pipe_open_mode,
(USHORT)pipe_mode,
(USHORT)outbuf_size,
(USHORT)inbuf_size,
(ULONG)timeout);
printf(" DosMakeNmPipe rc = %d\n", ret);
/*-----------------------------------------------------------*/
printf("Connect named pipe\n");
ret = DosConnectNmPipe(pipe_handle);
printf(" DosConnectNmPipe rc = %d\n", ret);
/*------------------------------------------------------------*/
ret = DosSleep(50000L);
/*------------------------------------------------------------*/
printf("Disconnect name pipe\n");
ret = DosDisConnectNmPipe((HPIPE)pipe_handle);
printf(" DosDisConnectNmPipe rc = %d\n", ret);
/*------------------------------------------------------------*/
printf("Close named pipe\n");
ret = DosClose((HPIPE)pipe_handle);
printf(" DosClose rc = %d\n", ret);
}
ΓòÉΓòÉΓòÉ 9.1.8. L12AP306.C ΓòÉΓòÉΓòÉ
This program accesses the named pipe on a server machine from a requester
machine.
/*************************************************************/
/* */
/* FILE: L12AP306.C */
/* */
/* FUNCTION: Processes IBM OS/2 LAN */
/* NAMED PIPES API CALLS. */
/* This file has to be run on a requester machine while */
/* L12AP305.C runs on a server machine. */
/* Before running the program, make sure that LAN is */
/* started and users are logged on to the server and the */
/* requester. */
/* */
/* Dos functions covered in this file: */
/* DosOpen, */
/* DosSemSet, */
/* DosWriteAsync, */
/* DosSemClear, */
/* DosClose. */
/* */
/* Author: Tai C. Beal */
/* Last Edited: 6/7/89 */
/* */
/*************************************************************/
/*-------------------------------*/
/* include files */
/*-------------------------------*/
#define INCL_DOS#define INCL_DOSSIGNALS
#define INCL_DOSERRORS
#define INCL_DOSSEMAPHORES
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
#include <os2.h>
#include <string.h>
#include <memory.h>
HSEM pipe_async_ram_semaphore; /*RAM semaphore */
/* taking machine names from the keyboard
causes error 4880, or 4870 */
/*
main(argc,argv)
int argc;
char *argv[];
{
char temp1[20];
char *temp2, *temp3;
*/
main()
{
PSZ pipe_name;
HFILE pipe_handle;
USHORT ret, waitret;
HFILE open_pipe_handle; /* used by DosOpen to open pipe */
USHORT action_taken, file_size, file_attribute;
USHORT file_open_flag, file_open_mode;
PVOID outbuf;
USHORT outbuf_len;
USHORT bytes_written;
ULONG timeout;
USHORT pipe_async_return_code;
pipe_name = "\\\\b-7-4\\pipe\\pipe3";
/* use DosOpen to open pipe */
file_size = 0L;
file_attribute = 0;
file_open_flag = 1; /* open existing pipe (file) only */
file_open_mode = 0xB2; /* Deny none access */
/* sharing mode = 2, access mode = 2 */
/* inheritance = 1, private to the current process */
printf("Open named pipe\n");
ret = DosOpen((PSZ)pipe_name,
(PHFILE)&open_pipe_handle,
(PUSHORT)&action_taken,
(ULONG)file_size,
(USHORT)file_attribute,
(USHORT)file_open_flag,
(USHORT)file_open_mode,
0L);
printf(" DosOpen rc = %d\n", ret);
if (ret != 0) {
timeout = 30000L;
waitret = DosWaitNmPipe((PSZ)pipe_name,
(ULONG)timeout);
if (waitret == 0) {
ret = DosOpen((PSZ)pipe_name,
(PHFILE)&open_pipe_handle,
(PUSHORT)&action_taken,
(ULONG)file_size,
(USHORT)file_attribute,
(USHORT)file_open_flag,
(USHORT)file_open_mode,
0L);
if (ret == 0)
printf(" DosOpen rc = %d\n", ret);
else {
printf(" DosOpen rc = %d, failed",
" to open named pipe.\n",ret);
exit(1);
}
} /* endif (waitret == 0) */
else {
printf(" DosWaitNmPipe rc = %d,",
"failed to wait on named pipe.\n",
waitret);
exit(1);
}
} /* end if */
/*---------- --------------------------------------------*/
/* RamSemaphore must be set to 0L before it is used */
printf(" Set Ram Semaphore\n");
pipe_async_ram_semaphore = 0L;
ret = DosSemSet((HSEM)&pipe_async_ram_semaphore);
printf(" DosSemSet rc = %d\n", ret);
outbuf = "Write a string to the named pipe\n";
outbuf_len = strlen(outbuf)+1;
printf("Write asynchronously\n");
ret =DosWriteAsync((HFILE)open_pipe_handle,
(PULONG)&pipe_async_ram_semaphore,
(PUSHORT)&pipe_async_return_code,
(PVOID)outbuf,
(USHORT)outbuf_len,
(PUSHORT)&bytes_written);
printf(" DosWriteAsync rc = %d\n");
printf(" Clear Ram Semaphore\n");
timeout = 10000;
ret = DosSemClear((HSEM)&pipe_async_ram_semaphore);
printf(" DosSemClear rc = %d\n", ret);
/*-----------------------------------------------------------*/
printf("Close Pipe Handle\n");
ret = DosClose(open_pipe_handle);
printf(" DosClose rc = %d\n", ret);
}
ΓòÉΓòÉΓòÉ 9.1.9. L12AP307.C ΓòÉΓòÉΓòÉ
This program accesses the named pipe on a server machine from a requester
machine.
/*************************************************************/
/* FILE: L12AP307.C */
/* */
/* FUNCTION: Processes IBM OS/2 LAN */
/* NAMED PIPES API CALLS. */
/* This file has to be run on a requester machine while */
/* L12AP308.C runs on a requester machine. */
/* Before running the program, make sure that LAN is */
/* started and users are logged on to the server and the */
/* requester. */
/* Long filename is tested in this program. */
/* */
/* Named Pipe functions covered in this file: */
/* DosMakeNmPipe, */
/* DosSetNmPHandState, */
/* DosConnectNmPipe, */
/* DosPeekNmPipe, */
/* DosQNmPHandState, */
/* DosQNmPipeInfo, */
/* DosSetNmPipeSem, */
/* DosQNmPipeSemState, */
/* DosDisConnectNmPipe. */
/* */
/* Dos functions used in this file: */
/* DosSleep, */
/* DosWrite, */
/* DosCreateSem, */
/* DosClose. */
/* */
/* Author: Tai C. Beal */
/* Last Edited: 6/7/89 */
/* */
/*************************************************************/
/*-------------------------------*/
/* include files */
/*-------------------------------*/
#define INCL_DOS#define INCL_DOSSIGNALS
#define INCL_DOSERRORS
#define INCL_DOSSEMAPHORES
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
#include <os2.h>
#include <memory.h>
#define WRT_BEHIND 0x0000 /* default */
#define NO_WRT_BEHIND 0x4000
#define INHERITANCE 0x0000 /* default */
#define NO_INHERITANCE 0x0080
#define ACCESS_INBOUND 0x0000 /* default */
#define ACCESS_OUTBOUND 0x0001
#define ACCESS_DUPLEX 0x0002
#define BLOCK 0x0000 /* & Mask */
#define NO_BLOCK 0x8000 /* Default */
#define EPO_SERVER 0x4000 /* & Mask */
#define EPO_CLIENT 0x0000 /* Default */
#define TYPE_AND_MASK 0x0c00
#define T_BYTE_STREAM 0x0000
/* Pipe/Type is Byte Stream */
#define T_MESSAGE_STREAM 0x0400
/* Pipe/Type is Message Stream */
#define READ_AND_MASK 0x0300
#define RM_BYTE_STREAM 0x0000
/* Read Mode is Byte Stream */
#define RM_MESSAGE_STREAM 0x0100
/* Read Mode is Message Stream */
#define ICNT_AND_MASK 0x00ff
#define ICNT_INFINITE 0xffff
#define ICNT_UNIQUE 0x0001
typedef struct _NPSS
{ /* QNmPipeSemState information record */
BYTE npss_status;
/* type of record, 0 = EOI, 1 = read ok,
* 2 = write ok, 3 = pipe closed */
BYTE npss_flag;
/* additional info, 01 = waiting thread */
USHORT npss_key;
/* user's key value */
USHORT npss_avail;
/* available data/space if status = 1/2 */
} NPSS; /* npss */
main()
{
PSZ pipe_name;
HFILE pipe_handle;
USHORT pipe_open_mode;
USHORT pipe_mode;
USHORT outbuf_size;
USHORT inbuf_size;
ULONG timeout;
USHORT ret;
HFILE open_pipe_handle;
/* used by DosOpen to open pipe */
USHORT action_taken, file_size, file_attribute;
USHORT file_open_flag, file_open_mode;
ULONG time_out; /* used by DosWrite */
PVOID outbuf;
USHORT buf_len;
USHORT bytes_written;
PCH inbuf, write_buf;
USHORT inbuf_len, outbuf_len, max_data_size;
USHORT bytesout;
BYTE output_buf; /* DosPeekNmPipe */
USHORT bytes_to_be_written;
USHORT bytes_read, bytes_avail;
USHORT pipe_state;
typedef struct _NPINFO_DATA1 {
/* PipeInfo data block (returned, level 1) */
USHORT npi_obuflen; /* length of outgoing I/O buffer */
USHORT npi_ibuflen; /* length of incoming I/O buffer */
BYTE npi_maxicnt; /* maximum number of instances */
BYTE npi_curicnt; /* current number of instances */
BYTE npi_namlen; /* length of pipe name */
CHAR npi_name[256]; /* start of name */
} NPINFO_DATA1; /* npi_data1 */
NPINFO_DATA1 pipe_info; /* DosQNmPipeInfo */
USHORT handle_type, flag_word;
USHORT pipe_hand_state;
HSEM sem_handle;
PSZ sem_name;
NPSS infobufΓòÆ3Γûá;
pipe_name = "\\pipe\\a-real-long-pipe-name.pipe4.";
pipe_open_mode = 0;
pipe_mode = 0;
/* set pipe mode to MESSAGE mode, and allow DUPLEX access */
pipe_open_mode = WRT_BEHIND | INHERITANCE | ACCESS_DUPLEX;
pipe_mode = BLOCK | T_MESSAGE_STREAM | RM_MESSAGE_STREAM
| 0X0020;
outbuf_size = 512;
inbuf_size = 512;
timeout = 50L;
printf("Make named pipe\n");
ret = DosMakeNmPipe((PSZ)pipe_name,
(PHFILE)&pipe_handle,
(USHORT)pipe_open_mode,
(USHORT)pipe_mode,
(USHORT)outbuf_size,
(USHORT)inbuf_size,
(ULONG)timeout);
printf(" DosMakeNmPipe rc = %d\n", ret);
/*-----------------------------------------------------------*/
printf("Set name pipe handle state\n");
ret = DosSetNmPHandState((HFILE)pipe_handle,
(USHORT)0x0100);
/* message stream */
printf(" DosSetNmPHandState rc = %d\n", ret);
ret = DosSetNmPHandState((HFILE)pipe_handle,
(USHORT)0x0000);
/* byte stream */
printf(" DosSetNmPHandState rc = %d\n", ret);
/*-----------------------------------------------------------*/
printf("Connect named pipe\n");
ret = DosConnectNmPipe(pipe_handle);
printf(" DosConnectNmPipe rc = %d\n", ret);
/*-----------------------------------------------------------*/
/* outbuf = (PBYTE)malloc(512); */
bytes_to_be_written = 512;
printf("Peek named pipe\n");
ret = DosPeekNmPipe((HFILE)pipe_handle,
(PBYTE)&output_buf,
(USHORT)bytes_to_be_written,
(PUSHORT)&bytes_read,
(PUSHORT)&bytes_avail,
(PUSHORT)&pipe_state);
printf(" DosPeekNmPipe rc = %d\n", ret);
/*-----------------------------------------------------------*/
printf("Query named pipe handle state\n");
ret = DosQNmPHandState((HFILE)pipe_handle,
(PUSHORT)&pipe_hand_state);
printf(" DosQNmPHandState rc = %d\n", ret);
/*------------------------------------------------------------*/
printf("Query named pipe info\n");
ret = DosQNmPipeInfo((HFILE)pipe_handle,
(USHORT)1, /* info level */
(PBYTE)&pipe_info,
(USHORT)sizeof(pipe_info));
printf(" DosQNmPipeInfo rc = %d\n", ret);
/*-----------------------------------------------------------*/
ret = DosSleep(20000L);
/*------------------------------------------------------------*/
outbuf = "write a string to the named pipe";
buf_len = strlen(outbuf)+1;
printf("Write a string to named pipe\n");
ret = DosWrite((HFILE)pipe_handle,
(PVOID)outbuf,
(USHORT)buf_len,
(PUSHORT)&bytes_written);
printf(" DosWrite rc = %d\n", ret);
/*------------------------------------------------------------*/
ret = DosSleep(20000L);
/*----------------------------------------------------------*/
/* DosSetNmPipeSem call works for local named pipes only */
sem_name = "\\sem\\sem1";
printf(" Create a System Semaphore\n");
ret = DosCreateSem((USHORT) 1,
(PHSEM)&sem_handle,
(PSZ)sem_name);
printf(" DosCreateSem rc = %d\n", ret);
printf(" Initialize the System Semaphore\n");
ret = DosSemSet((HSEM)sem_handle);
printf(" DosSemSet rc = %d\n", ret);
printf("Set named pipe semaphore\n");
ret = DosSetNmPipeSem((HFILE)pipe_handle,
(HSEM)sem_handle,
(USHORT)10); /* pipe number */
printf(" DosSetNmPipeSem rc = %d\n", ret);
/*--------------------------------------------------------*/
printf("Query named pipe semaphore state\n");
ret = DosQNmPipeSemState((HSEM)sem_handle,
/* system semaphore */
(PBYTE)&infobuf[0],
/* INFOBUF output */
(USHORT)sizeof(NPSS)*3);
/* Size of INFOBUF */
printf(" DosQNmPipeSemState rc = %d\n", ret);
/*--------------------------------------------------------*/
outbuf = "write a string to the named pipe";
buf_len = strlen(outbuf)+1;
printf("Write a string to named pipe\n");
ret = DosWrite((HFILE)pipe_handle,
(PVOID)outbuf,
(USHORT)buf_len,
(PUSHORT)&bytes_written);
printf(" DosWrite rc = %d\n", ret);
/*-------------------------------------------------------*/
DosSleep(60000L);
printf("Disconnect named pipe\n");
ret = DosDisConnectNmPipe((HPIPE)pipe_handle);
printf(" DosDisConnectNmPipe rc = %d\n", ret);
/*-------------------------------------------------------*/
printf("Close named pipe\n");
ret = DosClose((HPIPE)pipe_handle);
printf(" DosClose rc = %d\n", ret);
}
ΓòÉΓòÉΓòÉ 9.1.10. L12AP308.C ΓòÉΓòÉΓòÉ
This program accesses the named pipe on a server machine from a requester
machine.
/*************************************************************/
/* */
/* FILE: L12AP308.C */
/* */
/* FUNCTION: Processes IBM OS/2 LAN */
/* NAMED PIPES API CALLS. */
/* This file has to be run on a requester machine while */
/* L12AP307.C runs on a server machine. */
/* Before running the program, make sure that LAN is */
/* started and users are logged on to the server and the */
/* requester. */
/* Long filename is tested in this program. */
/* */
/* Named Pipe functions covered in this file: */
/* DosWaitNmPipe, */
/* DosWriteNmPipe, */
/* DosQFHandState, */
/* DosQHandType, */
/* DosDupHandle, */
/* DosBufReset, */
/* DosSetFHandState, */
/* DosQNmPipeInfo, */
/* DosReadAsync. */
/* */
/* Dos functions used in this file: */
/* DosOpen, */
/* DosWrite, */
/* DosRead, */
/* DosSleep, */
/* DosSemset, */
/* DosSemClear, */
/* DosClose. */
/* */
/* Author: Tai C. Beal */
/* Last Edited: 6/7/89 */
/* */
/*************************************************************/
#define INCL_DOS#define INCL_DOSSIGNALS
#define INCL_DOSERRORS
/*----------------------------*/
/* include files */
/*----------------------------*/
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
#include <os2.h>
#include <string.h>
#include <memory.h>
HSEM pipe_async_ram_semaphore; /*RAM semaphore */
main(argc,argv)
int argc;
char *argvΓòÆΓûá;
{
char temp1ΓòÆ100Γûá;
char *temp2, *temp3;
PSZ pipe_name;
HFILE pipe_handle;
USHORT ret, waitret;
HFILE open_pipe_handle; /* used by DosOpen to open pipe */
USHORT action_taken, file_size, file_attribute;
USHORT file_open_flag, file_open_mode;
HFILE dup_open_pipe_handle;
PVOID buf, outbuf;
USHORT buf_length, outbuf_len;
USHORT bytes_written, bytesout, bytes_read;
USHORT open_pipe_handle_state;
USHORT hand_type, flag_word;
USHORT file_handle_state;
ULONG timeout;
USHORT pipe_async_return_code;
typedef struct _NPINFO_DATA1 {
/* PipeInfo data block (returned, level 1) */
USHORT npi_obuflen; /* length of outgoing I/O buffer */
USHORT npi_ibuflen; /* length of incoming I/O buffer */
BYTE npi_maxicnt; /* maximum number of instances */
BYTE npi_curicnt; /* current number of instances */
BYTE npi_namlen; /* length of pipe name */
CHAR npi_name[256]; /* start of name */
} NPINFO_DATA1; /* npi_data1 */
NPINFO_DATA1 pipe_info; /* DosQNmPipeInfo */
if (argc !=2 ) {
printf("*** Input syntax: ",
"PROC41 Machinename ***\n\n");
printf(" Machinename is the name of",
" the server on which the named pipe is created.\n");
exit(1);
}
strcpy(temp1,"\\\\");
temp2 = strcat(temp1,argv[1]);
pipe_name = strcat(temp1,
"\\pipe\\a-real-long-pipe-name.pipe4.");
/* use DosOpen to open pipe */
file_size = 0L;
file_attribute = 0;
file_open_flag = 1; /* open existing pipe (file) only */
file_open_mode = 0xB2; /* Deny none access */
/* sharing mode = 2, access mode = 2 */
/* inheritance = 1, private to the current process */
printf("Open named pipe\n");
ret = DosOpen((PSZ)pipe_name,
(PHFILE)&open_pipe_handle,
(PUSHORT)&action_taken,
(ULONG)file_size,
(USHORT)file_attribute,
(USHORT)file_open_flag,
(USHORT)file_open_mode,
0L);
printf(" DosOpen rc = %d\n", ret);
if (ret != 0) {
timeout = 30000L;
waitret = DosWaitNmPipe((PSZ)pipe_name,
(ULONG)timeout);
if (waitret == 0) {
ret = DosOpen((PSZ)pipe_name,
(PHFILE)&open_pipe_handle,
(PUSHORT)&action_taken,
(ULONG)file_size,
(USHORT)file_attribute,
(USHORT)file_open_flag,
(USHORT)file_open_mode,
0L);
if (ret == 0)
printf(" DosOpen rc = %d\n", ret);
else {
printf(" DosOpen rc = %d, ",
"failed to open named pipe.\n",ret);
exit(1);
}
} /* endif (waitret == 0) */
else {
printf(" DosWaitNmPipe rc = %d,",
" failed to wait on named pipe.\n",
waitret);
exit(1);
}
} /* end if */
/*------------------------------------------------------*/
printf("Reset buffer\n");
ret = DosBufReset((HFILE)open_pipe_handle);
printf(" DosBufReset rc = %d\n", ret);
/*------------------------------------------------------*/
printf("Query file handle state\n");
ret = DosQFHandState((HFILE)open_pipe_handle,
(PUSHORT)&open_pipe_handle_state);
printf(" open_pipe_handle_state = %d\n",
open_pipe_handle_state);
printf(" DosQFHandState rc = %d\n", ret);
/*-------------------------------------------------------*/
printf("Query file handle type\n");
ret = DosQHandType((HFILE)open_pipe_handle,
(PUSHORT)&hand_type,
(PUSHORT)&flag_word);
printf(" DosQHandType rc = %d\n", ret);
/*--------------------------------------------------------*/
buf = "write a string to the named pipe";
buf_length = strlen(buf);
printf("Write a string to named pipe\n");
ret = DosWrite((HFILE)open_pipe_handle,
/* handle returned from DosOpen */
(PVOID)buf,
(USHORT)buf_length,
(PUSHORT)&bytes_written);
printf(" DosWrite rc = %d\n", ret);
/*----------------------------------------------------------*/
printf("Duplicate pipe handle\n");
printf(" open_pipe_handle = %d\n",
open_pipe_handle);
ret = DosDupHandle((HFILE)open_pipe_handle,
(PHFILE)&dup_open_pipe_handle);
printf(" DosDupHandle rc = %d\n", ret);
printf(" dup_open_pipe_handle = %d\n",
dup_open_pipe_handle);
printf("Duplicate pipe handle\n");
printf(" open_pipe_handle = %d\n",
open_pipe_handle);
ret = DosDupHandle((HFILE)open_pipe_handle,
(PHFILE)&dup_open_pipe_handle);
printf(" DosDupHandle rc = %d\n", ret);
printf(" dup_open_pipe_handle = %d\n",
dup_open_pipe_handle);
/*------------------------------------------------------------*/
printf("Set file handle state\n");
open_pipe_handle_state = 0X4080; /* set W=1, I=1 */
ret = DosSetFHandState((HFILE)open_pipe_handle,
(USHORT)file_handle_state);
printf(" DosSetFHandState rc = %d\n", ret);
/*----------------------------------------------------------*/
buf = "write another string to the named pipe";
buf_length = strlen(buf);
printf("Write another string to the",
" named pipe using duplicated handle\n");
printf(" dup_open_pipe_handle = %d\n",
dup_open_pipe_handle);
ret = DosWrite((HFILE)dup_open_pipe_handle,
(PVOID)buf,
(USHORT)buf_length,
(PUSHORT)&bytes_written);
printf(" DosWrite rc = %d\n", ret);
/*-----------------------------------------------------------*/
/* RamSemaphore must be set to 0L before it is used */
printf(" Set Ram Semaphore\n");
pipe_async_ram_semaphore = 0L;
ret = DosSemSet((HSEM)&pipe_async_ram_semaphore);
printf(" DosSemSet rc = %d\n", ret);
printf("Read Asynchronously\n");
buf = "read a string from the named pipe";
buf_length = strlen(buf)+1;
ret = DosReadAsync((HFILE)dup_open_pipe_handle,
/* input */
(PULONG)&pipe_async_ram_semaphore,
/* input */
(PUSHORT)&pipe_async_return_code,
/* output */
(PVOID)buf,
/* output */
(USHORT)buf_length,
/* input */
(PUSHORT)&bytes_read);
/* output */
printf(" DosReadAsync rc = %d\n", ret);
/*----------------------------------------------------------*/
printf(" Clear Ram Semaphore\n");
timeout = 10000;
ret = DosSemClear((HSEM)&pipe_async_ram_semaphore);
printf(" DosSemClear rc = %d\n", ret);
/*-----------------------------------------------------------*/
/* sleep so that TEST1 can write data to the named pipe */
DosSleep(40000L);
/*-----------------------------------------------------------*/
printf("Query named pipe info\n");
ret = DosQNmPipeInfo((HFILE)pipe_handle,
(USHORT)1,
/* info level */
(PBYTE)&pipe_info,
(USHORT)sizeof(pipe_info));
printf(" DosQNmPipeInfo rc = %d\n", ret);
printf(" npi_obuflen = %d\n", pipe_info.npi_obuflen);
printf(" npi_ibuflen = %d\n", pipe_info.npi_ibuflen);
printf(" npi_maxicnt = %d\n", pipe_info.npi_maxicnt);
printf(" current num icnt = %d\n", pipe_info.npi_curicnt);
printf(" pipename len = %d\n", pipe_info.npi_namlen);
printf(" start of name = %s\n", pipe_info.npi_name);
(CONTINUED)
ΓòÉΓòÉΓòÉ 9.1.11. L12AP308.C (continued) ΓòÉΓòÉΓòÉ
/*-----------------------------------------------------------*/
/* read data sent to named pipe by TEST1 DosWrite */
buf = "read a string from the named pipe";
buf_length = strlen(buf)+1;
printf("Read Data from named pipe\n");
ret = DosRead((HFILE)open_pipe_handle,
/* input */
(PVOID)buf,
/* output */
(USHORT)buf_length,
/* input */
(PUSHORT)&bytes_read);
/* output */
printf(" DosRead rc = %d\n");
/*------------------------------------------------------*/
printf("Close Pipe Handle\n");
ret = DosClose(open_pipe_handle);
printf(" DosClose rc = %d\n", ret);
}
ΓòÉΓòÉΓòÉ 10. Glossary ΓòÉΓòÉΓòÉ
Contains Definitions of terms frequently used in this document .
ΓòÉΓòÉΓòÉ 10.1. API ΓòÉΓòÉΓòÉ
API
Application Programming Interface .
ΓòÉΓòÉΓòÉ 10.2. APPC ΓòÉΓòÉΓòÉ
APPC
Advanced Program to Program Communication . A version of the SNA
architecture . OS / 2 Extended Edition supports the API defined by
this architecture .
ΓòÉΓòÉΓòÉ 10.3. Communications Manager ΓòÉΓòÉΓòÉ
Communications Manager
The portion of OS / 2 EE which provides access to many of the
communications attachments provided for the PC .
ΓòÉΓòÉΓòÉ 10.4. DLL ΓòÉΓòÉΓòÉ
DLL
Dynamic Link Library . This provides a way of linking to code
routines at run time , allowing the routines to be contained in
different executable files .
ΓòÉΓòÉΓòÉ 10.5. DLR ΓòÉΓòÉΓòÉ
DLR
Dynamic Link Routine . A code routine which is contained in a
dynamic link library .
ΓòÉΓòÉΓòÉ 10.6. EHLLAPI ΓòÉΓòÉΓòÉ
EHLLAPI
Emulator High Level Language API . This API allows application
programs running in an OS / 2 protect mode screen group to access
the functions provided by the 3270 Emulation portion of the
Communications Manager .
ΓòÉΓòÉΓòÉ 10.7. Error Level ΓòÉΓòÉΓòÉ
Error Level
Refers to the return code which is passed to the Operating System
when a program ends . The error level can be tested in a batch (
command ) file to decide how to proceed . Normally , an error level
of zero indicates successful completion of a program , and a non -
zero error level means that an error has occurred .
ΓòÉΓòÉΓòÉ 10.8. ERRORLEVEL ΓòÉΓòÉΓòÉ
ERRORLEVEL
See Error Level
ΓòÉΓòÉΓòÉ 10.9. Extended Edition ΓòÉΓòÉΓòÉ
Extended Edition
See OS / 2 Extended Edition .
ΓòÉΓòÉΓòÉ 10.10. IEEE ΓòÉΓòÉΓòÉ
IEEE
Institute of Electrical and Electronic Engineers . An international
standards organization . They produced the IEEE 802 . 2 standard which
is supported by OS / 2 EE .
ΓòÉΓòÉΓòÉ 10.11. LAN ΓòÉΓòÉΓòÉ
LAN
Local Area Network .
ΓòÉΓòÉΓòÉ 10.12. LU ΓòÉΓòÉΓòÉ
LU
Logical Unit ( in SNA terminology ) . A set of system resources and
software which allows a user program to communicate with another user
program in an SNA network .
ΓòÉΓòÉΓòÉ 10.13. Netbios ΓòÉΓòÉΓòÉ
Netbios
A programming interface which allows communication on a LAN . This
interface was originally defined and used for the PC Network LAN .
It can currently be used to access either a PC Network ( baseband
or broadband ) , or the Token Ring network .
ΓòÉΓòÉΓòÉ 10.14. OS/2 ΓòÉΓòÉΓòÉ
OS / 2
Operating System / 2 . An IBM trademark for a multitasking operating
system . See OS / 2 Extended Edition .
ΓòÉΓòÉΓòÉ 10.15. OS/2 EE ΓòÉΓòÉΓòÉ
OS / 2 EE
See OS / 2 Extended Edition .
ΓòÉΓòÉΓòÉ 10.16. OS/2 Extended Edition ΓòÉΓòÉΓòÉ
OS / 2 Extended Edition
Operating System / 2 Extended Edition . An IBM product which contains
the base OS / 2 operating system , the Communications Manager , and
the Database Manager .
ΓòÉΓòÉΓòÉ 10.17. PC ΓòÉΓòÉΓòÉ
PC
Personal Computer . Generally refers to the various models of the
IBM PC , PC - XT , PC - AT , and the PS / 2 family of hardware .
ΓòÉΓòÉΓòÉ 10.18. PS/2 ΓòÉΓòÉΓòÉ
PS / 2
Personal System / 2 . The family of PC hardware which includes the
various IBM PS / 2 models 25 , 30 , 50 , 60 , 70 , and 80 .
ΓòÉΓòÉΓòÉ 10.19. SAP ΓòÉΓòÉΓòÉ
SAP
Service Access Point . This is a set of system resources which
allows a program to access the LAN facilities and communicate with a
program on another LAN station . It is similar to a logical unit ,
in SNA terms .
ΓòÉΓòÉΓòÉ 10.20. SNA ΓòÉΓòÉΓòÉ
SNA
Systems Network Architecture . A set of rules which defines how a
group of computers can be connected to allow communication between
programs running on different computers in the network . OS / 2
Communication Manager supports APPC , which is described by SNA .
ΓòÉΓòÉΓòÉ 10.21. Test Case ΓòÉΓòÉΓòÉ
Test Case
In COMET , the processing of an input file by COMET is considered
to be a single test case .
ΓòÉΓòÉΓòÉ 10.22. 802.2 ΓòÉΓòÉΓòÉ
802 . 2
IEEE 802 . 2 Local Area Network interface definition . An
international standard describing a method of accessing the
communication functions of a local area network .
ΓòÉΓòÉΓòÉ 10.23. :label ΓòÉΓòÉΓòÉ
: label
Labels marking lines in a COMET input file have this format ,
beginning with a colon , followed immediately by the label , just as
in an OS / 2 batch file .
ΓòÉΓòÉΓòÉ 10.24. @ ΓòÉΓòÉΓòÉ
@
The " @ " character is used as a prefix for some COMET commands ,
such as @ define and @ include . These commands are not executed in
the same way that other commands in the COMET input file are , but
allow the writer of an input file some flexibility in writing a
test case .
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/* ------------------------------------------------------ */
Add_Define (Statement)
char *Statement;
{
/* ---------------------------------------------------- */
/* Format: DEFINE const_name const_value; */
/* Assigns the constant 'const_name' */
/* to the value 'const_value'. */
/* ---------------------------------------------------- */
int a, pos, size;
char *c_name, *q, *c_value;
err_flag=FALSE;
ptr1=buff1; /* set addr. for param values */
Num_Tokens=parse_line (Statement, tokenptr);
if (err_flag==TRUE) return (BAD);
/* fatal parsing error...break */
if (Num_Tokens > 3) {
outputf (
"Error; Line %d: Too many parameters",
"supplied in DEFINE statement.",
lnum);
return (BAD);
}
if ((Num_Tokens==2 && q_ptr!=NULL) || Num_Tokens==3)
c_name=tokenptr[1]; /* get name of the constant */
else {
outputf (
"Error; Line %d: Too few parameters in DEFINE statement.",
lnum);
return (BAD);
}
pos=0;
/* ------------------------------------------------------ */
/* Check to see if the constant has been defined already. */
/* ------------------------------------------------------ */
for (a=0; a<MAX_DEFINED_CONSTANTS; a++) {
if (strcmp (c_name, defined_constant[a].const_name)==0) {
outputf ("Redefining constant %s.", c_name);
free (defined_constant[a].const_value);
/* free original value */
pos=a;
}
}
if (pos==0) {
/* if constant has not been defined. */
num_constants++;
if (num_constants > MAX_DEFINED_CONSTANTS) {
outputf ("Too many constants defined.\n");
return (BAD);
}
pos=num_constants;
strcpy (defined_constant[num_constants].const_name,
c_name);
}
/* ----------------------------- */
/* Get the value of the constant */
/* ----------------------------- */
if (q_ptr==NULL)
/* if there is no quoted parameter */
c_value=tokenptr[2];
/* then the value is the 3rd token. */
else
c_value=q_ptr;
/* otherwise it is a quoted value. */
/* ------------------------------------------------------*/
/* c_value should not be NULL here, */
/* but let's check just in case. */
/* ------------------------------------------------------*/
if (c_value==NULL) {
outputf ("**UNEXPECTED COMET ERROR.. Add_Define().",
"c_value was NULL.");
return (BAD);
}
size=strlen (c_value)+1;
/* size of value (plus 1 for the NULL) */
if (q_ptr!=NULL) size+=2;
/* if this is a quoted value then add 2 for the quotes */
q=(char *) malloc (size);
/* get some space for the value */
if (q==NULL) {
outputf ("Error allocating memory for",
"storing constant %s.", c_name);
return (BAD);
}
if (q_ptr!=NULL)
sprintf (q, "\"%s\"", c_value);
else
strcpy (q, c_value);
/* store it */
defined_constant[pos].const_value=q;
/* save pointer to it */
ifdebug (comet_debug, "Assigning constant: %s=%s.\n",
c_name, q);
return (GOOD);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/* ------------------------------------------------------- */
int compare_files (p, param_name)
char *p[]; /* array holding the parameter values */
char *param_name[]; /* parameter names */
{
/* ----------------------
1 -- file 1
2 -- file 2
------------------------- */
int a;
ushort crc_val1, crc_val2;
/* CRC values for file 1 and 2 */
ushort data_len;
/* number of bytes read */
unsigned filehandle;
/* DOS filehandle for save file */
if (comet_debug)
outputf ("in compare_files..\n");
alloc_shared_buffer ();
/* make sure we have a data buffer */
if (comet_debug)
{
outputf ("dataptr=");
if (dataptr==NULL)
outputf ("NULL!\n");
else {
outputf ("%p\n", dataptr);
}
}
/* read file1 into buffer (dataptr) */
if (! GET_FILE (p[1], dataptr, &data_len))
return (BAD);
calc_crc ((char far *)dataptr, data_len,
&crc_val1);
if (comet_debug)
{
outputf ("Calculated CRC value for file1 --->",
"x'%04X'\n", crc_val1);
}
/* read file2 into buffer (dataptr) */
if (! GET_FILE (p[2], dataptr, &data_len))
return (BAD);
calc_crc ((char far *)dataptr, data_len,
&crc_val2);
if (comet_debug)
{
outputf ("Calculated CRC value for file2 --->",
"x'%04X'\n", crc_val2);
}
if (crc_val1 != crc_val2) {
strupr (p[1]);
strupr (p[2]);
sprintf (tempstr,
"Files do not match. Crc of %s=%04X.",
"Crc of %s=%04X", p[1], crc_val1, p[2],
crc_val2);
stamp_msg (func_name, tempstr);
return (BAD);
}
return (GOOD);
}
/* --------------------------------------------------------- */
/*-----------------------------------------------------------*/
calc_crc (buffptr, bufflen, cksum)
char far *buffptr;
USHORT bufflen;
USHORT *cksum;
{
/*----------------------------------------------------
This routine calculates the CRC checksum value for
the first "bufflen" characters in the buffer pointed
to by "buffptr".
------------------------------------------------------*/
short i;
USHORT j, crc, chval;
BYTE hexdigits[18];
strcpy (hexdigits,"0123456789ABCDEF\0");
crc = 0xFFFF;
for (i=0; i<bufflen; i++, buffptr++)
{
chval = (USHORT)*buffptr;
j = (crc ^ chval) & 0x000F;
j = j + (j << 12) + (j << 7);
crc = j ^ ((crc >> 4) & 0x0FFF);
j = ((chval >> 4) ^ crc) & 0x000F;
j = j + (j << 12) + (j << 7);
crc = j ^ ((crc >> 4) & 0x0FFF);
}
*cksum = crc;
}
/* ------------------------------------------------------ */
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*--------------------------------------------------------------------**
The OS2_SHELL procedure. The calling parm is the command line
string.
**--------------------------------------------------------------------*/
int shellSpawn(char * cmdline)
{
USHORT rtn;
HAB hab;
HFILE hRd, hWrt;
static HFILE hStdOut = STDOUT;
static HFILE hStdErr = STDERR;
static char *argv[20];
char *p, *end;
int i;
USHORT bytesRead;
PBYTE pBuf;
int iChildProcess;
int hold;
/* if we received no parameters to give to the command interpreter
we do nothing. */
if (*cmdline == '\0')
return(0);
/* make an unmamed pipe for the child process' STDOUT and STDERR,
and hook STDOUT and STDERR to the write side of the pipe. We
must close the original write end handle so that when the
spawned process closes stdout and stderr (when it ends) our
reads will return correctly with 0 bytes read. */
rtn = DosMakePipe(&hRd, &hWrt, 0);
rtn = DosDupHandle(hWrt, &hStdOut);
rtn = DosDupHandle(hWrt, &hStdErr);
rtn = DosClose(hWrt);
/* fix up the argv list from the cmdline. The first two parameters
must be <c:\os2\cmd.exe /c> in order to invoke the command
interpreter in the spawned process. */
argv[0] = "C:\\OS2\\CMD.EXE";
argv[1] = "/c";
i = 2;
end = cmdline + strlen(cmdline);
for (p = cmdline; p < end; p++) {
/* If this is a non-space, and either the previous char is a space
or null or this is the start of the string, we mark this as the
start of the next parameter.
If this is a space, the last char was a non-space, and this is
not the start of the string, it is the end of the last parameter.
We terminate the last parameter string with a null. */
if (*p != ' ') {
if ((*(p-1) == ' ') || (*(p-1) == '\0') || (p == cmdline))
argv[i++] = p;
} else { /* *p == ' ' */
if ((*(p-1) != ' ') && (p != cmdline))
*p = '\0';
} /* end if/else */
} /* end for */
argv[i] = NULL;
/* spawn off the background process with given parameters and
STDOUT and STDERR pointed to our unnamed pipe. */
hold = 0;
iChildProcess = spawnve(P_NOWAIT, argv[0], argv, mainEnvp);
if (iChildProcess == -1)
hold = errno;
/* DosDupHandle the current stdout and stderr, currently hooked
to the pipe write handle, back to the original stdout and
stderr. This has the effect of closing our last handles on
the write end of the pipe. */
rtn = DosDupHandle(dupStdOut, &hStdOut);
rtn = DosDupHandle(dupStdErr, &hStdErr);
/* if the spawn didn't work, blow this off and just return the error */
if (hold)
return(hold);
/* call the double buffer read routine for the output from the spawned
process so we can outputf it. */
pBuf = NULL;
while (TRUE) {
bytesRead = nextBuf(hRd, &pBuf);
if (bytesRead == 0)
break;
*(pBuf + bytesRead) = '\0';
outputf("%s", pBuf);
}
/* finally close the read side of the pipe. */
rtn = DosClose(hRd);
/* do a cwait for the spawned process to nuke zombie process */
cwait(NULL, iChildProcess, WAIT_CHILD);
return(0);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
os2_rc = DosBeep (frequency, duration);
if (os2_rc != 0) {
os2_error = 1; /* set error flag */
ret_os2 = BAD;
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*-------------------------------------------------------------*/
DOS_DATE (mon, day, year, dow)
short *mon, *day, *year, *dow;
{
DATETIME dt;
DosGetDateTime ((PDATETIME)&dt);
*mon = dt.month;
*day = dt.day;
*year = dt.year;
*dow = dt.weekday;
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*--------------------------------------------------------------*/
DOS_TIME (hrs, mins, secs, hunds)
short *hrs, *mins, *secs, *hunds;
{
DATETIME dt;
DosGetDateTime ((PDATETIME)&dt);
*hrs = dt.hours;
*mins = dt.minutes;
*secs = dt.seconds;
*hunds = dt.hundredths;
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*------------------------------------------------------------*/
DOSSLEEP ( secs, mins )
char *secs, *mins;
{
sleep( secs, mins );
}
/*-------------------------------------------------------------*/
sleep (p1, p2)
char *p1; /* parameter one, seconds */
char *p2; /* parameter two, minutes */
{
/* ------------------
1 - Seconds
2 - Minutes
--------------------- */
char prt_msg[120];
long secs, mins;
long millsecs;
secs=(long)atoi (p1);
mins=(long)atoi (p2);
millsecs=mins*(long)60000 + secs*(long)1000;
if (os2_debug)
{
outputf ("Sleeping for %ld milliseconds...",
millsecs);
}
DosSleep (millsecs);
return (GOOD);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
THIS IS A NOTHING FOOTNOTE; TO BE REPLACE WITH REAL SOURCE
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
sqlealtd( DatabaseName, OldPassword, NewPassword,
&sqlca );
where:
CHAR *DatabaseName;
CHAR *OldPassword;
CHAR *NewPassword;
struct sqlca sqlca;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
sqlecatd( DatabaseName, Alias, Remote, NodeName,
Alternate, Comment, CodePage, &sqlca );
where:
CHAR *DatabaseName;
CHAR *Alias;
UCHAR Remote; /* 0=local, 1=remote */
CHAR *NodeName;
UCHAR Alternate; /* when Remote=0, will be 1 for */
/* alternate adpt, 0 for primary adpt */
CHAR *Comment;
SHORT CodePage;
/* codepage for Comment, 0=use default codepage*/
struct sqlca sqlca;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
sqlecatn( NodeName, LocalLU, RemoteLU,
Mode, Comment, CodePage, &sqlca );
where:
CHAR *NodeName;
CHAR *LocalLU; /* Local LU name */
CHAR *RemoteLU;/* Remote LU name */
CHAR *Mode; /* Communications Mode */
CHAR *Comment;
SHORT CodePage; /* CodePage for Comment */
/* 0=default CodePage */
struct sqlca sqlca;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
sqlecred( DatabaseName, Drive, Comment,
CodePage, &sqlca );
where:
CHAR *DatabaseName;
UCHAR Drive; /* 'C', 'D', etc. */
CHAR *Comment;
SHORT CodePage; /* CodePage of Comment */
struct sqlca sqlca;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
sqledrpd( DatabaseName, &sqlca );
where:
CHAR *DatabaseName;
struct sqlca sqlca;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
sqluexp( DatabaseName, DataFile, &OutputCol,
&SelectString, FileType, &FileMod,
MsgFile, CallAction, &sqlca );
where:
CHAR *DatabaseName;
CHAR *DataFile; /* Name to Export Data to */
struct sqldcol OutputCol;
/* Column Names for output file */
struct sqlchar SelectString;
/* Valid Dynamic SELECT statement */
CHAR *FileType;
/* "DEL", "WSF", "IXF" */
struct sqlchar FileMod;
/* addition info for FileType */
CHAR *MsgFile;
/* file to put output msgs into */
SHORT CallAction;
/* 0=Initial Call, 1, Continue Processning */
/* 2=Terminate Processing */
struct sqlca sqlca;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
sqluimp( DatabaseName, DataFile, &ImportColsInfo,
&ImportCols, FileType, &FileMod,
MsgFile, CallerAction, &sqlca );
where:
CHAR *DatabaseName;
CHAR *DataFile; /* Import File */
struct sqldcol ImportColsInfo;
/* info about cols being selected for import */
struct sqlchar ImportCols;
/* Cols to import data into */
CHAR *FileType;
/* "DEL","ASC","WSF","IXF" */
struct sqlchar FileMod;
/* Addtl info about FileType */
CHAR *MsgFile;
/* File for Import msgs */
SHORT CallerAction;
/* 0=Initial Call */
/* 1=Continue Processing */
/* 2=Terminate Processing */
struct sqlca sqlca;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
sqludres(DatabaseName, Drive,
RestoreDrive, CallerAction, &sqlca);
where:
CHAR *DatabaseName;
UCHAR Drive; /* 'A','B', etc */
/* where database backup files are */
UCHAR RestoreDrive;
/* drive to restore files to */
SHORT CallerAction;
/* 0=initial call */
/* 1=Continue processing */
/* 2=Terminate processing */
struct sqlca sqlca;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
sqlestar();
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
sqlestrd(DatabaseName, Use, &sqlca );
where:
CHAR *DatabaseName;
UCHAR Use; /* 'S'=shared, 'X'=exclusive */
struct sqlca sqlca;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
sqlestop(&sqlca);
where:
struct sqlca sqlca;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
sqlestpd(&sqlca);
where:
struct sqlca sqlca;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
sqleuncd( DatabaseName, &sqlca );
where:
CHAR *DatabaseName;
struct sqlca sqlca;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
sqleuncn(NodeName, &sqlca );
where:
CHAR *NodeName;
struct sqlca sqlca;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
EXEC SQL ALTER TABLE employee
ADD startdate DATE;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
EXEC SQL
CREATE INDEX ndxsalary
ON employee (salary );
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
EXEC SQL
CREATE TABLE employee
(name VARCHAR(25) NOT NULL,
salary INT,
dept CHAR(3),
socsec INT,
PRIMARY KEY (socsec));
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
EXEC SQL
CREATE VIEW Sales ( name, socsec )
AS SELECT name, socsec
FROM employee WHERE dept = 'SAL';
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
EXEC SQL
DROP INDEX ndxsalary;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
EXEC SQL DROP TABLE employee;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
EXEC SQL DROP VIEW sales;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
EXEC SQL COMMIT;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
EXEC SQL DELETE FROM employee
WHERE dept='SAL';
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
EXEC SQL
INSERT INTO employee ( name, socsec )
VALUES ('SMITH',452486749);
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
EXEC SQL ROLLBACK;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
EXEC SQL
SELECT name, salary
INTO :EmployeeName, :Salary
FROM employee
WHERE dept = :DeptName ;
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
EXEC SQL
UPDATE employee
SET startdate=DATE
WHERE dept='SAL';
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
#include <dsqcommc.h>
/* structure is defined in dsqcommc.h */
/*
extern int cdecl dsqcice (
struct dsqcomm *, dsqcomm- communicatn area
signed long *, command length
char *, command
signed long *, number of variables
signed long *, name lengths
char *, variable names
signed long *, variable value lengths
void *, variable values
char *); type = {FINT || CHAR}
*/
/* the four commads that we'll use after START*/
static char *ListQuery =
"LIST QUERIES";
static char *Message =
"MESSAGE (TEXT='Create Query: INFO' DISPLAY=IMMED)";
static char *RunQuery =
"RUN QUERY INFO";
static char *Exit =
"EXIT";
void DisplayError(struct dsqcomm *, CHAR *);
int main()
{
CHAR Command[45];
struct dsqcomm CommunicationArea;
ULONG CommandLength;
USHORT rc;
SEL Selector1;
CHAR *VariableValues, *StartPtr;
CHAR *VariableNames;
LONG NumberParms;
LONG *NameLengths, *StartLong;
LONG *ValuesLengths;
rc = DosAllocSeg(100, &Selector1, SEG_NONSHARED);
VariableValues = (CHAR *)MAKEP(Selector1, 0 );
ValuesLengths = (LONG *)MAKEP(Selector1, 25 );
/* save start of memory */
StartLong = ValuesLengths;
StartPtr = VariableValues;
/* put in first variable */
strcpy(VariableValues, "INTERACTIVE");
/* now insert sizeof first variable */
/* in ValueLengths array */
*ValuesLengths = strlen(VariableValues) + 1;
/* move ptr to end of first variable + NULL */
StartPtr += (strlen(VariableValues) + 1);
/* put in second variable */
strcpy(StartPtr, "SAMPLE ");
/* incrment the ValueLengths array */
StartLong++;
/* and put in sizeof second variable */
*StartLong = strlen(StartPtr);
/* do same as above for variable names */
NameLengths = (LONG *)MAKEP(Selector1, 50);
StartLong = NameLengths;
VariableNames = (CHAR *)MAKEP(Selector1, 75 );
StartPtr = VariableNames;
strcpy(VariableNames, "DSQSMODE");
*NameLengths = strlen(VariableNames) + 1;
StartPtr += (strlen(VariableNames) + 1);
strcpy(StartPtr, "DSQSDBNM");
StartLong++;
*StartLong = strlen(StartPtr);
/* set up other parameters for START call*/
strcpy(Command, "START");
NumberParms = 2; /* MODE and DATABASE name */
CommandLength = strlen(Command);
dsqcice(&CommunicationArea, &CommandLength, Command,
&NumberParms,
NameLengths, VariableNames, ValuesLengths,
VariableValues, DSQ_VARIABLE_CHAR);
if (CommunicationArea.dsq_return_code)
DisplayError(&CommunicationArea, Command );
CommandLength = strlen(Message);
dsqcic(&CommunicationArea, &CommandLength, Message);
if (CommunicationArea.dsq_return_code)
DisplayError(&CommunicationArea, "MESSAGE" );
CommandLength = strlen(ListQuery);
dsqcic(&CommunicationArea, &CommandLength, ListQuery);
if (CommunicationArea.dsq_return_code)
DisplayError(&CommunicationArea, "EDIT QUERY");
CommandLength = strlen(RunQuery);
dsqcic(&CommunicationArea, &CommandLength, RunQuery);
if (CommunicationArea.dsq_return_code)
DisplayError(&CommunicationArea, "RUN QUERY");
CommandLength = strlen(Exit);
dsqcic(&CommunicationArea, &CommandLength, Exit);
exit(0);
}
void DisplayError(CommunicationArea, FunctionName)
struct dsqcomm *CommunicationArea;
CHAR *FunctionName;
{
printf("\n%s failed", FunctionName);
printf("\nReturn Code = %d",
CommunicationArea->dsq_return_code);
printf("\nReason Code = %d",
CommunicationArea->dsq_reason_code);
printf("\nError ID = %d",
CommunicationArea->dsq_error_id);
if (CommunicationArea->dsq_message_id[0])
printf("\nMessage ID = %s",
CommunicationArea->dsq_message_id);
if (CommunicationArea->dsq_q_message_id[0])
printf("\nQueryMessage ID = %s",
CommunicationArea->dsq_q_message_id);
if (CommunicationArea->dsq_start_parm_error[0])
printf("\nStartParameterError = %s",
CommunicationArea->dsq_start_parm_error);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#include <ACDI_C.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
#include <SUBCALLS.H>
union {
struct comopen_cb open_cb;
struct comdefinput_cb definputbuff_cb;
struct comdefoutputbuff_cb defoutputbuff_cb;
struct comsetbitrate_cb setbitrate_cb;
struct comsetlinectrl_cb setlinectrl_cb;
struct comconnect_cb connect_cb;
struct comsettimeouts_cb settimeouts_cb;
struct comreadcharstring_cb readcharstring_cb;
struct comdisconnect_cb disconnect_cb;
struct comclose_cb close_cb;
}vcb;
void
comclose(handle)
/* This subroutine will issue com_close
to close the communication device. */
unsigned short handle; /* device handle */
{
memset(&vcb,(int)'\0',sizeof(vcb));
/* zero out the control block */
vcb.close_cb.common.com_dev_handle = handle;
vcb.close_cb.common.function_code = COM_CLOSE;
/* fill in control block with */
/* function code and parameters */
ACDI(vcbptr); /* issue the verb */
if (vcb.close_cb.common.return_code != AA_OK)
printf("Error in ComClose Return Code = %d",
vcb.close_cb.common.return_code);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#include <ACDI_C.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
#include <SUBCALLS.H>
void
comconnect(handle)
/* This subroutine will issue com_connect to establish
connection */
unsigned short handle; /* device handle */
{
memset(&vcb,(int)'\0',sizeof(vcb));
/* zero out the control block */
vcb.connect_cb.common.com_dev_handle = handle;
/* returned from ComOpen */
vcb.connect_cb.common.function_code = COM_CONNECT;
vcb.connect_cb.connect_type = AA_CONNECT_TYPE_4;
vcb.connect_cb.connect_timeout_1 = 0;
vcb.connect_cb.connect_timeout_2 = 30;
/* fill in control block with */
/* function code and parameters */
ACDI(vcbptr); /* issue the verb */
if (vcb.connect_cb.common.return_code != AA_OK)
printf("Error in ComConnect return code = %d",
vcb.connect_cb.common.return_code );
/* any errors */
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#include <ACDI_C.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
#include <SUBCALLS.H>
union {
struct comopen_cb open_cb;
struct comdefinput_cb definputbuff_cb;
struct comdefoutputbuff_cb defoutputbuff_cb;
struct comsetbitrate_cb setbitrate_cb;
struct comsetlinectrl_cb setlinectrl_cb;
struct comconnect_cb connect_cb;
struct comsettimeouts_cb settimeouts_cb;
struct comreadcharstring_cb readcharstring_cb;
struct comdisconnect_cb disconnect_cb;
struct comclose_cb close_cb;
}vcb;
void
comdisconnect(handle)
/* This subroutine will issue */
/* com_disconnect to break the connection. */
unsigned short handle; /* device handle */
{
memset(&vcb,(int)'\0',sizeof(vcb));
/* zero out the control block */
vcb.disconnect_cb.common.com_dev_handle = handle;
vcb.disconnect_cb.common.function_code = COM_DISCONNECT;
/* fill in control block with */
/* function code and parameters */
/* issue the verb */
ACDI(vcbptr);
if (vcb.disconnect_cb.common.return_code != AA_OK)
printf("Error in ComDisconnect Return Code = %d",
vcb.disconnect_cb.common.return_code);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#include <ACDI_C.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
#include <SUBCALLS.H>
union {
struct comopen_cb open_cb;
struct comdefinput_cb definputbuff_cb;
struct comdefoutputbuff_cb defoutputbuff_cb;
struct comsetbitrate_cb setbitrate_cb;
struct comsetlinectrl_cb setlinectrl_cb;
struct comconnect_cb connect_cb;
struct comsettimeouts_cb settimeouts_cb;
struct comreadcharstring_cb readcharstring_cb;
struct comdisconnect_cb disconnect_cb;
struct comclose_cb close_cb;
}vcb;
void
comopen()
/* This subroutine will issue com_open verb to open the */
/* specified com. device for communication */
{
memset(&vcb,(int)'\0',sizeof(vcb));
/* zero out the control block */
vcb.open_cb.common.function_code = COM_OPEN;
/* verb - com_open */
strcpy(vcb.open_cb.com_dev_name,"COM1\0");
/* copy communication device */
/* name into the control block */
/* issue the acdi verb */
ACDI(vcbptr);
handle = vcb.open_cb.common.com_dev_handle;
/* copy device handle returned */
/* by acdi to use in other verbs*/
if (vcb.open_cb.common.return_code != AA_OK)
/* check if return code is zero */
printf("Error in ComOpen Return Code = %d",
vcb.open_cb.common.return_code);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#include <ACDI_C.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
#include <SUBCALLS.H>
union {
struct comopen_cb open_cb;
struct comdefinput_cb definputbuff_cb;
struct comdefoutputbuff_cb defoutputbuff_cb;
struct comsetbitrate_cb setbitrate_cb;
struct comsetlinectrl_cb setlinectrl_cb;
struct comconnect_cb connect_cb;
struct comsettimeouts_cb settimeouts_cb;
struct comreadcharstring_cb readcharstring_cb;
struct comdisconnect_cb disconnect_cb;
struct comclose_cb close_cb;
}vcb;
void
comretbitrate(handle)
/* This subroutine will issue */
/* com_ret_bit_rate verb to return the line */
/* data rates (bps). */
/* Uses the same structure as SetBitRate */
unsigned short handle;
/* device handle */
{
memset(&vcb,(int)'\0',sizeof(vcb));
/* zero out the control block */
vcb.setbitrate_cb.common.com_dev_handle = handle;
vcb.setbitrate_cb.common.function_code = COM_RET_BIT_RATE;
/* fill in control block with */
/* function code and parameters */
/* issue the verb */
ACDI(vcbptr);
if (vcb.setbitrate_cb.common.return_code != AA_OK)
printf("Error in ComRetBitRate Return Code = %d",
vcb.setbitrate_cb.common.return_code);
else {
printf(
"BitRateRcv = %d", vcb.setbitrate_cb.bit_rate_rcv);
printf(
"\nBitRateSend = %d", vcb.setbitrate_cb.bit_rate_send);
}
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#include <ACDI_C.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
#include <SUBCALLS.H>
union {
struct comopen_cb open_cb;
struct comdefinput_cb definputbuff_cb;
struct comdefoutputbuff_cb defoutputbuff_cb;
struct comsetbitrate_cb setbitrate_cb;
struct comsetlinectrl_cb setlinectrl_cb;
struct comconnect_cb connect_cb;
struct comsettimeouts_cb settimeouts_cb;
struct comreadcharstring_cb readcharstring_cb;
struct comdisconnect_cb disconnect_cb;
struct comclose_cb close_cb;
}vcb;
void
comretlinectrl(handle )
/* This subroutine will return line control parameters */
/* Uses the same structure as SetLineControl */
unsigned short handle; /* device handle */
{
memset(&vcb,(int)'\0',sizeof(vcb));
/* zero out the control block */
vcb.setlinectrl_cb.common.com_dev_handle = handle;
vcb.setlinectrl_cb.common.function_code = COM_RET_LINE_CTRL;
/* fill in control block with */
/* function code and parameters */
/* issue the verb */
ACDI(vcbptr);
if (vcb.setlinectrl_cb.common.return_code != AA_OK)
printf("Error in ComRetLineCtrl Return Code = %d",
vcb.setlinectrl_cb.common.return_code);
else {
printf("Stop Bits = %d",vcb.setlinectrl_cb.stop_bits);
printf("\nParity = %d",vcb.setlinectrl_cb.parity);
printf("\nData Bits = %d",vcb.setlinectrl_cb.data_bits);
}
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#include <ACDI_C.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
#include <SUBCALLS.H>
union {
struct comopen_cb open_cb;
struct comdefinput_cb definputbuff_cb;
struct comdefoutputbuff_cb defoutputbuff_cb;
struct comsetbitrate_cb setbitrate_cb;
struct comsetlinectrl_cb setlinectrl_cb;
struct comconnect_cb connect_cb;
struct comsettimeouts_cb settimeouts_cb;
struct comreadcharstring_cb readcharstring_cb;
struct comdisconnect_cb disconnect_cb;
struct comclose_cb close_cb;
}vcb;
void
comsetbitrate(handle)
/* This subroutine will issue */
/* com_set_bit_rate verb to set up the line */
/* data rates (bps). */
unsigned short handle;
/* device handle */
{
memset(&vcb,(int)'\0',sizeof(vcb));
/* zero out the control block */
vcb.setbitrate_cb.common.com_dev_handle = handle;
vcb.setbitrate_cb.common.function_code = COM_SET_BIT_RATE;
vcb.setbitrate_cb.bit_rate_rcv = AA_300_BPS;
vcb.setbitrate_cb.bit_rate_send = AA_300_BPS;
/* set at 300 bps */
/* fill in control block with */
/* function code and parameters */
/* issue the verb */
ACDI(vcbptr);
if (vcb.setbitrate_cb.common.return_code != AA_OK)
printf("Error in ComSetBitRate Return Code = %d",
vcb.setbitrate_cb.common.return_code);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#include <ACDI_C.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
#include <SUBCALLS.H>
union {
struct comopen_cb open_cb;
struct comdefinput_cb definputbuff_cb;
struct comdefoutputbuff_cb defoutputbuff_cb;
struct comsetbitrate_cb setbitrate_cb;
struct comsetlinectrl_cb setlinectrl_cb;
struct comconnect_cb connect_cb;
struct comsettimeouts_cb settimeouts_cb;
struct comreadcharstring_cb readcharstring_cb;
struct comdisconnect_cb disconnect_cb;
struct comclose_cb close_cb;
}vcb;
void
comsetlinectrl(handle )
/* This subroutine will issue com_set_line_ctrl */
/* to set up line control values */
unsigned short handle; /* device handle */
{
memset(&vcb,(int)'\0',sizeof(vcb));
/* zero out the control block */
vcb.setlinectrl_cb.common.com_dev_handle = handle;
vcb.setlinectrl_cb.common.function_code = COM_SET_LINE_CTRL;
vcb.setlinectrl_cb.stop_bits = AA_1_STOP_BIT;
vcb.setlinectrl_cb.parity = AA_EVEN_PARITY;
vcb.setlinectrl_cb.data_bits = AA_7_DATA_BITS;
/* fill in control block with */
/* function code and parameters */
/* issue the verb */
ACDI(vcbptr);
if (vcb.setlinectrl_cb.common.return_code != AA_OK)
printf("Error in ComSetLineCtrl Return Code = %d",
vcb.setlinectrl_cb.common.return_code);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/**************************************************/
/* following is the start of an appc application, */
/* should be call in order: */
/* 1) INIT_SELF() */
/* 2) DO_TP_STARTED() */
/* 3) DO_MC_ALLOC() */
/**************************************************/
#include <APPC_C.H>
#include <ACSSVCC.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
/* global variables */
unsigned far *vcbptr;
/* Pointer to the control block */
char tp_id[8];
/* transaction program id */
unsigned long conv_id;
/* conversation id */
char al_tp_name[64];
/* tp_name for MC_ALLOCATE */
char al_tp_name[64];
/* tp_name for MC_ALLOCATE */
char al_mode_name[8];
/* mode name for MC_ALLOCATE */
char tps_tp_name[64];
/* tp_name for TP_STARTED */
void
INIT_SELF()
/* Initialization routine */
{
/* Translate ASCII to EBCDIC as required by APPC for names */
vcbptr = (unsigned far *)&cnvt;
memset (al_tp_name, (int)' ',sizeof(al_tp_name));
/* all blanks */
memcpy (al_tp_name,"FILEMSVR",8);
/* Set the tp_name for allocate */
memset(&cnvt,(int)'\0',sizeof(cnvt));
cnvt.opcode = SV_CONVERT;
/* Do a CONVERT general service */
cnvt.direction = SV_ASCII_TO_EBCDIC;
/* Cnvt ASCII to EBCDIC */
cnvt.char_set = SV_AE;
/* AE conversion type */
cnvt.len = sizeof(al_tp_name);
/* Convert 64 bytes */
cnvt.source = cnvt.target =
(unsigned char far *)al_tp_name;
/* Addr. (Convert in place) */
ACSSVC ((long) vcbptr);
/* Go convert it to EBCDIC */
memcpy (al_mode_name, "MODE1 ", 8);
/* Set the mode name allocate */
memset(&cnvt,(int)'\0',sizeof(cnvt));
cnvt.opcode = SV_CONVERT;
cnvt.direction = SV_ASCII_TO_EBCDIC;
cnvt.char_set = SV_A;
/* Conversion type A */
cnvt.len = sizeof(al_mode_name);
cnvt.source = cnvt.target =
(unsigned char far *)al_mode_name;
ACSSVC ((long) vcbptr);
memset (tps_tp_name, (int)' ',sizeof(tps_tp_name));
/* all blanks */
memcpy (tps_tp_name,"FILEMREQ",8);
/* Set tp_name for start_tp */
memset(&cnvt,(int)'\0',sizeof(cnvt));
cnvt.opcode = SV_CONVERT;
cnvt.direction = SV_ASCII_TO_EBCDIC;
cnvt.char_set = SV_AE;
cnvt.len = sizeof(tps_tp_name);
cnvt.source = vcb.cnvt.target =
(unsigned char far *)tps_tp_name;
ACSSVC ((long) vcbptr);
}
void
DO_TP_STARTED()
{
struct tp_started tpstart; /* control block */
vcbptr = (unsigned far *)&tpstart;
memset(&tpstart,(int)'\0',sizeof(tpstart))
/* Zero the control block */
tpstart.opcode = AP_TP_STARTED;
/* APPC verb - TP_STARTED */
memcpy (tpstart.lu_alias, "FILEREQ ", 8);
/* Set LU_ALIAS */
memcpy (tpstart.tp_name,"FILEMREQ",8);
/* Set TP_NAME */
APPC ((long) vcbptr);
/* Call APPC */
appc_rc_p = tpstart.primary_rc;
appc_rc_s = tpstart.secondary_rc;
/* Save the return codes */
if (appc_rc_p != AP_OK)
printf("Error in TP_STARTED, RC = %d",
tpstart.primary_rc );
/* Handle any error */
memcpy (tp_id,tpstart.tp_id,sizeof(tp_id));
/* Save the TP_ID */
}
void
DO_MC_ALLOCATE ()
{
struct mc_allocate alloc;
vcbptr = (unsigned far *)&alloc;
/* Get pointer to the vcb */
memset(&alloc,(int)'\0',sizeof(alloc));
/* Zero out the vcb */
alloc.opcode = AP_M_ALLOCATE;
/* Verb - MC_ALLOCATE */
alloc.opext = AP_MAPPED_CONVERSATION;
/* Mapped Conversation type */
memcpy(alloc.tp_id, tp_id, sizeof(tp_id));
/* Set the TP_ID */
alloc.sync_level = AP_CONFIRM_SYNC_LEVEL;
/* Sync level-confirm */
alloc.rtn_ctl = AP_WHEN_SESSION_ALLOCATED;
/* Return when ses. allocated */
alloc.security = AP_NONE;
/* No security */
memcpy (alloc.plu_alias, "FILESVR ", 8);
/* Set PLU_ALIAS */
memcpy (alloc.tp_name,al_tp_name,sizeof(al_tp_name));
/* Set TP_NAME */
memcpy (alloc.mode_name,al_mode_name,sizeof(al_mode_name));
/* Set MODE_NAME */
APPC((long) vcbptr);
/* Call APPC */
conv_id = alloc.conv_id;
/* Save the CONVERSATION_ID */
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#include <APPC_C.H>
#include <ACSSVCC.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
/* from appc_c.h */
struct confirm
{
unsigned short opcode; /* Verb operation code */
unsigned char opext; /* Verb extension code */
unsigned char reserv2; /* Reserved */
unsigned short primary_rc; /* Primary RETURN_CODE */
unsigned long secondary_rc;/* Secondary RETURN_CODE */
unsigned char tp_id[8]; /* TP_ID */
unsigned long conv_id; /* CONV_ID */
unsigned char rts_rcvd; /* REQUEST_TO_SEND_RECEIVED */
/* AP_NO */
/* AP_YES */
};
void DO_CONFIRM()
{
unsigned far *vcbptr;
/* Pointer to the vcb */
struct confirm Confirm;
/* control block */
/* clear out control block */
vcbptr = (unsigned far *)&Confirm;
memset(&Confirm,(int)'\0',sizeof(Confirm));
Confirm.opcode = AP_M_CONFIRM;
Confirm.opext = AP_MAPPED_CONVERSATION;
memcpy(Confirm.tp_id, tp_id, sizeof(tp_id));
/* use the tp_id returned from TP_STARTED */
Confirm.conv_id = conv_id;
/* use the conv_id returned from MC_ALLOCATE */
/* Call APPC */
APPC((long)vcbptr);
/* check for errors */
if (Confirm.primary_rc)
printf("Error in CONFIRM, RC = %d,
Confirm.primary_rc );
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#include <APPC_C.H>
#include <ACSSVCC.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
unsigned far *vcbptr; /* Pointer to the vcb */
void
DO_MC_CONFIRMED ()
{
/* control block structure */
struct mc_confirmed confirmed;
vcbptr = (unsigned far *)&confirmed;
memset(&confirmed,(int)'\0',sizeof(confirmed));
/* Zero out the cb */
confirmed.opcode = AP_M_CONFIRMED;
/* Verb - MC_CONFIRMED */
confirmed.opext = AP_MAPPED_CONVERSATION;
/* Mapped Conversation type */
confirmed.conv_id = conv_id;
/* Set conversation_id */
memcpy (confirmed.tp_id, tp_id, sizeof(tp_id));
/* Set tp_id */
APPC ((long) vcbptr);
/* Do MC_CONFIRMED */
appc_rc_p = confirmed.primary_rc;
appc_rc_s = confirmed.secondary_rc;
/* Save return codes */
if (appc_rc_p != AP_OK)
printf("Error in MC_CONFIRMED, rc = %d"
confirmed.primary_rc);
/* Handle any error */
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#include <APPC_C.H>
#include <ACSSVCC.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
void
DO_MC_DEALLOCATE ()
{
/* control block */
struct mc_deallocate dealloc;
unsigned far *vcbptr;
/* Pointer to the vcb */
memset(&dealloc,(int)'\0',sizeof(dealloc));
dealloc.opcode = AP_M_DEALLOCATE;
/* Verb-MC_DEALLOCATE */
dealloc.opext = AP_MAPPED_CONVERSATION;
/* Set MC ext. type */
dealloc.conv_id = conv_id;
/* Set conversation_id */
/* Use conv_id returned from MC_ALLOCATE */
memcpy (dealloc.tp_id, tp_id, sizeof(tp_id));
/* Set tp_id */
/* use tp_id returned from TP_STARTED */
dealloc.dealloc_type = AP_SYNC_LEVEL;
APPC((long) vcbptr);
/* Call APPC */
if (dealloc.primary_rc != AP_OK)
printf("Error in MC_DEALLOCATE, RC=%d",
dealloc.primary_rc );
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#include <APPC_C.H>
#include <ACSSVCC.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
unsigned far *vcbptr;
/* Pointer to the vcb */
void
DO_MC_RECEIVE_AND_WAIT ()
{
/* control block structure */
struct mc_receive_and_wait rcv_wait;
unsigned short selector;
/* Selector from DOSALLOCSEG */
unsigned short rc;
/* return code */
unsigned char far *BufPtr; /* Pointer to AlphaNumeric */
/* Buffer (shared) */
rc = DOSALLOCSEG (4096,
(unsigned far *)&selector, 1);
if (rc == 0) {
/* If there is no error */
FP_OFF(BufPtr) = 0;
/* set the offset to zero */
FP_SEG(BufPtr) = selector;
/* address = Selector:0 */
}
vcbptr = (unsigned far *)&rcv_wait;
memset(&rcv_wait,(int)'\0',sizeof(rcv_wait));
/* Zero the vcb */
rcv_wait.opcode = AP_M_RECEIVE_AND_WAIT;
/* Verb - MC_RECEIVE_AND_WAIT */
rcv_wait.opext = AP_MAPPED_CONVERSATION;
/* Mapped Conversation type */
/* use conv_id returned from RECEIVE_ALLOC */
rcv_wait.conv_id = conv_id;
/* Set conversation_id */
memcpy (rcv_wait.tp_id, tp_id, sizeof(tp_id));
/* Set tp_id */
rcv_wait.max_len = 4096;
/* Receive file data in 4096 */
/* byte blocks */
rcv_wait.dptr = BufPtr;
/* Buffer */
rcv_wait.rtn_status = AP_YES;
/* Return status with data */
APPC((long) vcbptr);
/* Call APPC */
/* Get length we actually rcvd */
if (rcv_wait.primary_rc)
printf("Error in MC_RECEIVE_AND_WAIT, RC = %d",
rcv_wait.primary_rc );
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#include <APPC_C.H>
#include <ACSSVCC.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
unsigned far *vcbptr; /* Pointer to the vcb */
void
SEND_YOUR_NAME ()
{
/* control block */
struct mc_send_data send;
unsigned short selector;
/* Selector from DOSALLOCSEG */
unsigned short rc;
/* return code */
unsigned char far *NamePtr; /* Pointer to shared buffer */
memset(&send,(int)'\0',sizeof(send));
rc = DOSALLOCSEG (100,
(unsigned far *)&selector, 1);
if (rc == 0) {
/* If there is no error */
FP_OFF(NamePtr) = 0;
/* set the offset to zero */
FP_SEG(NamePtr) = selector;
/* address = Selector:0 */
}
/* clear out control block */
send.opcode = AP_M_SEND_DATA;
/* APPC Verb - MC_SEND_DATA */
send.opext = AP_MAPPED_CONVERSATION;
/* Mapped Conservation type */
send.conv_id = conv_id;
/* Set conversation_id */
/* use conv_id returned from MC_ALLOCATE */
memcpy (send.tp_id, tp_id, sizeof(tp_id));
/* Set TP_id */
/* use tp_id returned from TP_STARTED */
send.dlen = 100;
/* namelength - 100 bytes max. */
/* insert data into buffer */
strcpy(NamePtr, "Your Name Here ");
send.dptr = NamePtr;
/* Set data pointer to buffer */
send.type = AP_NONE;
/* Use SEND_DATA verb alone */
APPC((long) vcbptr);
/* Call APPC to send name */
if (send.primary_rc != AP_OK)
printf("Error in MC_SEND_DATA, RC = %d",
send.primary_rc );
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#include <APPC_C.H>
#include <ACSSVCC.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
void
DO_RECEIVE_ALLOCATE()
{
unsigned far *vcbptr;
/* Pointer to the vcb */
struct receive_allocate rcv_a;
/* control block */
memset(&rcv_a,(int)'\0',sizeof(rcv_a))
rcv_a.opcode = AP_RECEIVE_ALLOCATE;
/* Set the APPC opcode */
memcpy (rcv_a.tp_name, ra_tp_name, sizeof(ra_tp_name));
/* This has to have already */
/* been converted to EBCDIC */
APPC((long) vcbptr);
/* Call APPC */
if (rcv_a.primary_rc != AP_OK)
printf("Error in RECEIVE_ALLOCATE, RC = %d",
rcv_a.primary_rc);
conv_id = rcv_a.conv_id;
/* Save the conversation_id */
/* this is used in many places later */
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#include <APPC_C.H>
#include <ACSSVCC.H>
#include <STDIO.H>
#include <STDDEF.H>
#include <STRING.H>
#include <DOS.H>
#include <DOSCALLS.H>
unsigned far *vcbptr;
/* Pointer to the vcb */
void
DO_TP_ENDED ()
{
/* control block */
struct tp_ended tpend;
vcbptr = (unsigned far *)&tpend;
/* clear out control block */
memset(&vcb,(int)'\0',sizeof(vcb))
tpend.opcode = AP_TP_ENDED;
/* Verb - TP_ENDED */
/* use tp_id returned from TP_STARTED */
memcpy (tpend.tp_id, tp_id, sizeof(tp_id));
/* Set tp_id */
tpend.type = AP_SOFT;
/* Select SOFT stop */
APPC((long) vcbptr);
/* Do the TP_ENDED */
if (tpend.primary_rc != AP_OK)
printf("Error in TP_ENDED, RC = %d",
tpend.primary_rc );
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/* ----------------------- Include files ------------------------------*/
#include <mt\STDIO.H>
#include <mt\STDDEF.H>
#include <mt\STRING.H>
#include <mt\DOS.H>
#include <mt\STDLIB.H>
#include <mt\TIME.H>
#include <mt\ERRNO.H>
#include <mt\IO.H>
#define INCL_DOSQUEUES
#define INCL_DOSMISC
#define INCL_DOSMEMMGR
#include <os2.h>
#include "uuccprb.h"
/* --------- External variables ---------------------- */
/* Segment selectors for request and reply parameters
and data. These are only allocated once. After
they have been allocated they are used for subsequent
SRPI call. */
SEL selQParm = 0,
selQData = 0,
selRParm = 0,
selRData = 0;
// Current version value (uerversion)
#define UERVERSNUM 0x0200
// Send_Request verb type (uerverbtyp)
#define UERSENDREQ 0x1
// 3270 screen update notify (uer3270ind)
#define UER3270DISABL 0x255
// Disable notification of 3270 update
#define UER3270NOTIFY 0x0
// Notify user of 3270 screen update
// Sizes of allocated data segments for SRPI call
#define MAXQPARML 32763
#define MAXQDATAL 65535
#define MAXRPARML 32763
#define MAXRDATAL 65535
void main ()
{
short result;
/* temp variable for Dos calls */
static char data[] = "0987654321";
/* what we'll use for data */
static char parm[] = "12345678";
/* what we'll use for parmeters */
char far *ptrData;
/* need to use pointers */
char far *ptrParm;
UERCPRB cprb;
/* control block structure */
ptrData = (char far *)&data;
ptrParm = (char far *)&parm;
// initalize control block
init_send_req_parms(&cprb);
// Get data segments. Non-zero return indicates error
// allocating
// a data segment. This triggers a BAD return to caller.
if (DosAllocSeg (MAXQPARML+1, &selQParm, 1)
return BAD;
if (DosAllocSeg (MAXQDATAL+1, &selQData, 1)
return BAD;
if(DosAllocSeg (MAXRPARML+1, &selRParm, 1)
return BAD;
if(DosAllocSeg (MAXRDATAL+1, &selRData, 1)
return BAD;
// INITIALIZE UUMCPRB
cprb.uerrbsiz = sizeof(UERCPRB);
cprb.uerversion = UERVERSNUM;
cprb.uerverbtyp = UERSENDREQ;
cprb.uerfunct = 0x00;
FP_OFF(cprb.uerqparmad) = 0;
FP_SEG(cprb.uerqparmad) = selQParm;
FP_OFF(cprb.uerqdataad) = 0;
FP_SEG(cprb.uerqdataad) = selQData;
cprb.uerrparml = MAXRPARML;
FP_OFF(cprb.uerrparmad) = 0;
FP_SEG(cprb.uerrparmad) = selRParm;
cprb.uerrdatal = MAXRDATAL;
FP_OFF(cprb.uerrdataad) = 0;
FP_SEG(cprb.uerrdataad) = selRData;
// Initialize Request Parameter fields
cprb.uerqparml = 20;
movedata (FP_SEG(ptrParm), FP_OFF(ptrParm),
FP_SEG(cprb.uerqparmad), FP_OFF(cprb.uerqparmad),
sizeof numbers);
// Initialize Request Data fields
cprb.uerqdatal = 20;
movedata (FP_SEG(ptrData), FP_OFF(ptrData),
FP_SEG(cprb.uerqdataad), FP_OFF(cprb.uerqdataad),
cprb.uerqdatal);
cprb.uer3270ind = 0;
// Now initialize Server Name and length of name
cprb.uersrvnml = 8;
strcpy(cprb.uerserver, "IBMABASE");
send_request(&cprb);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
typedef unsigned char byte;
typedef unsigned short int word;
typedef unsigned long int dword;
typedef unsigned char far * address;
#include <os2.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <lan_1_c.h>
#include <lan_2_c.h>
#include <lan_3_c.h>
#include <lan_4_c.h>
#include <lan_5_c.h>
#include <lan_6_c.h>
struct ccb2_form {
byte ccb_adapter;
byte ccb_command;
byte ccb_retcode;
byte ccb_work;
address ccb_pointer;
dword ccb_cmpl_flag;
word ccb_parm_offset;
word ccb_parameter_1;
dword ccb_semaphore;
byte ccb_appl_id;
byte ccb_read_flag;
word ccb_appl_key;
word ccb_parameter_2;
};
struct dir_open_form {
word adapter_parms_off;
word reserve1;
dword reserve2;
word dlc_parms_offset;
word reserve3;
word reserve4;
};
struct dir_open_dlc_form {
byte dlc_max_sap;
byte dlc_max_stations;
byte dlc_max_gsap;
byte dlc_max_gmem;
byte dlc_t1_tick_one;
byte dlc_t2_tick_one;
byte dlc_ti_tick_one;
byte dlc_t1_tick_two;
byte dlc_t2_tick_two;
byte dlc_ti_tick_two;
};
struct dir_open_adap_form {
word open_error_code;
word open_options;
char node_address[6];
dword group_address;
dword functional_adrr;
word number_rcv_buffers;
word rcv_buffers_length;
word dhb_buffer_length;
byte data_hold_buffers;
char reserve_ccb2[3];
word product_id_offset;
word reserve_2_ccb2;
word bring_ups;
word init_warnings;
word semaphore_count;
dword sys_semaphore_table;
};
struct prod_id_form {
byte prod_id[18];
};
void main(void);
void DoStatus(BYTE);
word DoOpenSAP(BYTE);
void DoCloseSAP(BYTE, word);
void DoOpenStation(BYTE, word);
void main()
{
struct ccb2_form ControlBlock;
struct dir_open_form OpenParm;
struct dir_open_adap_form OpenAdapterParm;
struct dir_open_dlc_form OpenDLCParm;
struct prod_id_form ProdID;
BYTE ApplicationID;
char far *Ptr;
USHORT ReturnCode;
address BadPtr;
word StationID;
memset((CHAR FAR *)&ControlBlock,0, sizeof(
struct ccb2_form));
memset((CHAR FAR *)&OpenParm, 0, sizeof(
struct dir_open_form));
memset((CHAR FAR *)&OpenAdapterParm, 0,
sizeof( struct dir_open_adap_form));
memset((CHAR FAR *)&OpenDLCParm, 0,
sizeof( struct dir_open_dlc_form));
memset((CHAR FAR *)&ProdID, 0,
sizeof( struct prod_id_form ));
ControlBlock.ccb_adapter = 0x00;
ControlBlock.ccb_command = LLC_DIR_OPEN_ADAPTER;
ControlBlock.ccb_cmpl_flag = 0x0001;
ControlBlock.ccb_semaphore = 0x00;
Ptr = (CHAR FAR *)&OpenParm;
ControlBlock.ccb_parm_offset = FP_OFF (Ptr );
Ptr = (CHAR FAR *)&OpenAdapterParm;
OpenParm.adapter_parms_off = FP_OFF (Ptr );
Ptr = (CHAR FAR *)&OpenDLCParm;
OpenParm.dlc_parms_offset = FP_OFF (Ptr );
Ptr = (CHAR FAR *)&ProdID;
OpenAdapterParm.product_id_offset = FP_OFF (Ptr);
ReturnCode = ACSLAN((CHAR FAR *)&ControlBlock,
(CHAR FAR *)&BadPtr);
printf("Dir_Open_Adapter = %d", ReturnCode );
ApplicationID = ControlBlock.ccb_appl_id;
printf("\nProduct ID = %c",ApplicationID );
StationID = DoOpenSAP(ApplicationID);
getch();
DoOpenStation(ApplicationID, StationID);
DoStatus(ApplicationID);
getch();
DoCloseSAP(ApplicationID, StationID);
memset((CHAR FAR *)&ControlBlock,0, sizeof(
struct ccb2_form));
ControlBlock.ccb_adapter = 0x00;
ControlBlock.ccb_command = LLC_DIR_CLOSE_ADAPTER;
ControlBlock.ccb_cmpl_flag = 0x0001;
ControlBlock.ccb_semaphore = 0x00;
ControlBlock.ccb_parm_offset = 0x0000;
ReturnCode = ACSLAN((CHAR FAR *)&ControlBlock,
(CHAR FAR *)&BadPtr);
printf("\nDir_Close_Adapter = %d", ReturnCode );
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
typedef unsigned char byte;
typedef unsigned short int word;
typedef unsigned long int dword;
typedef unsigned char far * address;
#include <os2.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <lan_1_c.h>
#include <lan_2_c.h>
#include <lan_3_c.h>
#include <lan_4_c.h>
#include <lan_5_c.h>
#include <lan_6_c.h>
struct ccb2_form {
byte ccb_adapter;
byte ccb_command;
byte ccb_retcode;
byte ccb_work;
address ccb_pointer;
dword ccb_cmpl_flag;
word ccb_parm_offset;
word ccb_parameter_1;
dword ccb_semaphore;
byte ccb_appl_id;
byte ccb_read_flag;
word ccb_appl_key;
word ccb_parameter_2;
};
void DoCloseSAP(BYTE ApplicationID, word StationID)
{
struct ccb2_form ControlBlock;
USHORT ReturnCode;
address BadPtr;
memset((CHAR FAR *)&ControlBlock,0, sizeof(
struct ccb2_form));
ControlBlock.ccb_command = LLC_DLC_CLOSE_SAP;
ControlBlock.ccb_retcode = 0xff;
ControlBlock.ccb_cmpl_flag = 0x0001;
ControlBlock.ccb_appl_id = ApplicationID;
ControlBlock.ccb_parm_offset = StationID;
ReturnCode = ACSLAN((CHAR FAR *)&ControlBlock,
(CHAR FAR *)&BadPtr );
printf("\nCloseSAP, rc = %d", ReturnCode );
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
typedef unsigned char byte;
typedef unsigned short int word;
typedef unsigned long int dword;
typedef unsigned char far * address;
#include <os2.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <lan_1_c.h>
#include <lan_2_c.h>
#include <lan_3_c.h>
#include <lan_4_c.h>
#include <lan_5_c.h>
#include <lan_6_c.h>
struct ccb2_form {
byte ccb_adapter;
byte ccb_command;
byte ccb_retcode;
byte ccb_work;
address ccb_pointer;
dword ccb_cmpl_flag;
word ccb_parm_offset;
word ccb_parameter_1;
dword ccb_semaphore;
byte ccb_appl_id;
byte ccb_read_flag;
word ccb_appl_key;
word ccb_parameter_2;
};
void DoCloseStation(BYTE ApplicationID, word StationID)
{
struct ccb2_form ControlBlock;
USHORT ReturnCode;
address BadPtr;
memset((CHAR FAR *)&ControlBlock,0, sizeof(
struct ccb2_form));
ControlBlock.ccb_command = LLC_DLC_CLOSE_STATION;
ControlBlock.ccb_retcode = 0xff;
ControlBlock.ccb_cmpl_flag = 0x0001;
ControlBlock.ccb_appl_id = ApplicationID;
ControlBlock.ccb_parm_offset = StationID;
ReturnCode = ACSLAN((CHAR FAR *)&ControlBlock,
(CHAR FAR *)&BadPtr );
printf("\nCloseStation, rc = %d", ReturnCode );
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
typedef unsigned char byte;
typedef unsigned short int word;
typedef unsigned long int dword;
typedef unsigned char far * address;
#include <os2.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <lan_1_c.h>
#include <lan_2_c.h>
#include <lan_3_c.h>
#include <lan_4_c.h>
#include <lan_5_c.h>
#include <lan_6_c.h>
struct ccb2_form {
byte ccb_adapter;
byte ccb_command;
byte ccb_retcode;
byte ccb_work;
address ccb_pointer;
dword ccb_cmpl_flag;
word ccb_parm_offset;
word ccb_parameter_1;
dword ccb_semaphore;
byte ccb_appl_id;
byte ccb_read_flag;
word ccb_appl_key;
word ccb_parameter_2;
};
struct dlc_connect_station
{
word link_station_id;
byte reserve1[2];
word routing_offset;
word reserve2;
};
struct route_info {
byte items[18];
};
void dlc_connect_station(BYTE ApplicationID, word LinkID )
{
USHORT ReturnCode;
struct ccb2_form ControlBlock;
struct dlc_connect_station ConnectStation;
address BadPtr;
CHAR *Ptr;
struct route_info RouteInfo;
/* reset control_block ControlBlock and dlc_status_read_parm */
memset((char far *) &ControlBlock, 0,
sizeof (struct ccb2_form));
memset((char far *) &ConnectStation, 0,
sizeof (struct dlc_connect_station));
memset((char far *) &RouteInfo,0,18);
/* set pointer to command specific parameter table */
Ptr = (char far *) &ConnectStation;
ControlBlock.ccb_parm_offset = FP_OFF (Ptr);
ControlBlock.ccb_adapter = 0x00;
ControlBlock.ccb_command = LLC_DLC_CONNECT_STATION;
ControlBlock.ccb_cmpl_flag = 0x0001;
ControlBlock.ccb_appl_id = ApplicationID;
ConnectStation.link_station_id = LinkID;
Ptr = (char far *) &RouteInfo;
ConnectStation.routing_offset = FP_OFF (Ptr);
ReturnCode = ACSLAN((CHAR FAR *) &ControlBlock,
(CHAR FAR *)&BadPtr);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
typedef unsigned char byte;
typedef unsigned short int word;
typedef unsigned long int dword;
typedef unsigned char far * address;
#include <os2.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <lan_1_c.h>
#include <lan_2_c.h>
#include <lan_3_c.h>
#include <lan_4_c.h>
#include <lan_5_c.h>
#include <lan_6_c.h>
struct ccb2_form {
byte ccb_adapter;
byte ccb_command;
byte ccb_retcode;
byte ccb_work;
address ccb_pointer;
dword ccb_cmpl_flag;
word ccb_parm_offset;
byte ccb_parameter_1[2];
dword ccb_semaphore;
byte ccb_appl_id;
byte ccb_read_flag;
word ccb_appl_key;
word ccb_parameter_2;
};
#define RESETBUSYSTATE 0x80
#define LOCALBUSYSTATE 0x40
void FlowControl( word StationID )
{
USHORT ReturnCode;
struct ccb2_form ControlBlock;
address BadPtr;
/* reset control_block ControlBlock */
memset((char far *) &ControlBlock, 0,
sizeof (struct ccb2_form));
/* use StationID or SAPID */
ControlBlock.ccb_parm_offset = StationID;
ControlBlock.ccb_adapter = 0x00;
ControlBlock.ccb_command = LLC_DLC_FLOW_CONTROL;
ControlBlock.ccb_cmpl_flag = 0x0001;
ControlBlock.ccb_parameter_1[0] = 0;
ControlBlock.ccb_parameter_1[1] = 0;
ControlBlock.ccb_parameter_1[0] =
RESETBUSYSTATE|LOCALBUSYSTATE;
ReturnCode = ACSLAN((CHAR FAR *) &ControlBlock,
(CHAR FAR *)&BadPtr);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
typedef unsigned char byte;
typedef unsigned short int word;
typedef unsigned long int dword;
typedef unsigned char far * address;
#include <os2.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <lan_1_c.h>
#include <lan_2_c.h>
#include <lan_3_c.h>
#include <lan_4_c.h>
#include <lan_5_c.h>
#include <lan_6_c.h>
struct ccb2_form {
byte ccb_adapter;
byte ccb_command;
byte ccb_retcode;
byte ccb_work;
address ccb_pointer;
dword ccb_cmpl_flag;
word ccb_parm_offset;
word ccb_parameter_1;
dword ccb_semaphore;
byte ccb_appl_id;
byte ccb_read_flag;
word ccb_appl_key;
word ccb_parameter_2;
};
struct dlc_open_sap {
word station_id;
word user_stat_value;
byte timer_t1;
byte timer_t2;
byte timer_ti;
byte maxout;
byte maxin;
byte maxout_incr;
byte max_retry_cnt;
byte max_members;
word max_i_field;
byte sap_value;
byte option_priority;
byte station_count;
word reserve1;
byte group_count;
word group_list_offset;
word reserve2;
address dlc_status_flag;
word dlc_buf_size;
word dlc_pool_len;
address dlc_pool_addr;
byte adpt_stns_avail;
};
word DoOpenSAP(BYTE ApplicationID)
{
struct ccb2_form ControlBlock;
struct dlc_open_sap OpenSAP;
USHORT ReturnCode;
CHAR *Ptr;
BYTE SAP_pool[4096];
address BadPtr;
memset((CHAR FAR *)&ControlBlock,0, sizeof(
struct ccb2_form));
memset((CHAR FAR *)&OpenSAP, 0,
sizeof( struct dlc_open_sap));
ControlBlock.ccb_adapter = 0;
ControlBlock.ccb_command = LLC_DLC_OPEN_SAP;
ControlBlock.ccb_retcode = 0xff;
ControlBlock.ccb_cmpl_flag = 0x0001;
ControlBlock.ccb_semaphore = 0x00;
ControlBlock.ccb_appl_id = ApplicationID;
Ptr = (CHAR FAR *)&OpenSAP;
ControlBlock.ccb_parm_offset = FP_OFF(Ptr);
OpenSAP.timer_t1 = 10;
OpenSAP.timer_t2 = 9;
OpenSAP.timer_ti = 10;
OpenSAP.maxout = 0;
OpenSAP.maxin = 0;
OpenSAP.maxout_incr = 0;
OpenSAP.max_retry_cnt = 0;
OpenSAP.max_members = 0;
OpenSAP.max_i_field = 0;
OpenSAP.sap_value = 0x0A4;
OpenSAP.option_priority = 0x04;
OpenSAP.station_count = 2;
OpenSAP.group_count = 0;
OpenSAP.dlc_status_flag = (address)(0x0001);
OpenSAP.dlc_buf_size = 0;
OpenSAP.dlc_pool_len = 256;
OpenSAP.dlc_pool_addr = (address) SAP_pool;
ReturnCode = ACSLAN((CHAR FAR *)&ControlBlock,
(CHAR FAR *)&BadPtr );
printf("\nOpenSAP, rc = %d", ReturnCode );
printf("\nccbRc = %d", ControlBlock.ccb_retcode);
return(OpenSAP.station_id);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE typedef unsigned char byte; typedef unsigned short int word;
typedef unsigned long int dword; typedef unsigned char far * address; #include
<os2.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include
<dos.h> #include <lan_1_c.h> #include <lan_2_c.h> #include <lan_3_c.h> #include
<lan_4_c.h> #include <lan_5_c.h> #include <lan_6_c.h> struct ccb2_form { byte
ccb_adapter; byte ccb_command; byte ccb_retcode; byte ccb_work; address
ccb_pointer; dword ccb_cmpl_flag; word ccb_parm_offset; word
ccb_parameter_1; dword ccb_semaphore; byte ccb_appl_id; byte
ccb_read_flag; word ccb_appl_key; word ccb_parameter_2; }; struct
dlc_open_station { word station_id; /* SAP station ID */
word link_station_id; /* Link station ID assigned */ byte
timer_t1; /* Ti timer value */ byte timer_t2; /* T2
timer value */ byte timer_ti; /* Ti timer value */
byte maxout; /* Max transmits without ACK */ byte maxin;
/* Max receives without ACK */ byte maxout_incr; /* Dynamic window
increment */ byte max_retry_cnt; /* Maximum retry count */ byte
rsap_value; /* Remote SAP value */ word max_i_field;
/* Max rcv data for I frames */ byte access_priority; /* Ring access
priority */ byte reserved1; /* RESERVED */ word
destination_offset; /* Offset to remote dest add */ word reserved2;
/* Reserved for application */ }; struct remote_address_form { byte
adapter_address[6]; }; void DoOpenStation(BYTE ApplicationID, word StationID) {
struct ccb2_form ControlBlock; struct dlc_open_station OpenStation; USHORT
ReturnCode; CHAR *Ptr; address BadPtr; struct remote_address_form
RemoteAddress; memset((CHAR FAR *)&ControlBlock,0, sizeof( struct
ccb2_form)); memset((CHAR FAR *)&OpenStation, 0, sizeof( struct
dlc_open_station)); memset((CHAR FAR *)&RemoteAddress, 0, 6 );
ControlBlock.ccb_adapter = 0; ControlBlock.ccb_command =
LLC_DLC_OPEN_STATION; ControlBlock.ccb_retcode = 0xff;
ControlBlock.ccb_cmpl_flag = 0x0001; ControlBlock.ccb_semaphore = 0x00;
ControlBlock.ccb_appl_id = ApplicationID; RemoteAddress.adapter_address[0] =
0xA7; RemoteAddress.adapter_address[1] = 0x0A;
RemoteAddress.adapter_address[2] = 0x15; RemoteAddress.adapter_address[3] =
0x00; RemoteAddress.adapter_address[4] = 0x00;
RemoteAddress.adapter_address[5] = 0x40; Ptr = (CHAR FAR *)&OpenStation;
ControlBlock.ccb_parm_offset = FP_OFF(Ptr); OpenStation.station_id =
StationID; OpenStation.rsap_value = 0x0A4; Ptr = (address)&RemoteAddress;
OpenStation.destination_offset = FP_OFF(Ptr); ReturnCode = ACSLAN((CHAR FAR
*)&ControlBlock, (CHAR FAR *)&BadPtr ); printf("\nOpenStation, rc = %d",
ReturnCode ); printf("\nccbRc = %x", ControlBlock.ccb_retcode); }
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
typedef unsigned char byte;
typedef unsigned short int word;
typedef unsigned long int dword;
typedef unsigned char far * address;
#include <os2.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <lan_1_c.h>
#include <lan_2_c.h>
#include <lan_3_c.h>
#include <lan_4_c.h>
#include <lan_5_c.h>
#include <lan_6_c.h>
struct ccb2_form {
byte ccb_adapter;
byte ccb_command;
byte ccb_retcode;
byte ccb_work;
address ccb_pointer;
dword ccb_cmpl_flag;
word ccb_parm_offset;
word ccb_parameter_1;
dword ccb_semaphore;
byte ccb_appl_id;
byte ccb_read_flag;
word ccb_appl_key;
word ccb_parameter_2;
};
struct dlc_status_read_form
{
word sap_station_id;
byte option_indicator;
byte event_set;
byte event;
byte critical_subset;
dword notification_flag;
word station_id;
word dlc_status_code;
byte frmr_data[5];
byte access_priority;
byte remote_node[6];
byte remote_sap;
byte reserve1;
word user_stat_value;
byte extr_byte[6];
};
void Read(ApplicationID, SapID)
byte ApplicationID;
word SapID;
{
struct ccb2_form ControlBlock;
CHAR *Ptr;
USHORT ReturnCode;
address BadPtr;
struct dlc_status_read_form Read;
memset((char far *) &ControlBlock, 0,
sizeof (struct ccb2_form));
memset((char far *) &Read ,
0, sizeof (struct dlc_status_read_form));
Ptr = (char far *) &Read ;
ControlBlock.ccb_parm_offset = FP_OFF (Ptr);
ControlBlock.ccb_adapter = 0x00;
ControlBlock.ccb_command = LLC_READ;
ControlBlock.ccb_retcode = 0xff;
ControlBlock.ccb_pointer = (unsigned char *)0L;
ControlBlock.ccb_cmpl_flag = 0x0001;
ControlBlock.ccb_appl_id = ApplicationID;
Read.sap_station_id = SapID;
Read.option_indicator = 0x01;
Read.event_set = 0x08;
ReturnCode = ACSLAN((char far *) &ControlBlock,
(CHAR FAR *)&BadPtr);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
typedef unsigned char byte;
typedef unsigned short int word;
typedef unsigned long int dword;
typedef unsigned char far * address;
#include <os2.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <lan_1_c.h>
#include <lan_2_c.h>
#include <lan_3_c.h>
#include <lan_4_c.h>
#include <lan_5_c.h>
#include <lan_6_c.h>
struct ccb2_form {
byte ccb_adapter;
byte ccb_command;
byte ccb_retcode;
byte ccb_work;
address ccb_pointer;
dword ccb_cmpl_flag;
word ccb_parm_offset;
word ccb_parameter_1;
dword ccb_semaphore;
byte ccb_appl_id;
byte ccb_read_flag;
word ccb_appl_key;
word ccb_parameter_2;
};
struct dlc_rcv_form
{
word station_id;
word user_length;
dword receive_flag;
address first_buffer;
byte options;
byte reseve1[3];
byte rcv_read_option;
};
void Receive(ApplicationID, SapID)
byte ApplicationID;
word SapID;
{
struct ccb2_form ControlBlock;
CHAR *Ptr;
USHORT ReturnCode;
address BadPtr;
struct dlc_rcv_form Receive;
memset((char far *) &ControlBlock, 0,
sizeof (struct ccb2_form));
memset((char far *) &Receive, 0,
sizeof (struct dlc_rcv_form));
Ptr = (char far *) &Receive;
ControlBlock.ccb_parm_offset = FP_OFF (Ptr);
ControlBlock.ccb_command = LLC_RECEIVE;
ControlBlock.ccb_retcode = 0xff;
ControlBlock.ccb_pointer = (unsigned char *)0L;
ControlBlock.ccb_cmpl_flag = 0x0001;
ControlBlock.ccb_appl_id = ApplicationID;
Receive.station_id = SapID;
ReturnCode = ACSLAN((char far *) &ControlBlock,
(CHAR FAR *)&BadPtr);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
typedef unsigned char byte;
typedef unsigned short int word;
typedef unsigned long int dword;
typedef unsigned char far * address;
#include <os2.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <lan_1_c.h>
#include <lan_2_c.h>
#include <lan_3_c.h>
#include <lan_4_c.h>
#include <lan_5_c.h>
#include <lan_6_c.h>
struct ccb2_form {
byte ccb_adapter;
byte ccb_command;
byte ccb_retcode;
byte ccb_work;
address ccb_pointer;
dword ccb_cmpl_flag;
word ccb_parm_offset;
word ccb_parameter_1;
dword ccb_semaphore;
byte ccb_appl_id;
byte ccb_read_flag;
word ccb_appl_key;
word ccb_parameter_2;
};
void ReceiveCancel(StationID)
word StationID;
{
struct ccb2_form ControlBlock;
USHORT ReturnCode;
address BadPtr;
memset((CHAR FAR *)&ControlBlock,0, sizeof(
struct ccb2_form));
ControlBlock.ccb_adapter = 0x00;
ControlBlock.ccb_command = LLC_RECEIVE_CANCEL;
ControlBlock.ccb_cmpl_flag = 0x0001;
ControlBlock.ccb_semaphore = 0x00;
ControlBlock.ccb_parm_offset = StationID;
ReturnCode = ACSLAN((CHAR FAR *)&ControlBlock,
(CHAR FAR *)&BadPtr);
printf("LLC_RECEIVE_CANCEL = %d", ReturnCode );
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
typedef unsigned char byte;
typedef unsigned short int word;
typedef unsigned long int dword;
typedef unsigned char far * address;
#include <os2.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <lan_1_c.h>
#include <lan_2_c.h>
#include <lan_3_c.h>
#include <lan_4_c.h>
#include <lan_5_c.h>
#include <lan_6_c.h>
struct ccb2_form {
byte ccb_adapter;
byte ccb_command;
byte ccb_retcode;
byte ccb_work;
address ccb_pointer;
dword ccb_cmpl_flag;
word ccb_parm_offset;
word ccb_parameter_1;
dword ccb_semaphore;
byte ccb_appl_id;
byte ccb_read_flag;
word ccb_appl_key;
word ccb_parameter_2;
};
struct dlc_transmit_form
{
word station_id;
byte transmit_fs;
byte rsap;
address xmit_queu_one;
address xmit_queu_two;
word buffer_len_one;
word buffer_len_two;
address buffer_one;
address buffer_two;
byte xmit_read_option;
};
void TransmitFrame(ApplicationID, LinkID, message)
byte ApplicationID;
word LinkID;
CHAR *message;
{
CHAR *Ptr;
USHORT ReturnCode;
address BadPtr;
struct ccb2_form ControlBlock;
struct dlc_transmit_form TransmitFrame;
/* reset structures */
memset((char far *) &ControlBlock, 0,
sizeof (struct ccb2_form));
memset((char far *) &TransmitFrame, 0,
sizeof (struct dlc_transmit_form));
/* set pointer to command specific parameter table */
Ptr = (char far *) &TransmitFrame;
ControlBlock.ccb_parm_offset = FP_OFF (Ptr);
/* set adapter and command code */
ControlBlock.ccb_adapter = 0x00;
ControlBlock.ccb_command = LLC_TRANSMIT_I_FRAME;
ControlBlock.ccb_retcode = 0xFF;
ControlBlock.ccb_cmpl_flag = 0x0001;
ControlBlock.ccb_appl_id = ApplicationID;
TransmitFrame.station_id = LinkID;
TransmitFrame.rsap = 0xA4;
TransmitFrame.buffer_len_one = strlen(message);
TransmitFrame.buffer_one = (address) message;
TransmitFrame.buffer_len_two = 0x0000;
TransmitFrame.buffer_two = (unsigned char *)0L;
ReturnCode = ACSLAN((CHAR FAR *) &ControlBlock,
(CHAR FAR *)&BadPtr);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*********************************************************************/
/* Include all OS/2 1.x definitions */
/*********************************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned NETB_RETC;
void add_group_name(loc_name)
char *loc_name;
{
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
/* insert name to be added */
strcpy(ncb1.ncb_name, loc_name);
ncb1.ncb_command = NB_ADD_GROUP_NAME_WAIT;
ncb1.ncb_lana_num = 0; /* use your adapter num here */
/* call NETBIOS */
NETB_RETC = NETBIOS((char far *) &ncb1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*******************************************************/
/* Include all OS/2 1.x definitions */
/*******************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned NETB_RETC;
void add__name(loc_name)
char *loc_name;
{
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
/* insert name to be added */
strcpy(ncb1.ncb_name, loc_name);
ncb1.ncb_command = NB_ADD_NAME_WAIT;
ncb1.ncb_lana_num = 0; /* use your adapter num here */
NETB_RETC = NETBIOS((char far *) &ncb1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*********************************************************************/
/* Include all OS/2 1.x definitions */
/*********************************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
/* definitions and externals */
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned far NETB_RETC;
char call_ncb(loc_name, remote_name)
char *loc_name,*remote_name;
{
/* first clear out structure */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
/* insert the local name */
strcpy(ncb1.ncb_name, loc_name);
/* insert the remote name */
strcpy(ncb1.ncb_callname, remote_name);
/* insert adapter number */
ncb1.ncb_lana_num = 0x0000;
ncb1.ncb_command = NB_CALL_WAIT;
/* these are the timeout values */
ncb1.ncb_rto = 0x0000;
ncb1.ncb_sto = 0x0000;
/* call NETBIOS */
NETB_RETC = NETBIOS((char far*) &ncb1);
return(ncb1.ncb_lsn);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*******************************************************/
/* Include all OS/2 1.x definitions */
/*******************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned NETB_RETC;
void delete__name(loc_name)
char *loc_name;
{
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
/* insert name to be added */
strcpy(ncb1.ncb_name, loc_name);
ncb1.ncb_command = NB_DELETE_NAME_WAIT;
ncb1.ncb_lana_num = 0; /* use your adapter num here */
NETB_RETC = NETBIOS((char far *) &ncb1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
struct name_info
{
struct ncb_find_name_info common;
BYTE header_len;
struct ncb_lan_header_entry LanInfo[10];
/* reserved space to hold 10 LAN headers */
} info;
struct ncb_lan_header_entry
{
byte lan_entry_length; /* Length of entry */
byte lan_pcf0; /* Physical control field 0 */
byte lan_pcf1; /* Physical control field 1 */
byte lan_destination_addr[6]; /* Destination address */
byte lan_source_addr[6]; /* Source address */
byte lan_routing_info[18]; /* Routing information */
};
/*******************************************************/
/* Include all OS/2 1.x definitions */
/*******************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned NETB_RETC;
void find__name(loc_name)
char *loc_name;
{
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
/* insert name to be found */
strcpy(ncb1.ncb_callname, loc_name );
ncb1.ncb_length = sizeof( info );
ncb1.ncb_buffer_address = (address)&info;
ncb1.ncb_command = NB_FIND_NAMEWAIT;
ncb1.ncb_lana_num = 0; /* use your adapter num here */
NETB_RETC = NETBIOS((char far *) &ncb1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*****************************************************/
/* Include all OS/2 1.x definitions */
/*****************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned far NETB_RETC;
void ncb_hang_up(lsn)
byte lsn; /* local session number */
{
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
ncb1.ncb_command = NB_HANG_UP_WAIT;
/* insert your adapter num here */
ncb1.ncb_lana_num = 0;
/* this is the local session num */
ncb1.ncb_lsn = lsn;
/* call NETBIOS */
NETB_RETC = NETBIOS((char far *) &ncb1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*****************************************************/
/* Include all OS/2 1.x definitions */
/*****************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned far retval,NETB_RETC;
/***********************************************************/
/* MSG.LISTEN */
/* */
/* This module enables a session to be opened with the */
/* name specified in the ncb_callname field, using the */
/* name specified by the ncb_name field */
/***********************************************************/
byte listen(cal_name,locc_name)
/* calling name */
char far * cal_name;
/* local name */
char far * locc_name;
{
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
ncb1.ncb_command = NB_LISTEN_WAIT;
/* insert your adapter num here */
ncb1.ncb_lana_num = 0X0000;
strcpy(ncb1.ncb_name,locc_name);
strcpy(ncb1.ncb_callname,cal_name);
/* time out values , 0 and no timeout will occur*/
ncb1.ncb_rto = 0x00;
ncb1.ncb_sto = 0x00;
/* call NETBIOS */
NETB_RETC = NETBIOS((char far *)&ncb1);
return(ncb1.ncb_lsn);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*****************************************************/
/* Include all OS/2 1.x definitions */
/*****************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned far retval,NETB_RETC;
char rec_buff[10]; /* receiving buffer */
/****************************************************/
/* MSG.RECEIVE */
/* */
/* This module receives data from the session */
/* partner that sends data to you. */
/****************************************************/
void msg_receive(lsn)
byte lsn; /* local session number */
{
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
ncb1.ncb_command = NB_RECEIVE_WAIT;
/* insert your adapter num here */
ncb1.ncb_lana_num = 0;
ncb1.ncb_lsn = lsn;
ncb1.ncb_buffer_address = (address) rec_buff;
/* length of rx buffer */
ncb1.ncb_length = 10;
NETB_RETC = NETBIOS((char far *) &ncb1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*****************************************************/
/* Include all OS/2 1.x definitions */
/*****************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned far retval,NETB_RETC;
char rec_buff[10]; /* receiving buffer */
/****************************************************/
/* MSG.RECEIVEANY */
/* */
/* This module receives data from any session */
/* partner that sends data to you. */
/****************************************************/
void msg_receive_any()
{
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
ncb1.ncb_command = NB_RECEIVE_ANY_WAIT;
/* insert your adapter num here */
ncb1.ncb_lana_num = 0;
/* set so will rx from ANY session we are
connected to */
ncb1.ncb_lsn = 0xFF;
ncb1.ncb_buffer_address = (address) rec_buff;
/* length of rx buffer */
ncb1.ncb_length = 10;
NETB_RETC = NETBIOS((char far *) &ncb1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*****************************************************/
/* Include all OS/2 1.x definitions */
/*****************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned far retval,NETB_RETC;
char rec_buff[10]; /* receiving buffer */
/****************************************************/
/* MSG.RECEIVEBROADCASTDATAGRAM */
/* */
/* This module receives a datagram message */
/* from any name on the network that issues */
/* an NCB.SEND.BROADCAST.DATAGRAM */
/****************************************************/
void msg_receive_broadcast_datagram(num)
byte num; /* returned from ADD_NAME */
{
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
ncb1.ncb_command = NB_RECEIVE_BROADCAST_DATAGRAM_W;
/* insert your adapter num here */
ncb1.ncb_lana_num = 0;
/* number of application program name */
ncb1.ncb_num = num;
ncb1.ncb_buffer_address = (address) rec_buff;
/* length of rx buffer */
ncb1.ncb_length = 10;
NETB_RETC = NETBIOS((char far *) &ncb1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*****************************************************/
/* Include all OS/2 1.x definitions */
/*****************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned far retval,NETB_RETC;
char rec_buff[10]; /* receiving buffer */
/****************************************************/
/* MSG.RECEIVE.DATAGRAM */
/* */
/* This module receives a datagram message */
/* from any name on the network that issues */
/* an NCB.SEND.DATAGRAM */
/****************************************************/
void msg_receive_datagram()
{
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
ncb1.ncb_command = NB_RECEIVE_DATAGRAM_WAIT;
/* insert your adapter num here */
ncb1.ncb_lana_num = 0;
/* want to rx from anybody on the network
so use FF */
ncb1.ncb_num = 0xFF;
ncb1.ncb_buffer_address = (address) rec_buff;
/* length of rx buffer */
ncb1.ncb_length = 10;
NETB_RETC = NETBIOS((char far *) &ncb1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/**************************************************/
/* Include all OS/2 1.x definitions */
/**************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned far NETB_RETC;
/***************************************************/
/* This function resets the local settings */
/***************************************************/
void reset_netbios()
{
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
ncb1.ncb_command = NB_RESET_WAIT;
/* insert your lan adapter number here */
ncb1.ncb_lana_num = 0X0000;
/* lsn = 0, means requesting resources */
ncb1.ncb_lsn = 0X00FF;
/* call NETBIOS */
NETB_RETC = NETBIOS((char far *) &ncb1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*****************************************************/
/* Include all OS/2 1.x definitions */
/*****************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned far retval,NETB_RETC;
char tx_buff[10]; /* receiving buffer */
/****************************************************/
/* MSG.SEND */
/* */
/* This module sends data to the session */
/* partner */
/****************************************************/
void msg_send(lsn)
byte lsn; /* local session number */
{
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
ncb1.ncb_command = NB_SEND_WAIT;
strcpy(tx_buff, "Message");
/* insert your adapter num here */
ncb1.ncb_lana_num = 0;
ncb1.ncb_lsn = lsn;
ncb1.ncb_buffer_address = (address) tx_buff;
/* length of rx buffer */
ncb1.ncb_length = strlen(tx_buff);
NETB_RETC = NETBIOS((char far *) &ncb1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*****************************************************/
/* Include all OS/2 1.x definitions */
/*****************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned far retval,NETB_RETC;
char tx_buff[10]; /* receiving buffer */
/****************************************************/
/* MSG.SEND.BROADCAST.DATAGRAM */
/* */
/* This module sends data to every station that */
/* has an NCB.RECEIVE.BROADCAST.DATAGRAM command */
/* outstanding. */
/****************************************************/
void msg_send_broadcast_datagram( num)
byte num; /* number returned from ADD_NAME */
{
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
ncb1.ncb_command = NB_SEND_BROADCAST_DATAGRAM_WAIT;
strcpy(tx_buff, "Message");
/* insert your adapter num here */
ncb1.ncb_lana_num = 0;
ncb1.ncb_num = num;
ncb1.ncb_buffer_address = (address) tx_buff;
/* length of rx buffer */
ncb1.ncb_length = strlen(tx_buff);
NETB_RETC = NETBIOS((char far *) &ncb1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*****************************************************/
/* Include all OS/2 1.x definitions */
/*****************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned far retval,NETB_RETC;
char tx_buff[10]; /* receiving buffer */
/****************************************************/
/* MSG.SEND.DATAGRAM */
/* */
/* This module sends data to the session */
/* partner */
/****************************************************/
void msg_send_datagram(lsn, callingname, num)
byte lsn; /* local session number */
char *callingname; /* name to send message to */
byte num; /* number of session to send message to */
{
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
ncb1.ncb_command = NB_SEND_DATAGRAM_WAIT;
strcpy(tx_buff, "Message");
/* insert your adapter num here */
ncb1.ncb_lana_num = 0;
ncb1.ncb_lsn = lsn;
/* insert name */
strcpy(ncb1.ncb_callname, callingname );
ncb1.ncb_num = num;
ncb1.ncb_buffer_address = (address) tx_buff;
/* length of rx buffer */
ncb1.ncb_length = strlen(tx_buff);
NETB_RETC = NETBIOS((char far *) &ncb1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*****************************************************/
/* Include all OS/2 1.x definitions */
/*****************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
struct stat2 {
BYTE local_session_number; /* Local session number */
BYTE session_state; /* State of session */
BYTE local_name[16]; /* Local name */
BYTE remote_name[16]; /* Remote name */
BYTE active_receives; /* # of RECEIVE cmnds out */
BYTE active_sends; /* # of SEND, CHAIN.SEND out */
};
struct s_status {
BYTE name_number_of_sessions; /* Name number for sessions */
BYTE sessions_using_name; /* # of sessions using name */
BYTE active_rcv_datagrams; /* # of receive datagrams out*/
BYTE active_receive_anys; /* # of RECEIVE.ANY cmnds out*/
struct stat2 info[100]; /* can hold up to 100 sessions*/
} sess_stat;
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned far retval,NETB_RETC;
call_session_status ()
{
int i;
int a,max;
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
ncb1.ncb_command = NB_SESSION_STATUS_WAIT;
/* insert your adapter num here */
ncb1.ncb_lana_num = 0;
strcpy (ncb1.ncb_name, "*");
/* status of all names will be returned
if an asterisk (*) is specified. */
ncb1.ncb_length=sizeof (struct s_status);
ncb1.ncb_buffer_address=(char far *)&sess_stat;
NETB_RETC = NETBIOS((char far *) &ncb1);
printf ( "-----------SESSION STATUS INFO -------------\n");
printf ( "Name number for sessions:%d.\n",
sess_stat.name_number_of_sessions);
printf ( "# of sessions using name:%d.\n",
sess_stat.sessions_using_name);
printf ( "# of receive datagrams out:%d.\n",
sess_stat.active_rcv_datagrams);
printf ( "# of RECEIVE.ANY cmnds out:%d.\n",
sess_stat.active_receive_anys);
a=0;
max=(ncb1.ncb_length-4) / 36;
while (a < max) {
printf ( "-------------------------------------\n");
printf ( " Local session number:%d.\n",
sess_stat.info[a].local_session_number);
printf ( " State of session:");
switch (sess_stat.info[a].session_state) {
case 1: printf ( "Listen outstanding.\n");
break;
case 2: printf ( "CALL pending.\n");
break;
case 3: printf ( "Session established.\n");
break;
case 4: printf ( "HANG UP pending.\n");
break;
case 5: printf ( "HANG UP complete.\n");
break;
case 6: printf ( "Session aborted.\n");
break;
}
printf ( " Local name:%s.\n",
sess_stat.info[a].local_name);
printf ( " Remote name:%s.\n",
sess_stat.info[a].remote_name);
printf ( " # of RECEIVE cmnds out:%d.\n",
sess_stat.info[a].active_receives);
printf ( " # of SEND, CHAIN.SEND out:%d.\n",
sess_stat.info[a].active_sends);
a++;
}
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/*****************************************************/
/* Include all OS/2 1.x definitions */
/*****************************************************/
#include <lan_7_c.h>
#include <stdio.h>
#include <netb_1_c.h>
#include <netb_2_c.h>
extern unsigned pascal far NETBIOS (char far *);
struct network_control_block ncb1;
unsigned far NETB_RETC;
/* include file from netb_2_c.h */
struct ncb_status_information
{
byte burned_in_addr[6]; /* Adapter's burned in addr */
byte reserved1[2]; /* RESERVED always X'0000' */
word software_level_number; /* X'FFnn' - nn is level num */
word reporting_period; /* reporting period (minutes)*/
word frmr_frames_received; /* Number of FRMR received */
word frmr_frames_sent; /* Number of FRMR sent */
word bad_iframes_received; /* # bad Iframes received */
word aborted_transmissions; /* # aborted transmits */
dword packets_transmitted; /* # Successfully transmitted*/
dword packets_received; /* # Successfully received */
word bad_iframes_transmitted; /* # bad Iframes transmitted */
word lost_data_count; /* Lost SAP buffer data cnt */
word t1_expiration_count; /* Number of T1 expirations */
word ti_expiration_count; /* Number of Ti expirations */
byte reserved2[4]; /* RESERVED always X'00...00'*/
word number_of_free_ncbs; /* Number of NCBs available */
word max_configured_ncbs; /* Configured NCB maximum */
word max_allowed_ncbs; /* Maximum NCBs (always 255) */
word busy_condition_count; /* Local station busy count */
word max_datagram_size; /* Maximum datagram packet */
word pending_sessions; /* Number of pending sessions*/
word max_configured_sessions; /* Configured session maximum*/
word max_allowed_sessions; /* Maximum sessions (254) */
word max_data_packet_size; /* Maximum session packet */
word number_of_names_present; /* Number of names in table */
};
call_status (callingname)
char *callingname;
{
/* structure to put return into */
struct ncb_status_information stat_info;
int i;
/* clear out control block */
memset((char far *) &ncb1,0,
sizeof(struct network_control_block));
ncb1.ncb_command = NB_STATUS_WAIT;
/* insert your adapter num here */
ncb1.ncb_lana_num= 0;
strcpy (ncb1.ncb_callname, callingname); /* call name */
ncb1.ncb_buffer_address=(char far *)&stat_info;
ncb1.ncb_length=sizeof(struct ncb_status_information);
NETB_RETC = NETBIOS((char far *) &ncb1);
printf ( "------------------ STATUS INFO ------------\n");
printf ( "Burned-in Name..................");
for (i = 0; i < 6; i++)
printf ( "%02X", stat_info.burned_in_addr[i]);
printf ( "\n");
printf ( "Software level number:..........%d.\n",
stat_info.software_level_number);
printf ( "reporting period (minutes):.....%d.\n",
stat_info.reporting_period);
printf ( "Number of FRMR received:........%d.\n",
stat_info.frmr_frames_received);
printf ( "Number of FRMR sent:............%d.\n",
stat_info.frmr_frames_sent);
printf ( "# bad Iframes received:.........%d.\n",
stat_info.bad_iframes_received);
printf ( "# aborted transmits:............%d.\n",
stat_info.aborted_transmissions);
printf ( "# Successfully transmitted:.....%ld\n",
stat_info.packets_transmitted);
printf ( "# Successfully received:........%ld\n",
stat_info.packets_received);
printf ( "# bad Iframes transmitted:......%d.\n",
stat_info.bad_iframes_transmitted);
printf ( "Lost SAP buffer data cnt:.......%d.\n",
stat_info.lost_data_count);
printf ( "Number of T1 expirations:.......%d.\n",
stat_info.t1_expiration_count);
printf ( "Number of Ti expirations:.......%d.\n",
stat_info.ti_expiration_count);
printf ( "Reserved2[4] (old extended_stat_addr)..%p.\n",
stat_info.reserved2);
printf ( "Number of NCBs available:.......%d.\n",
stat_info.number_of_free_ncbs);
printf ( "Configured NCB maximum:.........%d.\n",
stat_info.max_configured_ncbs);
printf ( "Maximum NCBs (always 255):......%d.\n",
stat_info.max_allowed_ncbs);
printf ( "Local station busy count:.......%d.\n",
stat_info.busy_condition_count);
printf ( "Maximum datagram packet:........%d.\n",
stat_info.max_datagram_size);
printf ( "Number of pending sessions:.....%d.\n",
stat_info.pending_sessions);
printf ( "Configured session maximum:.....%d.\n",
stat_info.max_configured_sessions);
printf ( "Maximum sessions (254):.........%d.\n",
stat_info.max_allowed_sessions);
printf ( "Maximum session packet:.........%d.\n",
stat_info.max_data_packet_size);
printf ( "Number of names in table:.......%d.\n",
stat_info.number_of_names_present);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define OS2_BASE
#include <os2.h>
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "subcalls.h"
#include "hapi_c.h"
USHORT DisplayEhllapiInfo(void);
USHORT DisplaySessionInfo(void);
USHORT ConnectPresentationSpace(void);
#define MAX_DATA_SIZE 3840
/* global variables */
UCHAR press_ent_msg[] =
"\n\nPress ENTER to continue...";
UCHAR dft_sess = NULL;
USHORT hfunc_num;
UCHAR hdata_str[MAX_DATA_SIZE];
USHORT hds_len;
USHORT hrc;
void cdecl main()
{
USHORT rc;
rc = DisplayEhllapiInfo();
/* wait for user key hit */
printf(press_ent_msg);
fgetchar();
rc = DisplaySessionInfo();
rc = ConnectPresentationSpace();
}
/* This functions calls QuerySystem and displays */
/* EHLLAPI version and date */
USHORT DisplayEhllapiInfo()
{
/* Set pointer to the qsys_struct */
/* defined in hapi_c.h */
struct qsys_struct * data_ptr =
(struct qsys_struct *)hdata_str;
USHORT i;
USHORT rc = 0;
hfunc_num = HA_QUERY_SYSTEM;
/* call EHLLAPI */
hllc(&hfunc_num, data_ptr, &hds_len, &hrc);
if (hrc == HARC_SUCCESS){
printf("\n EHLLAPI version: ");
fputchar(data_ptr->qsys_hllapi_ver);
printf("\n EHLLAPI realease date: ");
for (i=0;i <6;i++)
fputchar(data_ptr->qsys_hllapi_date[i]);
} /* end if */
}
/* This functions calls QuerySessions to find the status of */
/* all running sessions. Note the first session listed is */
/* actually this program */
USHORT DisplaySessionInfo()
{
/* set the pointer to the qses_struct */
/* defined in hapi_c.h */
struct qses_struct * data_ptr =
(struct qses_struct *)hdata_str;
struct qsst_struct sess_stuc;
USHORT i, j;
USHORT num_sess;
USHORT rc=0;
CHAR sesstype[9];
printf("\n Session Info\n\n");
hfunc_num = HA_QUERY_SESSIONS;
hds_len = MAX_DATA_SIZE / 12 * 12;
hllc(&hfunc_num, data_ptr, &hds_len, &hrc );
if (hrc == HARC_SUCCESS){
num_sess = hds_len;
printf("Number of started sessions = %d\n\n",
num_sess );
for (i=0;((i < num_sess) && (rc==0));i++){
printf("Session Number = %d", i+1 );
printf("\nSession Long name :");
for(j=0;j<8;j++){
if (data_ptr[i].qses_longname[j])
fputchar(data_ptr[i].qses_longname[j]);
}
printf("\nSession Short name:");
printf("%c",data_ptr[i].qses_shortname);
printf("\nSession Type:");
switch(data_ptr[i].qses_sestype){
case 'H':strcpy(sesstype, "HOST");
break;
case 'P':strcpy(sesstype, "PC");
break;
default:strcpy(sesstype, "UNKNOWN");
break;
}
printf(sesstype);
printf("\nSession PS size : %d",
data_ptr[i].qses_pssize );
hfunc_num = HA_QUERY_SESSION_STATUS;
hds_len = 18;
/* set sess_stuc shortname = */
/* to the shortname in the qses struct */
sess_stuc.qsst_shortname =
data_ptr[i].qses_shortname;
/* Call EHLLAPI */
hllc(&hfunc_num, &sess_stuc, &hds_len, &hrc );
if (hrc == HARC_SUCCESS){
printf("\nSession PS rows: %d",
sess_stuc.qsst_ps_rows);
printf("\nSession PS cols: %d",
sess_stuc.qsst_ps_cols);
} /* end if */
} /* end for */
} /* end if */
return (rc);
} /* end fn */
/* This functions connects a Presentation to Session A */
/* and then prints out what is currently visible */
/* Note: Change hdata_str[0] to the short session id */
/* of any currently running session */
USHORT ConnectPresentationSpace()
{
CHAR *strPresentation;
USHORT i, j;
strPresentation = (CHAR *)calloc(1, MAX_DATA_SIZE );
hfunc_num = HA_CONNECT_PS;
hdata_str[0] = 'A';
printf("\n");
hllc(&hfunc_num, hdata_str, &hds_len, &hrc );
if (hrc==HARC_SUCCESS){
hfunc_num = HA_COPY_PS_TO_STR;
hds_len = MAX_DATA_SIZE;
hrc = 1;
j=0;
hllc(&hfunc_num, strPresentation, &hds_len, &hrc);
if (hrc==HARC_SUCCESS){
while(j++ < hds_len && strPresentation)
fputchar(*strPresentation++);
}
}
/* clean up */
free(strPresentation);
hfunc_num = HA_DISCONNECT_PS;
hllc(&hfunc_num, hdata_str, &hds_len, &hrc );
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR
#include <os2.h>
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <netcons.h>
#include <neterr.h>
#include <config.h>
#define NULLSTRING (CHAR *)0;
/* ****************************************************/
/* The following prints out all values of parameters */
/* from IBMLAN.INI. Uses NetConfigGet2() and */
/* NetConfigGetAll2(). Prints out values */
/* The parameters used came from a IBMLAN.INI out of */
/* a requester */
/******************************************************
/* possible components */
char *components[] = {
"networks",
"requester",
"messenger",
"replicator",
"services"
};
/* parameters for networks component */
char *networkparm[] = {
"net1"
};
/* parameters for requester component */
char *requesterparm[] = {
"computername",
"domain",
"charcount",
"chartime",
"charwait",
"keepconn",
"keepsearch",
"maxcmds",
"maxerrorlog",
"maxthreads",
"maxwrkcache",
"numalerts",
"numcharbuf",
"numservices",
"numworkbuf",
"numdgrambuf",
"printbuftime",
"sesstimeout",
"sizcharbuf",
"sizerror",
"sizworkbuf",
"wrkheuristics",
"wrknets",
"wrkservices"
};
/* parameters for messenger component */
char *messangerparm[] = {
"logfile",
"sizmessbuf"
};
/* parameters for replicator component */
char *replicatorparm[] = {
"replicate",
"importpath",
"tryuser",
"password"
};
/* parameters for services component */
char *servicesparm[] = {
"requester",
"messenger",
"netpopup",
"replicator"
};
int cdecl main(void); /* definition*/
int cdecl main()
{
USHORT i, NumComponents=5, NumParameters, j, rc, k;
USHORT DataSizeAvailable; /* Buffer size */
USHORT DataSizeReturned; /* how much fn used */
CHAR *Buffer;
SEL Selector;
/* array containing num parms for each component */
static USHORT IntParmArray[] = {1,24,2,4,4 };
CHAR parameterarray[24][20]; /* generic char array */
/* allocate memory for data buffer */
DosAllocSeg(1024, &Selector, SEG_NONSHARED );
Buffer = MAKEP(Selector, 0 );
/* copy necessary parmeters into the generically */
/* used array */
for (i = 0; i < NumComponents; i++){
NumParameters = IntParmArray[i];
switch(i){
case 0:
for (k=0;k<NumParameters;k++)
strcpy(parameterarray[k], networkparm[k]);
break;
case 1:
for (k=0;k<NumParameters;k++)
strcpy(parameterarray[k], requesterparm[k]);
break;
case 2:
for (k=0;k<NumParameters;k++)
strcpy(parameterarray[k], messangerparm[k]);
break;
case 3:
for (k=0;k<NumParameters;k++)
strcpy(parameterarray[k], replicatorparm[k]);
break;
case 4:
for (k=0;k<NumParameters;k++)
strcpy(parameterarray[k], servicesparm[k]);
break;
}
for (j = 0; j < NumParameters; j++){
/* clear out the buffer */
memset(Buffer, 0, 1024);
rc = NetConfigGet2((CHAR *)0, (CHAR *)0,
components[i], parameterarray[j], Buffer,
1024, &DataSizeReturned);
if (rc)
printf("\nError in 1, RC = %d", rc );
else
printf(
"\n1.Comp: %s Parm: %s Value: %s",
components[i], parameterarray[j], Buffer );
memset(Buffer, 0, 1024);
} /* end for */
/* now do the GetAll Parameters call */
rc = NetConfigGetAll2((CHAR *)0, (CHAR *)0,
components[i], Buffer,
1024, &DataSizeReturned,
&DataSizeAvailable);
if (rc)
printf("\nError in 1, RC = %d", rc );
else {
printf("\nAll:Comp: %s Value: ",
components[i]);
for(k=0;k<DataSizeReturned;k++)
putchar(Buffer[k]);
} /* end else */
} /* end for i */
} /* end main */
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <shares.h> /* Used for NetConnectionEnum() */
/* structure found in shares.h */
/*
struct connection_info_1 {
unsigned short coni1_id;
unsigned short coni1_type;
unsigned short coni1_num_opens;
unsigned short coni1_num_users;
unsigned long coni1_time;
char far * coni1_username;
MAX User = UNLEN;
char far * coni1_netname;
MAX Netname = CNLEN;
};*/ /* connection_info_1 */
#define MAXENTRIES 40
void cdecl main(void);
void cdecl main()
{
SEL Selector1, Selector2;
struct connection_info_1 *Buffer[MAXENTRIES];
USHORT rc, BufLen, EntriesRead, TotalEntries;
USHORT TotalAvailable;
CHAR ServerName[32], Qualifier[32];
USHORT i;
/* allocate space for structure */
/* structure + space for pointers */
/* see Appendix H in LS 1.3 Program Ref */
BufLen = sizeof( struct connection_info_1 ) + CNLEN + 1 +
UNLEN + 1;
rc = DosAllocSeg( BufLen*MAXENTRIES, &Selector1,
SEG_NONSHARED );
for (i=0; i < MAXENTRIES; i++)
Buffer[i] = (struct connection_info_1 *)
MAKEP( Selector1,
i*sizeof( struct connection_info_1));
/* enter your server name here, notice 4 backslashes */
strcpy(ServerName, "\\\\TECHSUPP");
/* insert netname here, notice no backslashes */
/* aliases allowed */
strcpy(Qualifier, "DEPT_644");
rc = NetConnectionEnum( (CHAR FAR *)ServerName,
Qualifier,
1, (CHAR FAR *)Buffer[0], BufLen*MAXENTRIES,
&EntriesRead, &TotalEntries );
if (!rc){
printf("\nConnections to %s", Qualifier);
for (i = 0; i < EntriesRead; i++)
printf("\nUser: %s",Buffer[i]->coni1_username );
}
else
printf("\nError in NetConnectionEnum(), rc = %d",
rc );
DosFreeSeg(Selector1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/* Small example of server and requester designed to run on */
/* same machine. */
#define INCL_BASE
#define INCL_DOSMEMMGR
#include <os2.h>
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <netcons.h>
#include <neterr.h>
#include <config.h>
#include <mailslot.h>
#include <neterr.h>
int cdecl main(void);
int cdecl main()
{
unsigned hdlMailSlot;
/* mail slot handle */
CHAR FAR *Name;
/* name of other mailstation */
USHORT SlotSize=140;
USHORT MessageSize=140;
SEL Selector1, Selector2, Selector3;
/* selectors for memory */
USHORT rc;
/* return code */
CHAR FAR *Message, *RxMessage;
/* msg to be sent, and received, respectively */
USHORT NextSize, NextPriority, MsgCount, BytesRead;
/* assorted information from Read() */
/* allocate memory for name */
DosAllocSeg(40, &Selector1, SEG_NONSHARED );
Name = MAKEP(Selector1, 0 );
DosAllocSeg(120, &Selector2, SEG_NONSHARED );
Message = MAKEP(Selector2, 0 );
DosAllocSeg(120, &Selector3, SEG_NONSHARED );
RxMessage = MAKEP(Selector3, 0 );
/* this mailstation will be MailStation1 */
/* other session will be MailStation2 */
strcpy(Name, "\\mailslot\\MailStation1");
rc = DosMakeMailslot(Name, MessageSize, SlotSize,
&hdlMailSlot );
if (rc){
printf("Error in MakeMailslot, rc = %d", rc );
return (0);
}
/* for remote device need to change name to */
/* \\computername\mailslot\name */
strcpy(Name, "\\mailslot\\MailStation2");
strcpy(Message, "Message Sent from MailStation1");
do {
rc = DosWriteMailslot(Name, Message,
(USHORT)strlen(Message),
1, 1, 1000L );
printf("\nWriting Message, rc = %d", rc );
rc = DosReadMailslot(hdlMailSlot, RxMessage,
&BytesRead, &NextSize, &NextPriority,
-1 );
printf("\nReading Message, rc = %d ", rc );
if (BytesRead)
printf("\nMessage: %s", RxMessage );
DosSleep(500L);
}
while (strcmp(RxMessage, "Message Sent from MailStation2"));
/* keep going until we get the msg from Mailstation2 */
/* this last write is just in case we stopped writing too
soon */
DosSleep(2000L);
rc = DosWriteMailslot(Name, Message,
(USHORT)strlen(Message),
1, 1, -1 );
printf("\nWriting message, rc = %d", rc );
}
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h> /* Since the application starts a */
#include <mt\string.h> /* thread, we must use the */
#include <mt\stdlib.h> /* multithreaded include file. */
#include <mt\process.h> /* */
#include <netcons.h> /* definition of NetAPI constants */
#include <neterr.h> /* NetAPI error codes */
#include <config.h>
#include <mailslot.h>
#include <neterr.h>
int cdecl main(void);
int cdecl main()
{
unsigned hdlMailSlot;
CHAR FAR *Name;
USHORT SlotSize=140;
USHORT MessageSize=140;
SEL Selector1, Selector2, Selector3;
USHORT rc;
CHAR FAR *Message, *RxMessage;
USHORT NextSize, NextPriority, MsgCount, BytesRead;
/* allocate memory for name */
DosAllocSeg(40, &Selector1, SEG_NONSHARED );
Name = MAKEP(Selector1, 0 );
DosAllocSeg(120, &Selector2, SEG_NONSHARED );
Message = MAKEP(Selector2, 0 );
DosAllocSeg(120, &Selector3, SEG_NONSHARED );
RxMessage = MAKEP(Selector3, 0 );
/* name of this mailstation */
strcpy(Name, "\\mailslot\\MailStation2");
rc = DosMakeMailslot(Name, MessageSize, SlotSize,
&hdlMailSlot );
if (rc){
printf("Error in MakeMailslot, rc = %d", rc );
return (0);
}
/* Willbe writing to MailStation1 */
strcpy(Name, "\\mailslot\\MailStation1");
/* this is msg to be sent to mailstation1 */
strcpy(Message, "Message Sent from MailStation2");
do {
rc = DosWriteMailslot(Name, Message,
(USHORT)strlen(Message),
1, 1, -1 );
printf("\nWriting message, rc = %d", rc );
DosSleep(500L);
do {
rc = DosPeekMailslot(hdlMailSlot,
RxMessage, &BytesRead, &NextSize,
&NextPriority );
printf("\nPeeking...");
} while (!BytesRead);
printf("BytesRead = %d", BytesRead );
printf("\nMessage is %s", RxMessage );
printf("\nNextSize = %d NextPriority = %d",
NextSize, NextPriority );
/* clear out buffer */
memset(RxMessage, 0, 100 );
rc = DosReadMailslot(hdlMailSlot, RxMessage,
&BytesRead, &NextSize, &NextPriority,
-1 );
printf("\nReading message, rc = %d", rc );
if (BytesRead)
printf("\nMessage: %s", RxMessage );
else
printf("\nNo message");
DosSleep(500L);
}
while (strcmp(RxMessage, "Message Sent from MailStation1"));
/* keep going until we hear from the other mailstation */
/* last write, in case we stopped before the other side */
/* got the message */
DosSleep(2000L);
rc = DosWriteMailslot(Name, Message,
(USHORT)strlen(Message),
1, 1, -1 );
printf("\nWriting message, rc = %d", rc );
/* now get rid of mailslot */
rc = DosDeleteMailslot(hdlMailSlot);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h> /* Since the application starts a */
#include <mt\string.h> /* thread, we must use the */
#include <mt\stdlib.h> /* multithreaded include file. */
#include <mt\process.h> /* */
#include <netcons.h> /* definition of NetAPI constants */
#include <neterr.h> /* NetAPI error codes */
#include <config.h>
#include <message.h>
#define NULLSTRING (CHAR *)0;
/*
struct msg_info_0 {
char msgi0_name[CNLEN+1];
};
struct msg_info_1 {
char msgi1_name[CNLEN+1];
char msgi1_forward_flag;
unsigned char msgi1_pad1;
char msgi1_forward[CNLEN+1];
};
*/
struct nametable_0 {
struct msg_info_0 MsgInfo[20];
} NameTable;
int cdecl main(void);
int cdecl main()
{
SEL Selector1, Selector2, Selector3, Selector4, Selector5;
CHAR FAR *Server;
CHAR FAR *Filename;
CHAR FAR *Name;
CHAR FAR *Buffer;
CHAR FAR *ForwardName;
USHORT rc, i;
USHORT EntriesRead, TotalEntries;
USHORT LoggingOn;
struct msg_info_1 Info;
USHORT InfoAvailable;
DosAllocSeg( 20, &Selector1, SEG_NONSHARED );
DosAllocSeg( 20, &Selector2, SEG_NONSHARED );
DosAllocSeg( 64, &Selector3, SEG_NONSHARED );
DosAllocSeg( 64, &Selector4, SEG_NONSHARED );
DosAllocSeg( 64, &Selector4, SEG_NONSHARED );
Server = MAKEP(Selector1, 0 );
Name = MAKEP(Selector2, 0 );
Filename = MAKEP(Selector3, 0 );
Buffer = MAKEP(Selector4, 0 );
ForwardName = MAKEP(Selector4, 0 );
/* fill in the server to query */
/* note: use 4 \\ characters */
strcpy(Server, "\\\\TECHSUPP");
strcpy(Name, "TESTNAME");
rc = NetMessageNameAdd(Server, Name, 0 );
printf("Adding name TESTNAME, rc = %d", rc );
rc = NetMessageNameEnum(Server, 0, &NameTable,
sizeof(NameTable), &EntriesRead, &TotalEntries );
for (i = 0; i < EntriesRead; i++)
printf("\nEntry #%d: %s", i,
NameTable.MsgInfo[i].msgi0_name);
strcpy(Buffer, "Hello, World!");
/* fill in your requester name here */
strcpy(ForwardName, "KOREQ");
strcpy(Name, "TESTNAME");
/* now forward mail from newname to yourself */
rc = NetMessageNameFwd( Server, Name, ForwardName,
0 );
/* get a little info on the new name */
rc = NetMessageNameGetInfo( Server, Name,
1, &Info, sizeof(Info), &InfoAvailable );
printf("\nName: %s", Info.msgi1_name );
printf("\nFowarding is %s",
Info.msgi1_forward_flag?"ON":"OFF");
if (Info.msgi1_forward_flag)
printf("\nMail forwarded to: %s", Info.msgi1_forward );
/* now send a message to TESTNAME */
rc = NetMessageBufferSend( Server, Name, Buffer,
strlen(Buffer));
printf("\nSending Buffer, rc = %d", rc );
strcpy(Filename, "c:\\startup.cmd");
/* now take off forwarding */
rc = NetMessageNameUnFwd( Server, Name );
printf("\nUnforwarding, rc = %d", rc );
/* now disable logging */
rc = NetMessageLogFileSet( Server, (CHAR *)0, 0 );
printf("\nDisablng Logging, rc = %d", rc );
rc = NetMessageFileSend( Server, ForwardName, Filename );
printf("\nSending File, rc = %d", rc );
strcpy(Buffer, "c:\\ibmlan\\logs\\messages.log");
/* now get some info on the logging facility */
rc = NetMessageLogFileGet( Server, Buffer, 64,
&LoggingOn);
printf("\nGetting LogFile, rc = %d", rc );
printf("\nLog File is: %s ,Logging is %s", Buffer,
LoggingOn?"ON":"OFF");
/* now delete the name we added */
strcpy(Name, "TESTNAME");
rc = NetMessageNameDel( Server, Name, 1 );
printf("\nDeleting Name TESTNAME, rc = %d", rc );
/* and turn on logging */
rc = NetMessageLogFileSet( Server, (CHAR *)0, 1 );
printf("\nTurning on logging, rc = %d", rc );
} /* end main */
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <server.h> /* header for NetServer..() */
/*
struct server_info_1 {
char sv1_name[CNLEN + 1];
unsigned char sv1_version_major;
unsigned char sv1_version_minor;
unsigned long sv1_type;
char far * sv1_comment;
};
*/
#define NUMSERVERS 20
void cdecl main(void);
void cdecl main()
{
CHAR ServerName[32], Buffer[32], *p;
CHAR Domain[32], *Comment, *Return;
SEL Selector1, Selector2, Selector3, Selector4;
struct server_info_1 *ServerInfo, *Server[NUMSERVERS];
struct server_info_2 *Info;
USHORT rc, TotalAvailable, ServerInfoLen;
USHORT BufLen, EntriesRead,TotalEntries;
USHORT BytesRead, RemoteRC, BigBufSize;
CHAR *TempPtr;
USHORT i;
USHORT Value;
BigBufSize = 3000;
/* insert name of your server here */
/* notice 4 backslases */
strcpy(ServerName, "\\\\KOSER");
/* insert name of your domain here */
strcpy(Domain, "ADTSUPP");
/* memory allocation part */
BufLen = sizeof (struct server_info_1) +
MAXCOMMENTSZ + 1;
ServerInfoLen = sizeof( struct server_info_2) +
MAXCOMMENTSZ + 1 + PATHLEN + 1 + PATHLEN + 1
+ PATHLEN + 1;
rc = DosAllocSeg(ServerInfoLen, &Selector3,
SEG_NONSHARED );
rc = DosAllocSeg( BigBufSize, &Selector4,
SEG_NONSHARED);
Return = (CHAR *)MAKEP(Selector4, 0 );
Info = (struct server_info_2 *)MAKEP(Selector3, 0 );
/* Constants used here are */
/* found in Appendix H of Lan Server API Reference */
/* now allocate space for various structures needed */
rc = DosAllocSeg( BufLen, &Selector1, SEG_NONSHARED );
ServerInfo = (struct server_info_1 *)MAKEP(Selector1,0);
rc = DosAllocSeg(BufLen * NUMSERVERS, &Selector2,
SEG_NONSHARED );
for (i = 0; i < NUMSERVERS; i++)
Server[i] = (struct server_info_1 *)MAKEP(Selector2,
i * sizeof( struct server_info_1 ));
/* Because are only changing one value, use address */
/* for that one value */
/* instead of struct server_info * */
Value = SV_HIDDEN;
rc = NetServerSetInfo( ServerName, 2,
(CHAR FAR *)&Value, sizeof(Value),
SV_HIDDEN_PARMNUM);
if (!rc)
printf("\nServer is now Hidden");
else
printf("\nError in SetInfo, rc = %d", rc );
/* delay for change in Server */
memset(ServerInfo, 0, BufLen );
rc = NetServerGetInfo( ServerName, 2,
(CHAR FAR *)Info, ServerInfoLen, &TotalAvailable );
if (!rc ){
printf("\n Server Name: %s", Info->sv2_name );
printf("\n Server Version: %d.%d",
Info->sv2_version_major,
Info->sv2_version_minor);
printf("\n Server Type: ");
if (Info->sv2_type & SV_TYPE_WORKSTATION)
printf("Workstation, ");
if (Info->sv2_type & SV_TYPE_SERVER)
printf("Server, ");
if (Info->sv2_type & SV_TYPE_DOMAIN_CTRL)
printf("Domain Controller, ");
if (Info->sv2_type & SV_TYPE_DOMAIN_BAKCTRL)
printf("Backup Domain Controller, ");
if (Info->sv2_type & SV_TYPE_TIME_SOURCE)
printf("Time Server, ");
if (Info->sv2_type & SV_TYPE_NOVELL)
printf("Novell, ");
printf("\nServer is: %s", Info->sv2_hidden?
"Hidden":"Visible");
}
else
printf("\nError in GetInfo, rc = %d", rc );
rc = NetServerDiskEnum( ServerName, 0,
Buffer, 32, &EntriesRead, &TotalEntries );
if (!rc){
printf("\nDrives on Server: ");
for (p = Buffer, i=0; i < EntriesRead; i++, p+=3)
printf("%s,", p );
}
else
printf("Error in DiskEnum, rc = %d", rc );
rc = NetServerEnum2( ServerName, 1, (CHAR FAR *)Server[0],
BufLen * NUMSERVERS, &EntriesRead, &TotalEntries,
SV_TYPE_ALL, Domain );
if (!rc){
printf("\n Servers on Domain %s", Domain );
for (i = 0; i < EntriesRead; i++){
printf("\n\n Server Name: %s",
Server[i]->sv1_name );
printf("\n Server Version: %d.%d",
Server[i]->sv1_version_major,
Server[i]->sv1_version_minor);
printf("\n Server Type: ");
if (Server[i]->sv1_type & SV_TYPE_WORKSTATION)
printf("Workstation, ");
if (Server[i]->sv1_type & SV_TYPE_SERVER)
printf("Server, ");
if (Server[i]->sv1_type & SV_TYPE_DOMAIN_CTRL)
printf("Domain Controller, ");
if (Server[i]->sv1_type & SV_TYPE_DOMAIN_BAKCTRL)
printf("Backup Domain Controller, ");
if (Server[i]->sv1_type & SV_TYPE_TIME_SOURCE)
printf("Time Server, ");
if (Server[i]->sv1_type & SV_TYPE_NOVELL)
printf("Novell, ");
}
}
else
printf("\nError in ServerEnum, rc = %d", rc );
/* now do the admin command */
rc = NetServerAdminCommand( ServerName, "DIR C:\\",
&RemoteRC, Return, BigBufSize, &BytesRead,
&TotalAvailable );
if (!rc){
printf("\nReturned: \n");
for ( i = 0; i < BytesRead; i++)
printf("%c",*Return++);
}
else
printf("Error in ServerAdmin, rc = %d", rc );
Value = SV_VISIBLE;
rc = NetServerSetInfo( ServerName, 2,
(CHAR FAR *)&Value, sizeof(Value),
SV_HIDDEN_PARMNUM);
if (!rc)
printf("\nServer is now Visible");
else
printf("\nError in SetInfo, rc = %d", rc );
DosFreeSeg(Selector1);
DosFreeSeg(Selector2);
DosFreeSeg(Selector3);
DosFreeSeg(Selector4);
free(Comment);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h> /* Since the application starts a */
#include <mt\string.h> /* thread, we must use the */
#include <mt\stdlib.h> /* multithreaded include file. */
#include <mt\process.h> /* */
#include <netcons.h> /* definition of NetAPI constants */
#include <neterr.h> /* NetAPI error codes */
#include <service.h>
#define NULLSTRING (CHAR *)0;
int PrintStatus (USHORT );
int PrintInfo( struct service_info_2 *, USHORT );
/*
struct service_status {
unsigned short svcs_status;
unsigned long svcs_code;
unsigned short svcs_pid;
char svcs_text[STXTLEN+1];
};
struct service_info_2 {
char svci2_name[SNLEN+1];
unsigned short svci2_status;
unsigned long svci2_code;
unsigned short svci2_pid;
char svci2_text[STXTLEN+1];
};
*/
void cdecl main(void);
void cdecl main()
{
USHORT rc, i;
SEL Selector1;
struct service_info_2 *ServiceInfo[10];
CHAR Server[32], Service[32];
USHORT EntriesRead, TotalAvailable, Length;
CHAR *Ptr;
struct service_status Status;
Length = sizeof( struct service_info_2 );
rc = DosAllocSeg( Length * 10,
&Selector1, SEG_NONSHARED );
ServiceInfo[0] = MAKEP( Selector1, 0 );
for (i = 1; i < 10; i++)
ServiceInfo[i] = ServiceInfo[0] + i;
/* insert the name of your server here, NULL for local */
/* machine */
strcpy( Server, "\\\\TECHSUPP");
rc = NetServiceEnum ( Server, 2,
(CHAR FAR *)ServiceInfo[0],
sizeof (struct service_info_2) * 10,
&EntriesRead, &TotalAvailable );
if (rc ){
printf("rc = %d", rc );
exit(0);
}
for (i=0; i < EntriesRead; i++)
PrintInfo( ServiceInfo[i], i );
/* clear out memory */
Ptr = (CHAR *)ServiceInfo[0];
for (i=0; i< Length; i++)
*Ptr++ = 0;
/* will use requester */
strcpy(Service, "requester");
/* pause the requester */
rc = NetServiceControl( Server, Service,
SERVICE_CTRL_PAUSE,
SERVICE_CTRL_REDIR_COMM,
(CHAR FAR *)ServiceInfo[0],
Length );
/* interrogate the requester */
rc = NetServiceControl( Server, Service,
SERVICE_CTRL_INTERROGATE,
0, (CHAR FAR *)ServiceInfo[0],
Length );
/* print out info */
printf("\n\nResults from NetServiceControl ");
printf("after Pausing Requester ");
PrintInfo( ServiceInfo[0], 0 );
/* start the requester again*/
rc = NetServiceControl( Server, Service,
SERVICE_CTRL_CONTINUE, SERVICE_CTRL_REDIR_COMM,
(CHAR FAR *)ServiceInfo[0],
Length );
if (rc){
printf("\nError, Rc = %d", rc );
exit(0);
}
/* clear out memory */
Ptr = (CHAR *)ServiceInfo[0];
for (i=0; i< Length; i++)
*Ptr++ = 0;
rc = NetServiceGetInfo( Server, Service,2,
ServiceInfo[0], Length, &TotalAvailable );
printf("\nResults from NetServiceGetInfo ");
printf("after Unpausing Requester ");
PrintInfo( ServiceInfo[0], 0 );
} /* end main */
int PrintInfo( struct service_info_2 *Info , USHORT i)
{
printf("\n %d Name: %10s ",
i, Info->svci2_name);
PrintStatus( Info->svci2_status );
printf("\n Code: %ld(0x%lx)",Info->svci2_code,
Info->svci2_code );
printf("\n Primary Code: %d(0x%lx)",
Info->svci2_code & 0xFFFF0000 ,
Info->svci2_code & 0xFFFF0000 );
printf(" Secondary Code: %d(0x%lx)",
Info->svci2_code & 0x0000FFFF ,
Info->svci2_code & 0x0000FFFF );
printf("\n %d PID: %d Text: %s",i,
Info->svci2_pid,
strlen(Info->svci2_text)?
Info->svci2_text:"NULL");
return (0);
}
int PrintStatus( USHORT status )
{
USHORT Value; /* Value after mask */
/* 0000 0XXX 0000 0000 */
Value = status & 0x700;
if (Value==0x700)
printf("\nStatus: SERVICE_REDIR_PAUSED");
else {
if (Value == 0x400)
printf("\nStatus: SERVICE_REDIR_COMM_PAUSED");
if (Value == 0x200)
printf("\nStatus: SERVICE_REDIR_PRINT_PAUSED" );
if (Value == 0x100)
printf("\nStatus: SERVICE_REDIR_DISK_PAUSED ");
}
/* 0000 0000 00X0 0000 */
Value = status & 0x20;
if (Value)
printf("\nStatus: SERVICE_PAUSABLE");
else
printf("\nStatus: SERVICE_NOT_PAUSABLE");
/* 0000 0000 000X 0000 */
Value = status & 0x10;
if (Value)
printf(" Status: SERVICE_UNINSTALLABLE");
else
printf(" Status: SERVICE_NOT_UNINSTALLABLE");
/* 0000 0000 0000 XX00 */
Value = status & 0x0C;
if (Value == 0x0C)
printf("\nStatus: SERVICE_PAUSED");
else {
if (Value == 0x08)
printf("\nStatus: SERVICE_PAUSE_PENDING");
if (Value == 0x04)
printf("\nStatus: SERVICE_CONTINUE_PENDING");
if (Value == 0x00)
printf("\nStatus: SERVICE_ACTIVE");
}
/* 0000 0000 0000 00XX */
Value = status & 0x03;
if (Value == 0x03)
printf(" Status: SERVICE_INSTALLED ");
else {
if (Value == 0x02)
printf(" Status: SERVICE_UNINSTALL_PENDING");
if (Value == 0x01)
printf(" Status: SERVICE_INSTALL_PENDING");
if (Value == 0x00)
printf(" Status: SERVICE_UNINSTALLED");
}
return (0);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <shares.h> /* header for NetSession..() */
/*
struct session_info_2 {
char far * sesi2_cname; MAX: CNLEN+1
char far * sesi2_username; MAX: UNLEN+1
unsigned short sesi2_num_conns;
unsigned short sesi2_num_opens;
unsigned short sesi2_num_users;
Note: Documentation does not agree with .h files
for sesi2_time (DOC VS: sesi2_sess_time );
unsigned long sesi2_time;
unsigned long sesi2_idle_time;
unsigned long sesi2_user_flags;
char far * sesi2_cltype_name;
}
*/
#define NUMENTRIES 30
void cdecl main(void);
void cdecl main()
{
CHAR ServerName[32], Workstation[32];
SEL Selector1, Selector2;
struct session_info_2 *Buffer, *Entries[NUMENTRIES];
USHORT i, rc, TotalEntries, EntriesRead;
USHORT TotalAvailable, BufLen;
/* insert name of your server here */
/* note use of 4 backslashes in C */
strcpy(ServerName, "\\\\TECHSUPP");
BufLen = sizeof (struct session_info_2) +
CNLEN + 1 + UNLEN + 1 + 14;
/* now add space for strings */
/* found in Appendix H of Lan Server API Reference */
rc = DosAllocSeg( BufLen*NUMENTRIES, &Selector1,
SEG_NONSHARED );
for (i = 0; i < NUMENTRIES ; i++)
Entries[i] = (struct session_info_2 *)MAKEP(Selector1,
i*sizeof( struct session_info_2) );
rc = NetSessionEnum(ServerName, 2, Entries[0],
BufLen*NUMENTRIES, &EntriesRead, &TotalEntries );
if (!rc){
for (i = 0; i< EntriesRead; i++){
printf("\n\nNumber %d Computer: %s",
i, Entries[i]->sesi2_cname );
printf("\nUser: %s ",
Entries[i]->sesi2_username );
}
}
else
printf("rc = %d", rc );
printf("\nEnter number of computer to get info on: ");
scanf("%d", &i );
/* allocate memory */
rc = DosAllocSeg(BufLen, &Selector2, SEG_NONSHARED );
Buffer = (struct session_info_2 *)MAKEP(Selector2, 0 );
/* add the necessary backslashes (4 in a C program ) */
sprintf(Workstation,"\\\\%s",Entries[i]->sesi2_cname);
rc = NetSessionGetInfo((CHAR FAR *)ServerName, Workstation,
2, (CHAR FAR *)Buffer, BufLen, &TotalAvailable );
if (!rc){
printf("\n\nInformation for Computer %s",
Buffer->sesi2_cname );
printf("\nUser: %s", Buffer->sesi2_username );
printf("\nNumber of Connections: %d",
Buffer->sesi2_num_conns );
printf("\nNumber of Opens: %d",
Buffer->sesi2_num_opens );
printf("\nNumber of Sessions: %d",
Buffer->sesi2_num_users );
printf("\nTime Active: %ld",
Buffer->sesi2_time );
printf("\nTime Idle: %ld",
Buffer->sesi2_idle_time );
if (Buffer->sesi2_user_flags & SESS_GUEST)
printf("\nUser is GUEST");
if (Buffer->sesi2_user_flags & SESS_NOENCRYPTION)
printf("\nUser has not used password encryption");
}
else
printf("\nError in GetInfo, rc = %d", rc );
/* clean up */
DosFreeSeg(Selector1);
DosFreeSeg(Selector2);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <netcons.h> /* definition of NetAPI constants */
#include <neterr.h> /* NetAPI error codes */
#include <access.h>
#include <wksta.h> /* header for NetWksta..() */
/* structure defined in wksta.h */
/* and access.h */
/*
struct user_logon_info_1 {
unsigned short usrlog1_code;
char usrlog1_eff_name[UNLEN+1];
char usrlog1_pad_1;
unsigned short usrlog1_priv;
unsigned long usrlog1_auth_flags;
unsigned short usrlog1_num_logons;
unsigned short usrlog1_bad_pw_count;
unsigned long usrlog1_last_logon;
unsigned long usrlog1_last_logoff;
unsigned long usrlog1_logoff_time;
unsigned long usrlog1_kickoff_time;
long usrlog1_password_age;
unsigned long usrlog1_pw_can_change;
unsigned long usrlog1_pw_must_change;
char far * usrlog1_computer;
char far * usrlog1_domain;
char far * usrlog1_script_path;
unsigned long usrlog1_reserved1;
};
*/
int PrintValues( struct wksta_info_0 *);
void cdecl main(void);
void cdecl main()
{
SEL Selector1, Selector2;
CHAR Server[32];
USHORT rc, TotalAvailable, BufLen;
struct wksta_info_0 *Info;
USHORT CharWait;
USHORT LogOffLen;
struct user_logoff_info_1 *LogOffInfo;
/* call uses space behind structure for data */
/* need to allocate size of structure + room */
/* for data */
LogOffLen = sizeof (struct user_logoff_info_1 ) + 256;
BufLen = sizeof( struct wksta_info_0);
rc = DosAllocSeg(BufLen + 256,
&Selector1, SEG_NONSHARED);
rc = DosAllocSeg(LogOffLen, &Selector2, SEG_NONSHARED);
/* make pointers */
Info = (struct wksta_info_0 *)MAKEP(Selector1, 0 );
LogOffInfo = (struct user_logoff_info_1 *)
MAKEP(Selector2, 0 );
/* enter name of your server here */
strcpy(Server, "\\\\TECHSUPP");
/* now find out some info about wksta */
rc = NetWkstaGetInfo( Server, 0, (CHAR FAR *)Info,
sizeof (struct wksta_info_0) + 256 ,
&TotalAvailable);
/* print out return values */
if (rc )
printf("Error in GetInfo, rc = %d", rc );
else
PrintValues ( Info );
/* now we're going to up the charwait */
/* variable by 256 */
CharWait = Info->wki0_charwait ;
Info->wki0_charwait = CharWait + 256;
rc = NetWkstaSetInfo( Server, 0, (CHAR FAR *)Info,
sizeof (Info),
WKSTA_CHARWAIT_PARMNUM );
if (rc)
printf("Error in SetInfo, rc = %d", rc );
else
PrintValues ( Info );
/* set it back the way it was */
rc = NetWkstaSetInfo( Server, 0, (CHAR FAR *)Info,
sizeof (Info),
WKSTA_CHARWAIT_PARMNUM );
if (rc)
printf("Error in SetInfo, rc = %d", rc );
else
PrintValues ( Info );
/* WARNING: THIS WILL LOG YOU OFF */
/* now we're going to log off */
rc = NetWkstaSetUID2( NULL, NULL,
NULL, NULL, "",
WKSTA_LOTS_OF_FORCE, 1, LogOffInfo, LogOffLen,
&TotalAvailable );
if (rc)
printf("\n LoggOff Failed, rc = %d", rc );
else {
printf("\n\n USER Logged OFF");
printf("\nTime On: %ul",
LogOffInfo->usrlogf1_duration);
printf(" Number of Logongs: %d",
LogOffInfo->usrlogf1_num_logons);
}
} /* end main */
int PrintValues ( struct wksta_info_0 *Info )
{
/* print out return values */
if (Info->wki0_computername )
printf("\n\nComputername: %s",
Info->wki0_computername );
if (Info->wki0_username)
printf("\nUserName : %s", Info->wki0_username );
if (Info->wki0_langroup)
printf("\nGroup : %s", Info->wki0_langroup );
printf("\nVersion : %d.%d", Info->wki0_ver_major,
Info->wki0_ver_minor);
printf("\nCharwait : %d", Info->wki0_charwait);
return (0);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
/* NOTE: AUDITING must be turned on in IBMLAN.INI */
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h> /* Since the application starts a*/
#include <mt\string.h> /* thread, we must use the */
#include <mt\stdlib.h> /* multithreaded include file. */
#include <mt\process.h> /* */
#include <time.h>
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <audit.h> /* header for NetAudit..() */
void cdecl main(void);
void cdecl main()
{
CHAR ServerName[32], BackUpFile[32];
CHAR TypeStr[40], ComputerName[15];
CHAR UserName[15];
SEL Selector1;
struct audit_entry *AuditLog;
struct ae_sesslogoff *SessionEnded;
USHORT rc, TotalAvailable;
USHORT BytesRead;
USHORT NameOffset;
USHORT UserOffset;
USHORT BufLen;
USHORT Type;
HLOG LogHandle;
CHAR *Buffer;
USHORT LineCounter=0;
/* insert name of your server here */
strcpy(ServerName, "\\\\KOSER");
strcpy(BackUpFile, "AUDLOG.BAK");
BufLen = 1500 ;
rc = DosAllocSeg( BufLen , &Selector1, SEG_NONSHARED );
Buffer = (CHAR FAR *)MAKEP(Selector1, 0 );
/* put our dummy error info at end of Read Buffer */
SessionEnded = (struct ae_sesslogoff *)MAKEP(Selector1,
1000);
/* clear out audit file */
rc = NetAuditClear( ServerName,
BackUpFile, NULL);
if(!rc)
printf("\nError Log has been cleared");
else
printf("\nLogClear failed, rc = %d", rc );
/* now we're going to enter a fake error */
/* start name right at end of fixed data */
/* structure */
NameOffset = sizeof(struct ae_sesslogoff);
Type = AE_SESSLOGOFF;
/* UserOffset = NameOffset + strlen(name) */
/* + NULL */
UserOffset = NameOffset + 6;
/* put in computername */
strcpy((CHAR *)SessionEnded+NameOffset, "KOSER");
/* put in username */
strcpy((CHAR *)SessionEnded+UserOffset, "OREILLY");
SessionEnded->ae_sf_compname = NameOffset;
SessionEnded->ae_sf_username = UserOffset;
/* size of write buffer = 500 bytes */
rc = NetAuditWrite( Type, (CHAR FAR *)SessionEnded, 500,
NULL, NULL);
if (!rc)
printf("\nWrote to Log File");
else
printf("\nLogWrite failed, rc = %d", rc );
/* set up log handle for read from beginning*/
LogHandle.time = 0L;
LogHandle.last_flags = 0L;
LogHandle.offset = 0xFFFFFFFF;
LogHandle.last_flags = 0xFFFFFFFF;
do {
/* read in a thousand bytes */
rc = NetAuditRead( ServerName, NULL, &LogHandle,
0L, NULL, 0L, 0L, Buffer, 1000, &BytesRead,
&TotalAvailable );
if (rc){
printf("LogRead failed, rc = %d", rc );
exit(0);
}
for (AuditLog = Buffer;
/* cast to struct * after ptr addition */
AuditLog < (struct audit_entry *)
(Buffer + BytesRead); ){
if (LineCounter == 23){
printf("Press any key for next page");
getch();
LineCounter = 0;
}
LineCounter++;
switch(AuditLog->ae_type){
case AE_SRVSTATUS:
strcpy(TypeStr,"Server Status Changed");
break;
case AE_SESSLOGON:
strcpy(TypeStr,"Session was logged on");
break;
case AE_SESSLOGOFF:
/* case to struct * after ptr addition*/
SessionEnded =
(struct ae_sesslogoff *)
((char *)AuditLog+
AuditLog->ae_data_offset);
strcpy(TypeStr,"Session was logged off");
strcpy(ComputerName,(char *)SessionEnded
+ SessionEnded->ae_sf_compname);
strcpy(UserName,(char *)SessionEnded +
SessionEnded->ae_sf_username);
break;
default:
strcpy(TypeStr, "OTHER Type of Audit");
break;
}
printf("\nType: %-30s Time: %-40s",
TypeStr,
/* convert the time to a string */
ctime(&(AuditLog->ae_time)));
printf("\nComputer: %s", ComputerName);
printf(" User: %s", UserName);
AuditLog = (struct audit_entry *)
((char *)AuditLog +
AuditLog->ae_len);
}
} while ((rc == 0) && (BytesRead != 0));
DosFreeSeg(Selector1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h> /* Since the application starts a*/
#include <mt\string.h> /* thread, we must use the */
#include <mt\stdlib.h> /* multithreaded include file. */
#include <mt\process.h> /* */
#include <time.h>
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <errlog.h> /* header for NetError..() */
void cdecl main(void);
void cdecl main()
{
CHAR ServerName[32], BackUpFile[32];
SEL Selector1;
struct error_log *ErrorLog;
USHORT rc, TotalAvailable;
USHORT BytesRead;
USHORT BufLen;
HLOG LogHandle;
CHAR *Buffer;
USHORT LineCounter=0;
/* insert name of your server here */
strcpy(ServerName, "\\\\KOSER");
strcpy(BackUpFile, "ERRLOG.BAK");
BufLen = 1000;
rc = DosAllocSeg( BufLen , &Selector1, SEG_NONSHARED );
Buffer = (CHAR FAR *)MAKEP(Selector1, 0 );
/* this is for the LogRead() */
LogHandle.time = 0L;
LogHandle.last_flags = 0L;
LogHandle.offset = 0xFFFFFFFF;
LogHandle.last_flags = 0xFFFFFFFF;
/* clear out log file, back up saved */
rc = NetErrorLogClear( ServerName,
BackUpFile, NULL);
if(!rc)
printf("\nError Log has been cleared");
else
printf("\nLogClear failed, rc = %d", rc );
/* now we're going to enter a fake error */
rc = NetErrorLogWrite( NULL, NERR_InternalError,
"NET", NULL, 0, NULL, 0, NULL);
if (!rc)
printf("\nWrote to Log File");
else
printf("\nLogWrite failed, rc = %d", rc );
do {
/* now read the errors in file */
rc = NetErrorLogRead( ServerName, NULL, &LogHandle,
0L, NULL, 0L, 0L, Buffer, 1000, &BytesRead,
&TotalAvailable );
if (rc){
printf("LogRead failed, rc = %d", rc );
exit(0);
}
for (ErrorLog = Buffer;
ErrorLog < (struct error_log *)
(Buffer + BytesRead); ){
if (LineCounter == 23){
printf("Press any key for next page");
getch();
LineCounter = 0;
}
LineCounter++;
printf("\nError: %u Service: %s Time: %s",
ErrorLog->el_error, ErrorLog->el_name ,
ctime(&(ErrorLog->el_time)));
/* ptr arithmetic here, add the length of */
/* log rec (el_len) to ErrorLog to get */
/* address of */
/* new record (notice char * casting to */
/* use addition of 1 char increments */
/* rather than sizeof (struct error_log */
/* increments */
ErrorLog = (struct error_log *)((char *)ErrorLog
+ ErrorLog->el_len);
}
} while ((rc == 0) && (BytesRead != 0));
DosFreeSeg(Selector1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h> /* Since the application starts a*/
#include <mt\string.h> /* thread, we must use the */
#include <mt\stdlib.h> /* multithreaded include file. */
#include <mt\process.h> /* */
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <shares.h>
#define FILERIGHTS_READ 0x1
#define FILERIGHTS_WRITE 0x2
#define FILERIGHTS_CREATE 0x4
void cdecl main(void);
void cdecl main()
{
CHAR Server[32];
CHAR FAR *Start;
USHORT rc, i;
USHORT EntriesRead, TotalEntries, TotalAvailable;
SEL Selector1, Selector2;
USHORT BufLen;
struct file_info_3 *Info[30], *Buffer;
FRK Resume;
/* Set up for Resume Key */
FRK_INIT(Resume);
/* allocate space for 30 entry,
structure + dynamic data */
BufLen = sizeof( struct file_info_3) +
UNLEN + 1L + PATHLEN;
rc = DosAllocSeg(BufLen * 30, &Selector1,
SEG_NONSHARED);
/* now allocate space for GetInfo call */
rc = DosAllocSeg(BufLen , &Selector2, SEG_NONSHARED);
/* set up data buffer */
for ( i = 0; i < 30; i++)
Info[i] = (struct file_info_3 *)MAKEP(Selector1,
i * sizeof( struct file_info_3) );
Start = (CHAR FAR *)&Info[0];
/* make pointer for GetInfo call */
Buffer = (struct file_info_3 *)MAKEP(Selector2,
0 );
/* insert the name of your favorite server here */
strcpy(Server, "\\\\TECHSUPP");
rc = NetFileEnum2(Server, (CHAR FAR *)0,
(CHAR FAR *)0, 3, (CHAR FAR *)Info[0],
BufLen*30 , &EntriesRead, &TotalEntries,
&Resume );
printf("EntriesRead = %d", EntriesRead );
for (i = 0 ; i < EntriesRead; i++){
printf("\n Entry #%d", i );
printf(" Name = %-40s",
Info[i]->fi3_pathname[0]?Info[i]->fi3_pathname:
"NULL");
printf(" Id= %ld", Info[i]->fi3_id );
}
printf("\n Enter number of Entry to display");
printf(" information on: ");
scanf("%d", &i );
rc = NetFileGetInfo2( Server, Info[i]->fi3_id,
3, (CHAR FAR *)Buffer, BufLen, &TotalAvailable );
printf("\n ID = %ld", Buffer->fi3_id );
printf("\n Permissions = ");
if (Buffer->fi3_permissions & FILERIGHTS_READ )
printf("FILE_READ " );
if (Buffer->fi3_permissions & FILERIGHTS_WRITE )
printf("FILE_WRITE " );
if (Buffer->fi3_permissions & FILERIGHTS_CREATE )
printf("FILE_CREATE " );
printf("\n NumLocks = %d", Buffer->fi3_num_locks );
printf("\n PathName = %s", Buffer->fi3_pathname );
printf("\n UserName = %s", Buffer->fi3_username );
printf("\nEnter number of Entry to close, ");
printf("10 to exit: ");
scanf("%d", &i );
if (i != 10 ){
rc = NetFileClose2(Server, Info[i]->fi3_id );
if (!rc)
printf("\nFile %s closed",
Info[i]->fi3_pathname );
else
printf("\nError in closing file, rc = %d",
rc );
}
DosFreeSeg(Selector1);
DosFreeSeg(Selector2);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h> /* Since the application starts a*/
#include <mt\string.h> /* thread, we must use the */
#include <mt\stdlib.h> /* multithreaded include file. */
#include <mt\process.h> /* */
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <shares.h>
#define NULLSTRING (CHAR *)0;
/*
struct file_info_3 {
unsigned long fi3_id;
unsigned short fi3_permissiolns;
unsigned short fi3_num_locks;
char far * fi3_pathname;
char far * fi3_username;
};
*/
void cdecl main(void);
void cdecl main()
{
CHAR Server[32];
USHORT rc, i;
USHORT EntriesRead, TotalEntries;
SEL Selector1;
USHORT BufLen;
struct file_info_3 *Info[30];
FRK Resume;
CHAR FAR *Start;
/* Set up for Resume Key */
FRK_INIT(Resume);
/* allocate space for 30 entries,
arrays + dynamic data */
BufLen = sizeof( struct file_info_3) +
UNLEN + 1L + PATHLEN;
rc = DosAllocSeg(BufLen*30, &Selector1, SEG_NONSHARED);
/* set up array of structure */
for (i= 0; i < 30; i++)
Info[i] = MAKEP(Selector1,
i*sizeof( struct file_info_3) );
/* insert the name of your favorite server here */
strcpy(Server, "\\\\TECHSUPP");
Start = (CHAR FAR *)&Info[0];
rc = NetFileEnum2(Server, (CHAR FAR *)0,
(CHAR FAR *)0, 3, (CHAR FAR *)Info[0],
BufLen * 30, &EntriesRead, &TotalEntries,
&Resume );
if (rc)
printf("\nError in NetFileEnum2, RC = %d", rc );
else {
/* if no errors, see what is open */
printf("\nEntries read = %d", EntriesRead );
printf("\nTotal Entries = %d", TotalEntries );
for (i=0; i < EntriesRead; i++){
printf(
"\nEntry #: %d Id: %ld Permissions: %d ",
i, Info[i]->fi3_id,
Info[i]->fi3_permissions);
printf(
"\nName: %s User: %s",
Info[i]->fi3_pathname[0]?
Info[i]->fi3_pathname:"NULL",
Info[i]->fi3_username[0]?
Info[i]->fi3_username:"NULL");
}
}
} /* end main */
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <mt\conio.h>
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <chardev.h> /* header for NetHandle()... */
/*
Structure found in chardev.h
struct handle_info_2 {
char far *hdli2_username;
};
struct handle_info_1 {
unsigned long hdli1_chartime;
unsigned short hdli1_charcount;
};
*/
#define MAXENTRIES 300
void cdecl main(void);
void cdecl main()
{
USHORT rc, BufLen;
struct handle_info_2 *HandleInfo;
struct handle_info_1 HandleSet;
USHORT Handle;
USHORT TotalAvailable;
USHORT Value;
SEL Selector1;
/* insert number of handle to get info on */
Handle = 10;
BufLen = sizeof (struct handle_info_21 *) + 60;
rc = DosAllocSeg(BufLen, &Selector1, SEG_NONSHARED);
HandleInfo = (struct handle_info_2 *)MAKEP(Selector1,0);
rc = NetHandleGetInfo(Handle, 2,
(CHAR FAR *)HandleInfo,
BufLen,
&TotalAvailable );
if (!rc){
printf("\nHANDLE INFO:");
printf("\nUserName = %s", HandleInfo->hdli2_username );
}
else
printf("\nGetInfo() failed, rc = %d", rc );
/* NOTE: if handle specified is not open, rc will be 87 */
/* ERROR_INVALID_PARAMETER */
/* set the character count before sending to be 20 */
Value = 20;
rc = NetHandleSetInfo( Handle, 1, &Value, sizeof(Value),
HANDLE_SET_CHAR_COUNT);
if (!rc)
printf("\nHandleInfo successfully set");
else
printf("\nSetInfo() failed, rc = %d", rc );
DosFreeSeg(Selector1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <remutil.h> /* header for NetRemote..() */
#include <use.h> /* header for redirections */
void cdecl main(void);
void cdecl main()
{
CHAR ServerName[32], SourcePath[32], RemoteName[32];
CHAR FailedObject[64], ReturnCodes[64];
CHAR EnvStrings[2], ArgsStrings[13];
SEL Selector1;
struct use_info_1 *Buffer;
USHORT rc;
USHORT BufLen, OpenFlags, CopyFlags;
struct copy_info CopyInfo;
struct move_info MoveInfo;
struct time_of_day_info TimeInfo;
/* insert name of your server here */
strcpy(ServerName, "\\\\KOSER");
/* allocate space for each entry */
/* structure + space for pointers */
BufLen = sizeof( struct use_info_1 ) + DEVLEN + 1 + PWLEN
+ 1 + RMLEN + 1;
rc = DosAllocSeg( BufLen, &Selector1, SEG_NONSHARED );
Buffer = (struct use_info_1 *)MAKEP(Selector1, 0 );
/* we're going to make it our T drive */
strcpy(Buffer->ui1_local, "T:");
/* specify server and directory */
/* take note of backslashes */
/* use a RemoteName available on your network */
strcpy(RemoteName, "\\\\TECHSUPP\\DEPT_644");
Buffer->ui1_remote = RemoteName;
Buffer->ui1_password = (CHAR FAR *)0;
Buffer->ui1_asg_type = USE_DISKDEV;
rc = NetUseAdd((CHAR FAR *)0, 1, (CHAR FAR *)Buffer,
BufLen );
printf("\n NetUseAdd, Added U: ,rc = %d", rc );
/* now copy a file to another place */
OpenFlags = 0x0012;
CopyFlags = MUST_BE_FILE;
rc = NetRemoteCopy("T:\\KO\\TIPS.INF",
"T:\\KO\\TIPSINF.TST",
NULL,
NULL,
OpenFlags,
CopyFlags,
&CopyInfo,
sizeof(struct copy_info));
printf("\nNetRemoteCopy returned %d", rc );
rc = NetRemoteTOD( ServerName, &TimeInfo,
sizeof( struct time_of_day_info ));
if (!rc){
printf("\nDate on Server %s", ServerName );
printf(": %d/%d/%d", TimeInfo.tod_month,
TimeInfo.tod_day, TimeInfo.tod_year );
printf(" Time: %d:%d:%d", TimeInfo.tod_hours,
TimeInfo.tod_mins, TimeInfo.tod_secs);
}
else
printf("Error in RemoteTOD, rc = %d", rc );
/* notice the way args are set up */
/* one null after program name */
/* two nulls at end of string */
ArgsStrings[0] = 'E';
ArgsStrings[1] = '\0';
ArgsStrings[2] = 'T';
ArgsStrings[3] = 'E';
ArgsStrings[4] = 'S';
ArgsStrings[5] = 'T';
ArgsStrings[6] = '.';
ArgsStrings[7] = 'D';
ArgsStrings[8] = 'O';
ArgsStrings[9] = 'C';
ArgsStrings[10] = ArgsStrings[11] = '\0';
EnvStrings[0] = EnvStrings[1] = '\0';
rc = NetRemoteExec( -1L, FailedObject,
64, EXEC_SYNC, ArgsStrings,
EnvStrings, ReturnCodes, "E.EXE",
NULL, 0 );
if (!rc)
printf("\nExecuting Editor");
else
printf("\nRemoteExec failed, rc = %d", rc );
rc = NetRemoteMove( "T:\\KO\\TIPSINF.TST",
"T:\\KO\\TIPSINF2.TST",
NULL, NULL, OpenFlags, MUST_BE_FILE,
&MoveInfo, sizeof( struct move_info));
if (!rc)
printf("\nTIPSINF.TST moved to TIPSINF2.TST");
else
printf("\nRemoteMove failed, rc = %d", rc );
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h> /* Since the application starts a */
#include <mt\string.h> /* thread, we must use the */
#include <mt\stdlib.h> /* multithreaded include file. */
#include <mt\process.h> /* */
#include <netcons.h> /* definition of NetAPI constants */
#include <neterr.h> /* NetAPI error codes */
#include <netstats.h>
#define NULLSTRING (CHAR *)0;
/*
struct stat_workstation_0 {
unsigned long stw0_start;
unsigned long stw0_numNCB_r;
unsigned long stw0_numNCB_s;
unsigned long stw0_numNCB_a;
unsigned long stw0_fiNCB_r;
unsigned long stw0_fiNCB_s;
unsigned long stw0_fiNCB_a;
unsigned long stw0_fcNCB_r;
unsigned long stw0_fcNCB_s;
unsigned long stw0_fcNCB_a;
unsigned long stw0_sesstart;
unsigned long stw0_sessfailcon;
unsigned long stw0_sessbroke;
unsigned long stw0_uses;
unsigned long stw0_usefail;
unsigned long stw0_autorec;
unsigned long stw0_bytessent_r_high;
unsigned long stw0_bytessent_r_low;
unsigned long stw0_bytesrcvd_r_high;
unsigned long stw0_bytesrcvd_r_low;
unsigned long stw0_bytessent_s_high;
unsigned long stw0_bytessent_s_low;
unsigned long stw0_bytesrcvd_s_high;
unsigned long stw0_bytesrcvd_s_low;
unsigned long stw0_bytessent_a_high;
unsigned long stw0_bytessent_a_low;
unsigned long stw0_bytesrcvd_a_high;
unsigned long stw0_bytesrcvd_a_low;
unsigned long stw0_reqbufneed;
unsigned long stw0_bigbufneed;
};
*/
int cdecl main(void);
int cdecl main()
{
CHAR Server[32], Service[32];
struct stat_workstation_0 Info;
USHORT Buflen, TotalAvailable;
USHORT rc;
ULONG Options;
Server[0] = 0;
strcpy(Service, "REQUESTER");
Buflen = sizeof ( struct stat_workstation_0);
Options = STATSOPT_CLR;
rc = NetStatisticsGet2 ( Server, Service, 0L,
0, Options, (CHAR FAR *)&Info, Buflen,
&TotalAvailable );
if (rc){
printf("rc = %d", rc );
exit(0);
}
printf("\nStartTime: %lu", Info.stw0_start );
printf("\nTotal NCB's Issued - Redirector: %lu",
Info.stw0_numNCB_r );
printf("\nTotal NCB's Issued - Server : %lu",
Info.stw0_numNCB_s );
printf("\nTotal NCB's Issued - Application: %lu",
Info.stw0_numNCB_a );
printf("\nTotal NCB's Failed Issue - Redirector: %lu",
Info.stw0_fiNCB_r );
printf("\nTotal NCB's Failed Issue - Server : %lu",
Info.stw0_fiNCB_s );
printf("\nTotal NCB's Failed Issue - Application: %lu",
Info.stw0_fiNCB_a );
printf("\nTotal NCB's Failed Completion - Redirector: %lu",
Info.stw0_fcNCB_r );
printf("\nTotal NCB's Failed Completion - Server : %lu",
Info.stw0_fcNCB_s );
printf("\nTotal NCB's Failed Completion - Application: %lu",
Info.stw0_fcNCB_a );
printf("\nNumber of requester sessions started : %lu",
Info.stw0_sesstart );
printf("\nNumber of requester sessions failing connection: %lu",
Info.stw0_sessfailcon );
printf("\nNumber of requester sessions broken: %lu",
Info.stw0_sessbroke );
printf("\nNumber of requester uses: %lu",
Info.stw0_uses );
printf("\nNumber of requester use failure: %lu",
Info.stw0_usefail );
printf("\nNumber of requester auto-connects: %lu",
Info.stw0_autorec );
printf("\nNumber of requester bytes sent to network(high): %lu",
Info.stw0_bytessent_r_hi);
printf("\nNumber of requester bytes sent to network(low): %lu",
Info.stw0_bytessent_r_lo);
printf("\nNumber of requester bytes rcvd to network(high): %lu",
Info.stw0_bytesrcvd_r_hi);
printf("\nNumber of requester bytes rcvd to network(low): %lu",
Info.stw0_bytesrcvd_r_lo);
printf("\nNumber of server bytes sent to network(high): %lu",
Info.stw0_bytessent_s_hi);
printf("\nNumber of server bytes sent to network(low): %lu",
Info.stw0_bytessent_s_lo);
printf("\nNumber of server bytes rcvd to network(high): %lu",
Info.stw0_bytesrcvd_s_hi);
printf("\nNumber of server bytes rcvd to network(low): %lu",
Info.stw0_bytesrcvd_s_lo);
printf("\nNumber of application bytes sent to network(high): %lu",
Info.stw0_bytessent_a_hi);
printf("\nNumber of application bytes sent to network(low): %lu",
Info.stw0_bytessent_a_lo);
printf("\nNumber of application bytes rcvd to network(high): %lu",
Info.stw0_bytesrcvd_a_hi);
printf("\nNumber of application bytes rcvd to network(low): %lu",
Info.stw0_bytesrcvd_a_lo);
printf("\nNumber of times req needed reqbuf but alloc failed: %lu",
Info.stw0_reqbufneed );
printf("\nNumber of times req needed bigbuf but alloc failed: %lu",
Info.stw0_bigbufneed );
} /* end main */
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h> /* Since the application starts a*/
#include <mt\string.h> /* thread, we must use the */
#include <mt\stdlib.h> /* multithreaded include file. */
#include <mt\process.h> /* */
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <use.h>
/*
struct use_info_1 {
char ui1_local[DEVLEN+1];
char ui1_pad_1;
char far * ui1_remote;
char far * ui1_password;
unsigned char ui1_status;
unsigned char ui1_asg_type;
unsigned char ui1_refcount;
unsigned char ui1_usecount;
}
*/
void cdecl main(void);
void cdecl main()
{
SEL Selector1, Selector2;
struct use_info_1 *Buffer, *Info[30];
USHORT rc, BufLen, EntriesRead, TotalEntries;
USHORT TotalAvailable;
CHAR RemoteName[32], Status[45],Type[45];
USHORT i;
/* allocate space for each entry */
/* structure + space for pointers */
BufLen = sizeof( struct use_info_1 ) + DEVLEN + 1 + PWLEN
+ 1 + RMLEN + 1;
rc = DosAllocSeg( BufLen, &Selector1, SEG_NONSHARED );
Buffer = (struct use_info_1 *)MAKEP(Selector1, 0 );
/* we're going to make it our U drive */
strcpy(Buffer->ui1_local, "U:");
/* specify server and directory */
/* take note of backslashes */
strcpy(RemoteName, "\\\\JLWSRVR\\GRAPHICS");
/* use a RemoteName available on your network */
Buffer->ui1_remote = RemoteName;
Buffer->ui1_password = (CHAR FAR *)0;
rc = NetUseAdd((CHAR FAR *)0, 1, (CHAR FAR *)Buffer,
BufLen );
printf("\n NetUseAdd, Added U: ,rc = %d", rc );
/* now allocate space for 30 entries */
rc = DosAllocSeg( BufLen*30, &Selector2, SEG_NONSHARED );
for (i=0;i < 30; i++)
Info[i] = MAKEP(Selector2,
i*sizeof( struct use_info_1));
/* if Server is specified, will tell you redirections on */
/* Server, if NULL, will tell you local redirections */
rc = NetUseEnum( (CHAR FAR *)0, 1, (CHAR FAR *)Info[0],
BufLen*30, &EntriesRead, &TotalEntries );
printf("\n NetUseEnum: rc = %d Entries = %d",
rc, EntriesRead );
for (i=0; i < EntriesRead; i++)
printf("\nEntry #%d Name: %-40s", i,
Info[i]->ui1_remote );
/* for GetInfo specify local device name (U:) */
rc = NetUseGetInfo((CHAR FAR *)0, "U:", 1,
(CHAR FAR *)Buffer, BufLen, &TotalAvailable);
if (!rc){
printf("\n\n NetUseGetInfo Returned:");
printf("\nRemoteName: %s", Buffer->ui1_remote );
printf("\nLocalName : %s", Buffer->ui1_local );
switch(Buffer->ui1_status){
case 0:
strcpy(Status, "Connection valid");
break;
case 1:
strcpy(Status, "Paused by Local Requester");
break;
/* 2 can either be session removed */
/* OR Connection Disconnected */
case 2:
strcpy(Status, "Session Removed, Disconnected");
break;
case 3:
strcpy(Status, "Network Error");
break;
case 4:
strcpy(Status, "Connection being Made");
break;
case 5:
strcpy(Status, "Reconnecting");
break;
}
printf("\nStatus : %s", Status );
switch(Buffer->ui1_asg_type){
case -1:
strcpy(Type, "NULL Local Device");
break;
case 0:
strcpy(Type,"Disk Device");
break;
case 1:
strcpy(Type,"Spooled Printer");
break;
case 2:
strcpy(Type,"Serial Device");
break;
case 3:
strcpy(Type,"IPC");
break;
}
printf("\nType: %s", Type );
printf("\nResources Open: %d", Buffer->ui1_refcount );
printf("\nExplicit Connections: %d",
Buffer->ui1_usecount);
}/* if rc == 0 */
else
printf("\nNet UseGetInfo RC = %d", rc );
/* Now delete the U: drive */
rc = NetUseDel( (CHAR FAR *)0, "U:", USE_FORCE );
printf("\nDeleted U:, rc = %d", rc );
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <mt\conio.h>
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <alert.h> /* header for NetAlert()... */
/*
struct std_alert
{
long alrt_timestamp;
char alrt_eventname[EVLEN+1];
char alrt_pad1;
char alrt_servicename[SNLEN+1];
};
*/
void cdecl main(void);
void cdecl main()
{
USHORT rc, BufLen;
USHORT BufUsed;
struct std_alert *Alert;
SEL Selector1;
CHAR *MsgText;
/* allocate a big buffer */
BufLen = 1000;
rc = DosAllocSeg(BufLen, &Selector1, SEG_NONSHARED);
Alert = (struct std_alert *)MAKEP(Selector1, 0 );
strcpy(Alert->alrt_eventname, ALERT_MESSAGE_EVENT);
strcpy(Alert->alrt_servicename, "TESTSVC");
/* macro to put MsgText at end of Alert structure */
/* see header alert.h */
MsgText = ALERT_OTHER_INFO(Alert);
strcpy(MsgText,"TRIAL RUN");
BufUsed = sizeof( struct std_alert) + strlen(MsgText) +1;
/* defines are found in alert.h */
rc = NetAlertRaise( ALERT_MESSAGE_EVENT, (CHAR FAR *)Alert,
BufUsed, ALERT_MED_WAIT);
if (!rc)
printf("\nAlert was raised");
else
printf("\nError in AlertRaise(), rc = %d", rc );
DosFreeSeg(Selector1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <mt\conio.h>
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <access.h>
#include <shares.h> /* header for NetShare..() */
/*
structure found in shares.h
struct share_info_1 {
char shi1_netname[NNLEN+1];
char shi1_pad1;
unsigned short shi1_type;
char far * shi1_remark;
};
struct share_info_2 {
char shi2_netname[NNLEN+1];
char shi2_pad1;
unsigned short shi2_type;
char far * shi2_remark;
unsigned short shi2_permissions;
unsigned short shi2_max_uses;
unsigned short shi2_current_uses;
char far * shi2_path;
char shi2_passwd[SHPWLEN+1];
char shi2_pad2;
};
*/
#define MAXENTRIES 300
static char *Types[] = {"Disk Drive", "Spooler Queue",
"Serial Device", "IPC"};
void cdecl main(void);
void cdecl main()
{
CHAR ServerName[32];
CHAR BasePath[25], NetName[25];
CHAR Comment[40];
USHORT DeviceType;
USHORT rc, BufLen, i, AddLen;
struct share_info_2 *ShareAdd;
SEL Selector1, Selector2;
USHORT EntriesRead, TotalAvailable;
/* use double backslashes with servername */
/* insert name of your server here */
strcpy(ServerName, "\\\\KOSER");
/* defines are found in Appendix H */
/* of LS Prog Ref 1.3 */
BufLen = sizeof( struct share_info_1 ) +
MAXCOMMENTSZ + 1;
/* Allocate one big buffer */
rc = DosAllocSeg(BufLen * MAXENTRIES, &Selector1,
SEG_NONSHARED );
ShareInfo = (struct share_info_1 *)
MAKEP( Selector1, 0);
rc = DosAllocSeg(1000, &Selector2, SEG_NONSHARED);
ShareAdd = (struct share_info_2 *)
MAKEP(Selector2, 0 );
/* clear our memory */
memset(ShareAdd,0, sizeof(struct share_info_2));
strcpy(NetName, "OHNO");
strcpy(ShareAdd->shi2_netname, NetName);
ShareAdd->shi2_type = STYPE_DISKTREE;
strcpy(BasePath, "C:\\IBMLAN");
ShareAdd->shi2_path = BasePath;
/* no password */
ShareAdd->shi2_passwd[0] = '\0';
/* unlimited uses */
ShareAdd->shi2_max_uses = -1;
/* give read, write, and exec permissions */
ShareAdd->shi2_permissions = ACCESS_READ & ACCESS_WRITE
& ACCESS_EXEC;
/* defines found in Appendix H referenced above */
AddLen = sizeof(struct share_info_2) + PATHLEN + 1
+ MAXCOMMENTSZ + 1;
rc = NetShareAdd( ServerName, 2,
(CHAR FAR *)ShareAdd, AddLen);
if (!rc)
printf("Resource successfully added");
else
printf("ShareAdd() failed, rc = %d", rc );
rc = NetShareEnum( ServerName, 1,
(CHAR FAR *)ShareInfo,
BufLen * MAXENTRIES, &EntriesRead,
&TotalAvailable );
if (!rc){
for (i = 0; i < EntriesRead; i++){
printf("\nName: %-15s Type: %s",
ShareInfo->shi1_netname,
Types[ShareInfo->shi1_type] );
/* increment ptr to next structure */
ShareInfo++;
}
}
else
printf("\nShareEnum failed, rc = %d", rc );
rc = NetShareCheck( ServerName, NetName,
&DeviceType);
if (!rc)
printf("\nServer is sharing device %s of type %s",
NetName, Types[DeviceType]);
else
if (rc == NERR_DeviceNotShared)
printf("\nDevice %s is NOT being shared",
NetName);
else
printf("\nShareCheck() failed, rc = %d", rc );
/* since only changing one item, pass Comment */
/* instead of whole structure */
strcpy(Comment,"COMMENTCOMMENTCOMMENTETC");
rc = NetShareSetInfo( ServerName, NetName,
2, Comment, strlen(Comment) + 1,
SHI_REMARK_PARMNUM);
if (!rc)
printf("\nComment successfully added");
else
printf("\nSetInfo() failed, rc = %d", rc );
/* clear out for re-use */
memset(ShareAdd, 0, AddLen );
rc = NetShareGetInfo( ServerName, NetName, 2,
(CHAR FAR *)ShareAdd, AddLen, &TotalAvailable );
if (!rc){
printf("\nInfo on Resource: %s", NetName );
printf("\nPath: %s", ShareAdd->shi2_path );
printf("\nType: %s", Types[ShareAdd->shi2_type]);
printf("\nNumber of Current Connections: %d",
ShareAdd->shi2_current_uses );
printf("\nRemark: %s", ShareAdd->shi2_remark);
}
else
printf("\nGetInfo() failed, rc = %d", rc );
/* now delete the resource we created */
rc = NetShareDel(ServerName, NetName, 0 );
if (!rc)
printf("\nResource deleted");
else
printf("\nShareDel() failed, rc = %d", rc );
/*clean up */
DosFreeSeg(Selector1);
DosFreeSeg(Selector2);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <mt\conio.h>
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <access.h> /* header for NetGroup..() */
/*
struct access_info_1 {
char far * acc1_resource_name;
short acc1_attr;
short acc1_count;
};
struct access_list {
char acl_ugname[UGLEN+1];
char acl_ugname_pad_1;
short acl_access;
};
Structures are arranged in buffer as follows:
AccessInfo | first resource
AccessList | followed by acc1_count number
AccessList | of AccessList structures
...
AccessInfo |second resource
AccessList | etc..
AccessList | etc..
...
*/
#define MAXENTRIES 300
void cdecl main(void);
void cdecl main()
{
CHAR ServerName[32];
CHAR BasePath[32];
USHORT rc, BufLen, i;
USHORT j, LineCtr=0;
struct access_list *AccessList;
SEL Selector1;
USHORT EntriesRead, TotalAvailable, NumEntries;
strcpy(ServerName, "\\\\TECHSUPP");
strcpy(BasePath, "C:\\");
/* BufLen should be sizeof struct + (sizeof*/
/* struct access_list * number of access */
/* permissions ) */
BufLen = sizeof( struct access_info_1 ) +
60 + 1;
NumEntries = MAXENTRIES;
/* Allocate one big buffer */
rc = DosAllocSeg(BufLen * NumEntries, &Selector1,
SEG_NONSHARED );
AccessInfo = (struct access_info_1 *)
MAKEP( Selector1, 0);
rc = NetAccessEnum( ServerName, BasePath,
1, 1, (CHAR FAR *)AccessInfo,
BufLen * NumEntries, &EntriesRead,
&TotalAvailable );
if (!rc){
printf("\nAccess Permission Records are:");
for (i=0; i < EntriesRead; i++){
if (LineCtr == 23){
printf("\n Press any key");
getch();
LineCtr = 0;
}
printf("\n\nName: %s",
AccessInfo->acc1_resource_name );
LineCtr++;
/* put the first access list struct after */
/* one AccessInfo struct */
AccessList = (struct access_list *)
(AccessInfo + 1);
for (j = 0; j < AccessInfo->acc1_count; j++){
if (LineCtr == 23){
printf("\n Press any key");
getch();
LineCtr = 0;
}
printf("\nUsers: %s", AccessList->acl_ugname);
LineCtr++;
/* need to increment AccessList struct */
/* by one AccessList structure */
AccessList++;
}
/* Put the next AccessInfo struct at the */
/* end of all the access_list structures */
AccessInfo = (struct access_info_1 *)AccessList;
}
}
else
printf("\nAccessEnum failed, rc = %d", rc );
DosFreeSeg(Selector1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <access.h> /* header for NetGroup..() */
/*
struct access_info_1 {
char far * acc1_resource_name;
short acc1_attr;
short acc1_count;
};
struct access_list {
char acl_ugname[UGLEN+1];
char acl_ugname_pad_1;
short acl_access;
};
Structures are arranged in buffer as follows:
AccessInfo | first resource
AccessList | followed by acc1_count number
AccessList | of AccessList structures
...
AccessInfo |second resource
AccessList | etc..
AccessList | etc..
...
*/
#define MAXENTRIES 300
void cdecl main(void);
void cdecl main()
{
CHAR ServerName[32];
CHAR BasePath[32], UserName[15];
USHORT rc, BufLen, i;
struct access_list *AccessList;
SEL Selector1;
USHORT ReturnCode, TotalAvailable;
/* insert name of your server here */
strcpy(ServerName, "\\\\KOSER");
/* insert name of some resource here */
strcpy(BasePath, "C:\\IBMLAN");
/* inert name of some user here */
strcpy(UserName, "OREILLY");
/* Memory Allocation stuff */
/* BufLen should be sizeof struct + (sizeof*/
/* struct access_list * number of access */
/* permissions ) */
BufLen = sizeof( struct access_info_1 ) + PATHLEN + 1+
sizeof( struct access_list) * 5;
rc = DosAllocSeg(BufLen, &Selector1, SEG_NONSHARED);
AccessInfo = (struct access_info_1 *)
MAKEP(Selector1, 0 );
/* set up info for AccessAdd() */
AccessInfo->acc1_resource_name = BasePath;
/* want auditing */
AccessInfo->acc1_attr = 1;
/* going to add 1 set users */
AccessInfo->acc1_count = 1;
/* put AccessList struct at end of AccessInfo struct */
AccessList = (struct access_list *)(AccessInfo + 1);
strcpy(AccessList->acl_ugname, UserName);
AccessList->acl_access = ACCESS_READ | ACCESS_WRITE;
rc = NetAccessAdd( ServerName, 1, (CHAR FAR *)AccessInfo,
BufLen );
if (!rc)
printf("\nAccess successfully added");
else
printf("\nAccessAdd() failed, rc = %d", rc );
rc = NetAccessCheck( NULL, UserName, BasePath,
ACCESS_READ, &ReturnCode);
if (!rc)
printf("\nUser %s has %s rights in %s",
UserName, ReturnCode?"NO READ":"READ",
BasePath);
else
printf("\nAccessCheck() failed, rc = %d", rc );
rc = NetAccessGetInfo( ServerName, BasePath,
1, (CHAR FAR *)AccessInfo, BufLen, &TotalAvailable );
if (!rc){
/* AccessList is at end of structure AccessInfo */
printf("\nInfo on %s", BasePath);
AccessList = (struct access_list *)(AccessInfo+1);
for (i = 0; i < AccessInfo->acc1_count; i++){
printf("\nUser: %s", AccessList->acl_ugname );
printf(" Access: 0x%x",
AccessList->acl_access);
/* now go on to next AccessList struct */
AccessList++;
}
}
else
printf("\nGetInfo() failed, rc = %d", rc );
rc = NetAccessGetUserPerms( ServerName,UserName,
BasePath, &ReturnCode);
if (!rc){
printf("\nPermissions for User %s: ", UserName);
if (ReturnCode & ACCESS_READ)
printf(" READ");
if (ReturnCode & ACCESS_WRITE)
printf(" WRITE");
}
else
printf("GetUserPerms() failed, rc = %d", rc );
/* now delete the access permissions */
rc = NetAccessDel(ServerName, BasePath);
if (!rc)
printf("\n%s Access Deleted", BasePath);
else
printf("AccessDel failed, rc = %d", rc );
DosFreeSeg(Selector1);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <access.h> /* header for NetGroup..() */
/*
these structures are in access.h, here for
reference only.
struct group_info_1 {
char grpi1_name[GNLEN + 1];
char grpi1_pad_1;
char far *grpi1_comment;
};
struct group_users_info_0 {
char grui0_name[UNLEN + 1];
};
*/
#define MAXGROUPS 20
void cdecl main(void);
void cdecl main()
{
CHAR ServerName[32], GroupName[15];
CHAR *Comment;
struct group_info_1 *GroupInfo;
struct group_info_1 *GroupEnum[MAXGROUPS];
struct group_users_ino_0 *GroupUsers;
SEL Selector1, Selector2;
USHORT rc, i;
USHORT BufLen, TotalAvailable;
USHORT EntriesRead;
/* insert name of server here */
/* this is our primary server */
strcpy(ServerName, "\\\\TECHSUPP");
/* name of some dummy group to add */
strcpy(GroupName, "DGROUP");
/* do memory allocation for fns */
BufLen = sizeof (struct group_info_1) + MAXCOMMENTSZ + 1;
rc = DosAllocSeg( BufLen, &Selector1, SEG_NONSHARED );
rc = DosAllocSeg( BufLen * MAXGROUPS, &Selector2,
SEG_NONSHARED );
GroupInfo = (struct group_info_1 *)MAKEP(Selector1, 0 );
for (i=0; i < MAXGROUPS; i++)
GroupEnum[i] = (struct group_info_1 *)MAKEP(Selector2,
i*sizeof( struct group_info_1));
strcpy(GroupInfo->grpi1_name, GroupName);
/* Now add the Group */
rc = NetGroupAdd(ServerName, 1, (CHAR FAR *)
GroupInfo, BufLen );
if (!rc)
printf("Group Successfully Added");
else
printf("Error in GroupAdd, rc = %d", rc );
/* now see if our group shows up */
rc = NetGroupEnum( ServerName, 1, (CHAR FAR *)GroupEnum[0],
BufLen*MAXGROUPS, &EntriesRead, &TotalAvailable);
if (!rc){
printf("\nGroups on Server:");
for (i = 0; i < EntriesRead; i++)
printf("\nGroup: %s", GroupEnum[i]->grpi1_name );
}
else
printf("\nGroupEnum Failed, rc = %d", rc );
/* now we're going to add some dummy comment */
Comment = (CHAR *)calloc(1, 40 );
strcpy(Comment, "GROUPCOMMENT");
GroupInfo->grpi1_comment = Comment;
/* note: 2 is the magic number of change */
/* comment field */
rc = NetGroupSetInfo( ServerName,
GroupName, 1, (CHAR FAR *)Comment,
40 , 2);
if (!rc)
printf("\nComment added ");
else
printf("\nError in SetInfo, rc = %d", rc );
/* Now Get Info to see if Comment shows up */
rc = NetGroupGetInfo( ServerName,
GroupName, 1, (CHAR FAR *)GroupInfo,
BufLen, &TotalAvailable );
if (!rc){
printf("\nGroup: %s", GroupInfo->grpi1_name );
printf("\nComment: %s", GroupInfo->grpi1_comment );
}
else
printf("\nError in GetInfo, rc = %d", rc );
/* now delete group */
rc = NetGroupDel(ServerName, GroupName );
if (!rc)
printf("\nGroup Successfully Deleted");
else
printf("\nError in GroupDel, rc = %d", rc );
/* clean up */
DosFreeSeg(Selector1 );
DosFreeSeg(Selector2 );
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <access.h> /* header for NetGroup..() */
/*
struct group_info_1 {
char grpi1_name[GNLEN + 1];
char grpi1_pad_1;
char far *grpi1_comment;
};
struct group_users_info_0 {
char grui0_name[UNLEN + 1];
};
*/
#define MAXUSERS 70
void cdecl main(void);
void cdecl main()
{
CHAR ServerName[32], GroupName[15];
USHORT rc, BufLen, i, GroupBufLen;
CHAR UserName[15];
struct group_users_info_0 *Users[MAXUSERS];
struct group_info_1 *GroupInfo;
SEL Selector1, Selector2;
USHORT EntriesRead, TotalAvailable;
/* insert name of your server here */
strcpy(ServerName, "\\\\TECHSUPP");
/* use some dummy group name */
strcpy(GroupName, "XXGROUP");
strcpy(UserName, "OREILLY");
/* memory allocation stuff */
BufLen = sizeof( struct group_users_info_0 );
/* defines for maximum size found in Appendix H in */
/* Lan Server 1.3 Prog Ref */
GroupBufLen = sizeof (struct group_info_1) + MAXCOMMENTSZ
+ 1;
rc = DosAllocSeg( GroupBufLen, &Selector2, SEG_NONSHARED );
GroupInfo = (struct group_info_1 *)MAKEP(Selector2, 0 );
rc = DosAllocSeg(BufLen * MAXUSERS, &Selector1,
SEG_NONSHARED );
for (i = 0; i < MAXUSERS; i++)
Users[i] = (struct group_users_info_0 *)MAKEP(Selector1,
i * BufLen );
/* add group */
strcpy(GroupInfo->grpi1_name, GroupName);
rc = NetGroupAdd(ServerName, 1, (CHAR FAR *)
GroupInfo, GroupBufLen );
if (!rc)
printf("Added group %s", GroupName );
else
printf("Failed in GroupAdd, rc = %d", rc );
/* now add one user */
rc = NetGroupAddUser(ServerName, GroupName, UserName );
if (!rc)
printf("\nUser Successfully Added");
else
printf("\nAddUser failed, rc = %d", rc );
/* get whole set of users from admins*/
rc = NetGroupGetUsers( ServerName, "ADMINS",
0, (CHAR FAR *)Users[0], BufLen * MAXUSERS,
&EntriesRead, &TotalAvailable );
if (!rc){
printf("\nUsers in Group ADMIN");
for (i = 0; i < EntriesRead; i++)
printf("\nName: %s", Users[i]->grui0_name );
}
else
printf("\nGetUsers failed, rc = %d", rc );
/* and add these users to your dummy group */
rc = NetGroupSetUsers(ServerName, GroupName,
0, (CHAR FAR *)Users[0], BufLen * MAXUSERS,
EntriesRead );
if (!rc){
printf("\nUsers in Groups %s", GroupName );
for (i = 0; i < EntriesRead; i++)
printf("\nName: %s", Users[i]->grui0_name );
}
/* Delete the single user */
rc = NetGroupDelUser( ServerName, GroupName, UserName );
if (!rc)
printf("\nUser successfully deleted");
else
printf("\nDelUser failed, rc = %d", rc );
/* and now delete the dummy group */
rc = NetGroupDel(ServerName, GroupName );
if (!rc)
printf("\nGroup Successfully Deleted");
else
printf("\nError in GroupDel, rc = %d", rc );
/* clean up */
DosFreeSeg(Selector1);
DosFreeSeg(Selector2);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <access.h> /* header for NetUser..() */
/* Structures defined in access.h
struct user_logon_info_1 {
unsigned short usrlog1_code;
char usrlog1_eff_name[UNLEN+1];
char usrlog1_pad_1;
unsigned short usrlog1_priv;
unsigned long usrlog1_auth_flags;
unsigned short usrlog1_num_logons;
unsigned short usrlog1_bad_pw_count;
unsigned long usrlog1_last_logon;
unsigned long usrlog1_last_logoff;
unsigned long usrlog1_logoff_time;
unsigned long usrlog1_kickoff_time;
long usrlog1_password_age;
unsigned long usrlog1_pw_can_change;
unsigned long usrlog1_pw_must_change;
char far * usrlog1_computer;
char far * usrlog1_domain;
char far * usrlog1_script_path;
unsigned long usrlog1_reserved1;
};
struct user_logon_req_1 {
char usrreq1_name[UNLEN+1];
char usrreq1_pad_1;
char usrreq1_password[SESSION_PWLEN];
char far * usrreq1_workstation;
};
struct user_info_2 {
char usri2_name[UNLEN+1];
char usri2_pad_1;
char usri2_password[ENCRYPTED_PWLEN];
long usri2_password_age;
unsigned short usri2_priv;
char far * usri2_home_dir;
char far * usri2_comment;
unsigned short usri2_flags;
char far * usri2_script_path;
unsigned long usri2_auth_flags;
char far * usri2_full_name;
char far * usri2_usr_comment;
char far * usri2_parms;
char far * usri2_workstations;
long usri2_last_logon;
long usri2_last_logoff;
long usri2_acct_expires;
unsigned long usri2_max_storage;
unsigned short usri2_units_per_week;
unsigned char far * usri2_logon_hours;
unsigned short usri2_bad_pw_count;
unsigned short usri2_num_logons;
char far * usri2_logon_server;
unsigned short usri2_country_code;
unsigned short usri2_code_page;
};
*/
void cdecl main(void);
void cdecl main()
{
CHAR ServerName[32],
Remark[MAXCOMMENTSZ],
UserName[UNLEN+1],
Password[32];
SEL Selector1, Selector2;
struct user_info_2 *UserInfo;
struct group_info_0 GroupInfo;
struct user_logon_req_1 *LogonReq;
struct user_logon_info_1 *LogonInfo;
USHORT rc, TotalAvailable;
USHORT BufLen, LogonLen;
CHAR *TempPtr;
USHORT Flags;
/* insert name of your server here */
strcpy(ServerName, "\\\\TECHSUPP");
BufLen = sizeof (struct user_info_2) ;
/* found in Appendix H of Lan Server API Reference */
/* now allocate space for various structures needed */
LogonLen = sizeof (struct user_logon_info_1) +
CNLEN + 1 + DNLEN + 1 + PATHLEN + 1;
rc = DosAllocSeg( BufLen, &Selector1, SEG_NONSHARED );
UserInfo = (struct user_info_2 *)MAKEP(Selector1,0);
rc = DosAllocSeg( LogonLen, &Selector2, SEG_NONSHARED );
LogonReq = (struct user_logon_req_1 *)MAKEP(Selector2, 0 );
/* clear out memory */
memset(UserInfo, 0, BufLen );
/* set info about user to be added */
Flags = UF_SCRIPT;
UserInfo->usri2_units_per_week=UNITS_PER_WEEK;
UserInfo->usri2_num_logons=-1;
UserInfo->usri2_max_storage=-1;
UserInfo->usri2_acct_expires=-1;
strcpy(UserName , "BBBBB");
strcpy(UserInfo->usri2_name, UserName);
strcpy(Password, "Secret");
strcpy(UserInfo->usri2_password, Password);
UserInfo->usri2_priv = USER_PRIV_USER;
UserInfo->usri2_comment=TempPtr=malloc(1);
*TempPtr='\0';
UserInfo->usri2_full_name=TempPtr=malloc(sizeof(UserName)+1);
strcpy(UserInfo->usri2_full_name, UserName);
UserInfo->usri2_parms=TempPtr=malloc(1);
*TempPtr='\0';
UserInfo->usri2_usr_comment=TempPtr=malloc(sizeof(Remark)+1);
strcpy(UserInfo->usri2_usr_comment, Remark);
UserInfo->usri2_script_path=TempPtr=malloc(1);
*TempPtr='\0';
UserInfo->usri2_workstations=TempPtr=malloc(8);
strcpy(TempPtr, "KOREQ");
/* insert name, pw, and other info */
UserInfo->usri2_flags = Flags;
rc = NetUserAdd((CHAR FAR *)ServerName, 2,
(CHAR FAR *)UserInfo,
BufLen);
if (!rc)
printf("\nTest User successfully added !");
else
printf("\nError in AddUser, rc = %d", rc );
/* now change the PW */
rc = NetUserPasswordSet(ServerName, UserName,
Password, "NEWPW");
if (!rc)
printf("\nPW has been changed to *****");
else
printf("\nError in PWSet, rc = %d", rc );
/* specify some group in your environment */
/* note that ADMIN and USERS are considered */
/* "special groups" and user priority is a factor*/
strcpy(GroupInfo.grpi0_name, "DBUSERS");
rc = NetUserSetGroups( ServerName, UserName,
0, (CHAR FAR *)&GroupInfo, sizeof( struct group_info_0),
1 );
if (!rc)
printf("\nNew User added to Group: USERS");
else
printf("\nError in SetGroups, rc = %d", rc );
/* now add a comment to the User */
strcpy(UserInfo->usri2_comment, "THIS IS A COMMENT");
strcpy(Remark, "THIS IS A COMMENT");
rc = NetUserSetInfo( ServerName, UserName,
2, (CHAR FAR *)UserInfo, BufLen,
PARMNUM_COMMENT );
if (!rc)
printf("\nNew User Comment Added");
else
printf("\nError in SetInfo, rc = %d", rc );
/* now set up info for validation */
/* Note: NetUserValidate2() has an input */
/* of struct user_logon_req_1 and outputs */
/* a struct user_logon_info_1 to the same */
/* space */
strcpy(LogonReq->usrreq1_name, UserName );
strcpy(LogonReq->usrreq1_password, Password );
LogonReq->usrreq1_workstation = TempPtr = malloc( 10 );
/* enter machine ID here */
strcpy(TempPtr, "KOSER");
/* will return an rc of 5 when running on a requester */
/* this was run on an addtl server */
rc = NetUserValidate2( NULL, 1, (CHAR FAR *)LogonReq,
LogonLen, 0, &TotalAvailable );
LogonInfo = (struct user_logon_info_1 *)LogonReq;
if (!rc){
printf("\nUser: %s", LogonInfo->usrlog1_eff_name );
printf("\nComputer: %s", LogonInfo->usrlog1_computer );
printf("\nNum Logons: %d", LogonInfo->usrlog1_num_logons );
printf("\nUser Validated");
}
else
printf("\nError in UserValidate2(), rc = %d", rc );
/* now delete the user */
rc = NetUserDel((CHAR FAR *)ServerName, UserName );
if (!rc)
printf("\nTest User successfully Deleted !");
else
printf("\nError in DelUser, rc = %d", rc );
/* clean up */
DosFreeSeg(Selector1);
DosFreeSeg(Selector2);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h>
#include <mt\string.h>
#include <mt\stdlib.h>
#include <mt\process.h>
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <access.h> /* header for NetUser..() */
/* structures defined in access.h
struct user_info_2 {
char usri2_name[UNLEN+1];
char usri2_pad_1;
char usri2_password[ENCRYPTED_PWLEN];
long usri2_password_age;
unsigned short usri2_priv;
char far * usri2_home_dir; MAX:PATHLEN
char far * usri2_comment; MAX:MAXCOMMENTSZ
unsigned short usri2_flags;
char far * usri2_script_path; MAX:PATHLEN
unsigned long usri2_auth_flags;
char far * usri2_full_name; MAX:MAXCOMMENTSZ
char far * usri2_usr_comment; MAX:MAXCOMMENTSZ
char far * usri2_parms; MAX:PATHLEN
char far * usri2_workstations;
MAX:MAXWORKSTATIONS *(CNLEN)
long usri2_last_logon;
long usri2_last_logoff;
long usri2_acct_expires;
unsigned long usri2_max_storage;
unsigned short usri2_units_per_week;
unsigned char far * usri2_logon_hours; MAX:21 BYTES
unsigned short usri2_bad_pw_count;
unsigned short usri2_num_logons;
char far * usri2_logon_server; MAX:CNLEN
unsigned short usri2_country_code;
unsigned short usri2_code_page;
};
struct user_modals_info_0 {
unsigned short usrmod0_min_passwd_len;
unsigned long usrmod0_max_passwd_age;
unsigned long usrmod0_min_passwd_age;
unsigned long usrmod0_force_logoff;
unsigned short usrmod0_password_hist_len;
unsigned short usrmod0_reserved1;
};
*/
#define NUMENTRIES 80
#define MAXGROUPS 10
void cdecl main(void);
void cdecl main()
{
CHAR ServerName[32];
SEL Selector1, Selector2, Selector3, Selector4;
struct user_info_2 *Entries[NUMENTRIES], *Info;
struct group_info_0 *Buffer[MAXGROUPS];
struct user_modals_info_0 *Modals;
USHORT i, rc, TotalEntries, EntriesRead, GroupsRead;
USHORT GroupsAvailable,j;
USHORT TotalAvailable, BufLen;
/* insert name of your server here */
strcpy(ServerName, "\\\\TECHSUPP");
BufLen = sizeof (struct user_info_2) +
( 3 * (PATHLEN + 1 )) + ( 3 * (MAXCOMMENTSZ + 1)) +
CNLEN + 1 + (MAXWORKSTATIONS * (CNLEN + 1)) + 21;
/* now add space for strings */
/* found in Appendix H of Lan Server API Reference */
/* now allocate space for various structures needed */
rc = DosAllocSeg( BufLen*NUMENTRIES, &Selector1,
SEG_NONSHARED );
for (i = 0; i < NUMENTRIES ; i++)
Entries[i] = (struct user_info_2 *)MAKEP(Selector1,
i*sizeof( struct user_info_2) );
rc = DosAllocSeg((GNLEN+1)*MAXGROUPS, &Selector2,
SEG_NONSHARED );
for (i=0; i < MAXGROUPS; i++)
Buffer[i] = (struct group_info_0 *)MAKEP(Selector2,
i*sizeof( struct group_info_0 ));
rc = DosAllocSeg( BufLen, &Selector3, SEG_NONSHARED );
Info = (struct user_info_2 *)MAKEP(Selector3, 0 );
rc = DosAllocSeg( sizeof( struct user_modals_info_0 ),
&Selector4, SEG_NONSHARED );
Modals = (struct user_modals_info_0 *)MAKEP(Selector4, 0 );
rc = NetUserEnum(ServerName, 2, (CHAR FAR *)Entries[0],
BufLen*NUMENTRIES, &EntriesRead, &TotalEntries );
if (!rc){
/* list all users */
for (i = 0; i< EntriesRead; i++){
printf("\nNumber %02d Name: %-10s",
i, Entries[i]->usri2_name );
printf(" Priviledge: %d ",
Entries[i]->usri2_priv );
/* get groups for each user */
rc = NetUserGetGroups(ServerName,
Entries[i]->usri2_name,
0,
(CHAR FAR *)Buffer[0],
MAXGROUPS *(GNLEN+1),
&GroupsRead, &GroupsAvailable );
printf(" Groups:");
for (j=0; j < GroupsRead; j++)
printf("%s,",Buffer[j]->grpi0_name );
/* if too many to fit on one page, wait for key*/
if ((!(i%25))&&i){
printf("\nPress any key to see next page");
getchar();
} /* end if */
} /* end for i */
} /* end if !rc */
else
printf("rc = %d", rc );
/* now pick a user, any user */
printf("\nEnter number of user to get info on: ");
scanf("%d", &i );
rc = NetUserGetInfo( ServerName, Entries[i]->usri2_name,
2, (CHAR FAR *)Info, BufLen, &TotalAvailable );
if (!rc){
/* print out various info about user */
printf("\nUser: %s", Info->usri2_name);
printf("\nHome Directory: %s", Info->usri2_home_dir);
printf("\nComment: %s", Info->usri2_comment);
printf("\nFull Name: %s", Info->usri2_full_name );
printf("\nNumber of Logons: %d",Info->usri2_num_logons );
printf("\nLogon Server: %s", Info->usri2_logon_server );
printf("\nLast Logon: %ld", Info->usri2_last_logon );
printf("\nLast Logoff: %ld", Info->usri2_last_logoff );
}
else
printf("\nError in NetUserGetInfo, rc = %d", rc );
/* get modals info */
rc = NetUserModalsGet( ServerName, 0, Modals,
sizeof( struct user_modals_info_0), &TotalAvailable);
if (!rc ){
printf("\n\nGlobal Modals Information");
printf("\nMin Password Length: %d",
Modals->usrmod0_min_passwd_len );
if (Modals->usrmod0_max_passwd_age == TIMEQ_FOREVER)
printf("\nMax Password Age: VALID FOREVER ");
else
printf("\nMax Password Age: %ld",
Modals->usrmod0_max_passwd_age );
printf("\nMin Password Age: %ld",
Modals->usrmod0_min_passwd_age );
if (Modals->usrmod0_force_logoff == TIMEQ_FOREVER)
printf("\nTime Before Forced Logoff: NEVER");
else
printf("\nTime Before Forced Logoff: %ld",
Modals->usrmod0_force_logoff);
}
else
printf("\nError in NetUseModalsGet(), rc = %d", rc );
/* clean up */
DosFreeSeg(Selector1);
DosFreeSeg(Selector2);
DosFreeSeg(Selector4);
DosFreeSeg(Selector3);
}
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
#define INCL_BASE
#define INCL_DOSMEMMGR /* prototype of DosAllocSeg */
#include <os2.h> /* OS/2 API definitions */
#include <mt\stdio.h> /* Since the application starts a*/
#include <mt\string.h> /* thread, we must use the */
#include <mt\stdlib.h> /* multithreaded include file. */
#include <mt\process.h> /* */
#include <netcons.h> /* definition of NetAPI constants*/
#include <neterr.h> /* NetAPI error codes */
#include <access.h> /* header for NetUser..() */
/* in header file access.h */
/*
struct user_logon_info_0 {
char usrlog0_eff_name[UNLEN+1];
char usrlog0_pad_1;
}; */ /* user_logon_info_0 */
/* not system limit, just for this program */
#define MAXUSERS 40
void cdecl main(void);
void cdecl main()
{
CHAR ServerName[32], DomainController[32];
SEL Selector1;
struct user_logon_info_0 *Users[MAXUSERS];
USHORT i, rc, TotalEntries, EntriesRead;
USHORT BufLen;
/* insert name of your server here */
strcpy(ServerName, "\\\\TECHSUPP");
/* now do memory allocation for the LogonEnum call */
BufLen = sizeof (struct user_logon_info_0);
rc = DosAllocSeg(BufLen * MAXUSERS,&Selector1,
SEG_NONSHARED );
for (i=0;i < MAXUSERS; i++)
Users[i] = (struct user_logon_info_0 *)MAKEP(Selector1,
i*BufLen );
/* use NULL to obtain DC for primary domain */
rc = NetGetDCName(ServerName, (CHAR FAR *)0,
DomainController, 32 );
if (!rc){
printf("\nDomain Controller: %s", DomainController );
}
else
printf("rc = %d", rc );
/* Now list all logged-on users */
rc = NetLogonEnum( ServerName, 0, (CHAR FAR *)Users[0],
BufLen*MAXUSERS, &EntriesRead, &TotalEntries );
if (!rc){
for (i=0; i < EntriesRead;i++)
printf("\nUser: %s", Users[i]->usrlog0_eff_name );
}
else
printf("\nError in NetLogonEnum(), rc=%d", rc );
}