NetView plug-ins :: Accessing NetView from external programs (API)


Any program can get access NetView hostlist or even contribute the changes to hostlisr or control functioning of NetView by using of function exported by nvapi.dll. Below you can find the list a function and their parameters. Functions which change hostlist data can not work(marked by +слева) or has limited functionality(+)  if you process works in nonprivileged mode. This feature can be adjusted in general NetView settings on the Service page. Other functions can be accessible always when NetView is running and if API enabled for nonprivileged applications(+). И Note that functions of the access to lines, areas and hostlist objects possible will be changed in the future . Though sooner whole these functions will remain for inverse compatibility but new, more universal functions will appear.

DWORD __stdcall NVGetNetViewStatus(void *Reserved);

DWORD __stdcall NVAction(void *Reserved, DWORD wp, DWORD lp);

DWORD __stdcall NVSetEventHandlerProc(void *HandlerProc);

DWORD __stdcall NVGetHostByTextA(void *Reserved, char* Txt,DWORD Flags);

DWORD __stdcall NVGetHostA(void *Reserved, NVHOST* Hst,DWORD Flags);

DWORD __stdcall NVSetHostA(void *Reserved, NVHOST* Hst,DWORD Flags);

DWORD __stdcall NVDelHostA(void *Reserved, NVHOST* Hst);

DWORD __stdcall NVGetMetaVarA(void *Reserved, DWORD HostID, char *VarName, char *DataBuff, DWORD *BuffSize);

DWORD __stdcall NVSetMetaVarA(void *Reserved, DWORD HostID, char *VarName, char *DataBuff, DWORD BuffSize);

DWORD __stdcall NVGetListByTextA(void *Reserved, char *Txt,DWORD Flags);

DWORD __stdcall NVGetListA(void *Reserved, NVLIST* Lst);

DWORD __stdcall NVSetListA(void *Reserved, NVLIST* Lst);

DWORD __stdcall NVDelListA(void *Reserved, NVLIST* Lst);

DWORD __stdcall NVGetLineA(void *Reserved, NVLINE *Ln);
DWORD __stdcall NVSetLineA(void *Reserved, NVLINE *Ln);
DWORD __stdcall NVDelLineA(NVLINE *Ln);
DWORD __stdcall NVGetAreaA(void *Reserved, NVAREA *Ar);
DWORD __stdcall NVSetAreaA(void *Reserved, NVAREA *Ar);
DWORD __stdcall NVDelAreaA(void *Reserved, NVAREA *Ar);
 

 

 

+DWORD __stdcall NVGetNetViewStatus(void *Reserved);

Returns value of the type DWORD major half HIWORD(ret) which - a version of working NetView (majot\minor bytes - major\minor parts of version), minor LOWORD(ret):

  • 0 - if process can't access NetView
  • 1 - process can access NetView in read-only mode
  • 2 - process has full access to NetView
  • Reserved - reserved. Set to NULL

Наверх

 

+DWORD __stdcall NVAction(void *Reserved, DWORD wp, DWORD lp);

 Multifunctional API. Action codes in wp:
  • NVACTION_RECHECK- Recheck host. lp=host id to be rechecked
  • NVACTION_RECHECK|NVACTION_LIST - Recheck all hosts of specified list. lp=list id or NULL to recheck all hosts
  • NVACTION_RETRACE- Retrace host. lp=host id to be retraced
  • NVACTION_RETRACE|NVACTION_LIST - Retrace all hosts of specified list. lp=list id or NULL to retrace all hosts
  • NVACTION_OPEN - opens host with id =lp
  • NVACTION_EDIT - edit host with id=lp. Returns 0 if edit canceled
  • NVACTION_IMGEXPORT - initiate export to gif image of the visual map of list with id=lp
  • NVACTION_SETSTATE- Updates state of the host. Necessary after some changes of hosts metavariables. lp = host id
  • Reserved - reserved. Set to NULL

Наверх

 

 

