[ Previous ] [ Contents ] [ Index ] [ Next ]

Ns_RegisterAdpCmd

Overview

Register a tag for use within an ADP

Syntax

    int Ns_RegisterAdpCmd(
      char          *hServer, 
      char          *cmd, 
      char          *endstring,
      Ns_AdpCmdProc *proc, 
      void          *context
    )

Description

Ns_RegisterAdpCmd registers a procedure (proc) to be run when the specified beginning tag (cmd) and ending tag (endstring) is encountered while processing an ADP. The hServer argument is the server handle.

The cmd argument is the beginning tag to look for. For example, "mytag" would match the tag <mytag>. The endstring argument is the ending tag to look for. For example, "/mytag" would match the tag </mytag>.

The context argument is the context pointer to pass on to the callback function.

The proc argument is a pointer to an Ns_AdpCmdProc callback function of the form:

    int MyAdpCmdProc(
      Ns_Conn    *conn, 
      char       *input, 
      Ns_DString *output,
      Ns_Set     *setTag, 
      void       *context
    )

The conn argument is the connection handle. The input argument contains the string that was between the beginning tag and the ending tag in the ADP. The callback function should use Ns_DString[Var]Append to put its output into the output argument, which will be sent to the browser in place of the input string. The setTag argument is a set containing key/value pairs of any parameters that were passed with the tag. (For example, <mytag limit=10> would result in a key/value pair of "limit","10" being passed in the setTag argument.) The context argument is the context pointer passed to Ns_RegisterAdpCmd.

The Ns_RegisterAdpCmd function returns NS_OK or NS_ERROR.

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1996 America Online, Inc.