LTS

    Innovation Version

      API Reference

      secDetector provides an SDK for external systems. This section describes the APIs required for developing applications. There are only three APIs and two header files.

      Header files:

      • secDetector/secDetector_sdk.h: contains API definitions.

      • secDetector/secDetector_topic.h: contains predefined macros required for calling APIs, such as the ID of a topic that can be subscribed to.

      secSub

      API for subscribing to topics.

      Functions:

      This API is used by applications to subscribe to different topics by specifying topic IDs, for example, file opening exception probes. You can view the definitions of topic IDs provided by secDetector in secDetector_topic.h. This API can be used to subscribe to multiple topics at a time. The topic IDs of multiple probes can be combined in bitmap format.

      NOTE: A subscription generates a message reader. An application needs to subscribe to all required topics in a subscription API call. In this way, a reader can be used to collect messages. To change the subscribed topics, you can unsubscribe from the topics and subscribe to them again.

      Function declaration:

      void *secSub(const int topic);
      

      Parameters:

      • topic: input parameter, which specifies a set of topics to be subscribed to.

      Return values:

      • NULL: The subscription fails.
      • NOT NULL: gRPC reader of the subscribed topics.

      secUnsub

      API for unsubscribing from topics.

      Functions:

      This API is used by applications to unsubscribe from topics by entering the reader obtained after the subscription is successful. After the unsubscription, applications will not receive messages from the unsubscribed topics. If a topic is not subscribed to by any application, it will not be executed.

      Function declaration:

      void secUnsub(void *reader);
      

      Parameters:

      • reader: input parameter, which specifies the message reader to be unsubscribed from.

      Return values:

      • None

      secReadFrom

      API for reading messages from subscribed topics.

      Functions:

      After a topic is successfully subscribed to using the subscription API, you can use this API to receive messages of the subscribed topic from secDetector before unsubscribing from the topic. This API is in blocking mode. It is recommended that applications use an independent thread to call the API cyclically. This function can be resumed only when there are messages in the subscribed topic.

      Function declaration:

      void secReadFrom(void *reader, char *data, int data_len);
      

      Parameters:

      • reader: input parameter, which specifies the message reader obtained after the subscription is successful.
      • data: output parameter, which specifies the message buffer, a segment of memory provided by an application.
      • data_len: input parameter, which specifies the size of the message buffer.

      Return values:

      • None

      Bug Catching

      Buggy Content

      Bug Description

      Submit As Issue

      It's a little complicated....

      I'd like to ask someone.

      PR

      Just a small problem.

      I can fix it online!

      Bug Type
      Specifications and Common Mistakes

      ● Misspellings or punctuation mistakes;

      ● Incorrect links, empty cells, or wrong formats;

      ● Chinese characters in English context;

      ● Minor inconsistencies between the UI and descriptions;

      ● Low writing fluency that does not affect understanding;

      ● Incorrect version numbers, including software package names and version numbers on the UI.

      Usability

      ● Incorrect or missing key steps;

      ● Missing prerequisites or precautions;

      ● Ambiguous figures, tables, or texts;

      ● Unclear logic, such as missing classifications, items, and steps.

      Correctness

      ● Technical principles, function descriptions, or specifications inconsistent with those of the software;

      ● Incorrect schematic or architecture diagrams;

      ● Incorrect commands or command parameters;

      ● Incorrect code;

      ● Commands inconsistent with the functions;

      ● Wrong screenshots.

      Risk Warnings

      ● Lack of risk warnings for operations that may damage the system or important data.

      Content Compliance

      ● Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions;

      ● Copyright infringement.

      How satisfied are you with this document

      Not satisfied at all
      Very satisfied
      Submit
      Click to create an issue. An issue template will be automatically generated based on your feedback.
      Bug Catching
      编组 3备份