+DWORD __stdcall NVSetEventHandlerProc(void *HandlerProc);

Installs the event-handler proc for different NetView events. Each process can have only one such handler. If HandlerProc=NULL than handler is switched off. The Handler proc must be declared as follows:

  • LRESULT CALLBACK HandlerProc(DWORD msg, DWORD wp, DWORD lp, DWORD tm); and return 1.
    • msg = NMNP_ALERT
      • NVALERT_NETWATCHER - NetWatcher's event. If (wp && NVALERTMASK_CANCEL)==0 then sombody connected, else - disconnected. lp means id of the connected host host or NULL. Also next bitmask flags can be specified: NVALERTMASK_NWBLACK - host from kick list, NVALERTMASK_NWWHITE - host from keep list
      • NVALERT_ALARMHOST - alertable host changed its state.
        if (wp && NVALERTMASK_HOSTUP)!=0 then host gone online
        if (wp && NVALERTMASK_HOSTDOWN)!=0 then host gone offline
        if (wp&& NVALERTMASK_CANCEL)!=0 - user clicked alerted host
      • NVALERT_TERMINAL- Terminal accepted or closed connection lparam -id of the connected host or NULL.
        if(wp&& NVALERTMASK_CANCEL)!=0 then somebody diconnected, else - connected. 
      • NVALERT_REDIRECTOR- Traffic redirector event, the same as Terminal's
      • NVALERT_IPLOGGER -IP logger event Check with && presentce of the following bitmask flags:
        • NVALERTMASK_ILLIST - somebody connected to listened port
        • NVALERTMASK_ILICMP - ICMP flood
        • NVALERTMASK_ILSYN - TCP SYN flood
        • NVALERTMASK_ILUDP - UDP flood
    • msg = NMNP_ACTION
      • NVACTION_LIST. lp is list id or NULL. Check wp for next bitmask flags:
        • NVACTION_GETFROMNET - list refresh completed with using of network
        • NVACTION_GETFROMFILE - list refresh completed with using of file
        • NVACTION_RECHECK - list recheck completed
        • NVACTION_RETRACE - list retrace completed
      • NVACTION_ACTIVATE -NetView (de)activated.  lp means wParam of the got WM_ACTIVATE
      • NVACTION_MENUPOPUP -menu popup notification, lp:
        • NVMENUFLAG_MAIN - Plug-ins menu
        • NVMENUFLAG_CONTEXT -hostlist context menu
        • NVMENUFLAG_TRAY -icon context menu
      • NVACTION_IMGEXPORT - visual map/plan export to gif image completed
    • tm - time when event was occured
  • Reserved - reserved. Set to NULL

Top

 

+DWORD __stdcall NVGetHostByTextA(void *Reserved, char* Txt,DWORD Flags);

Returns the host id by its name or IP address. Can create new host if can't find matching

  • Reserved - reserved. Set to NULL
  • Txt - host's name or IP
  • Flags - you can specify next bitmask flags
    • +NVOBJ_FORCENEW - to create new host
    • +NVOBJ_HOSTNOIP - by default with NVOBJ_FORCENEW NetView tries to determine IP address by given name. If you specify also this flag you forces NetView to add host without IP address

Наверх

 

+DWORD __stdcall NVGetHostA(void *Reserved, NVHOST* Hst,DWORD Flags);

Gets the information about host by its identifier or gets the information about the first host in list that allows to enumerate all hosts.

  • Reserved - reserved. Set to NULL
  • Hst points to NVHOST structure with specified Id of the host to get info or you can specify id=0 if you want to get first host. By using nextid you can enumarate hosts.
  • Flags can be 0 or NVOBJ_SELECTED. NVOBJ_SELECTED forces to enumerate only selected by user hosts.

Top

 

+DWORD __stdcall NVSetHostA(void *Reserved, NVHOST* Hst,DWORD Flags);

Can change specified or add new host. Returns host id.

  • Reserved - reserved, set to NULL
  • Hst points to NVHOST with specified id. You can specify id=0 if you want to add new host. Also you must initialize all fields except nextid. NetView в NetView can return id of the existing host even you try to add new if its IP or hostname matches with specified by you;
  • Flags - reserved, set to NULL.

Top

 

+DWORD __stdcall NVDelHostA(void *Reserved, NVHOST* Hst);

Deletes host from hostlist.

  • Reserved - reserved, set to NULL
  • Hst points to NVHOST with specified id

Наверх

 

+DWORD __stdcall NVGetMetaVarA(void *Reserved, DWORD HostID, char *VarName, char *DataBuff, DWORD *BuffSize);

Gets metavariable of the host. If host not found returns 0, if not enough memory returns 2, if all ok returns 1.

  • Reserved - reserved, set to NULL
  • HostID - id of the host wich variable we want to retrieve
  • VarName - NULL terminated variable name.
  • DataBuff - points to buffer where to store variable data. Note that data will not be NULL terminated
  • BuffSize - points to DWORD variable. Before call set it to the real size of specified buffer, on return it will be equal variable length and may be greater than buffer, you has specified

Наверх

 

+DWORD __stdcall NVSetMetaVarA(void *Reserved, DWORD HostID, char *VarName, char *DataBuff, DWORD BuffSize);

Changes host's metavariable by host id and varname.

  • Reserved - reserved, set to NULL
  • HostID - host id
  • VarName - NULL terminated metavariable name.
  • DataBuff - buffer with data. Data can be any bytes;
  • BuffSize - data length

Top

 

+DWORD __stdcall NVGetListByTextA(void *Reserved, char *Txt,DWORD Flags);

Returns the identifier existing sublist, can also create the new sublist. Returns the identifier of the sublist in the event of success or 0 in case of failure.

  • Reserved - reserved, set to NULL
  • Txt - hostlist name
  • Flags can be 0 or +NVOBJ_FORCENEW when you wish create new list if can't find matching.

Top

 

+DWORD __stdcall NVGetListA(void *Reserved, NVLIST* Lst);

Gets data about list by its identifier which is specified in стркутуре Lst. Similarly as NVGetHostA allows to enumerate all list. Returns the identifier of the list in the event of success or 0 in case of error.

Top

 

+DWORD __stdcall NVSetListA(void *Reserved, NVLIST* Lst);

Changes list setttings. Returns list id if success or 0 if error

Top

 

+DWORD __stdcall NVDelListA(void *Reserved, NVLIST* Lst);

Deletes list by specified id in Lst. Return 1 on success, 0 on error.

Top

 

+DWORD __stdcall NVGetLineA(void *Reserved, NVLINE *Ln);

Get line setting by its global index. Returns total lines count at call time. Use index=-1 if you only want to get lines count.

Top

 

+DWORD __stdcall NVSetLineA(void *Reserved, NVLINE *Ln);

Sets the information about line by its index specified in Ln. If index=-1 than new line will be added. Function return total lines count or 0 in case of error.

Top

 

+DWORD __stdcall NVDelLineA(void *Reserved, NVLINE *Ln);

Delete line.

Top

 

 

+DWORD __stdcall NVGetAreaA(void *Reserved, NVAREA *Ar);

Gets info about area by its identifier which is specified in стркутуре Ar. Similarly as NVGetHostA allows to enumerate all areas. Returns the identifier of the area in case of success or 0 if an error occured.

Top

 


+DWORD __stdcall NVSetAreaA(void *Reserved, NVAREA *Ar);

Installs all given about specified area. Note that on one list cann't exists 2 areas with the same names. Returns identifier in case of success, 0 if error occured, -1 if there is exists area with the same name on the same list

Top


+DWORD __stdcall NVDelAreaA(void *Reserved, NVAREA *Ar);

Delete area. Return 1 on success, 0 on error.

Top


© 2001-2004 Killer{R}   © 2003 VoVaN