Skip to content

Server Design

Brad Keryan edited this page Jun 9, 2023 · 2 revisions

Server Initialization

Key functions:

  • main(): source/server/core_server.cpp
    • Parses command line options
    • Reads configuration file
    • Sets up signal handler / console control handler
    • Daemonizes (if applicable)
  • RunServer(): source/server/core_server.cpp
    • Manages the server's lifetime
    • Owns service objects
    • Builds and runs the server
    • Waits for server shutdown (triggered by signal handler)
  • register_all_services(): generated/register_all_services.cpp
    • Creates the resource repositories used to store session handles
    • Calls service registration functions
    • Collects service objects in a vector<shared_ptr<void>>
  • ${driver}::register_service(): generated/*/register_service.cpp
    • Creates the library object used to call the driver DLL
    • Creates the service object
    • Registers the service with the gRPC server builder

Server Objects

The core server uses shared_ptr to manage the lifetime of the services, libraries, and resource repositories. This diagram shows a simplified view of the graph of shared_ptr references.

graph TD
    %% register_all_services.cpp
    CoreServer --> SessionRepository
    CoreServer --> Service
    Service --> SessionResourceRepository
    SessionResourceRepository --> SessionRepository

    %% *_service_registrar.cpp
    Service --> Library

    %% *_service.cpp
    Service -. creates .-> CleanupLambda
    CleanupLambda --> Library
    SessionRepository --> CleanupLambda

    %% session_resource_repository.h
    CleanupLambda --> ResourceMap
Loading

Table of Contents

Internal Development

Creating and Setting Up a gRPC Server

Server Security Support

Creating a gRPC Client

gRPC Client Examples

Session Utilities API Reference

Driver Documentation

gRPC API Differences From C API

Sharing Driver Sessions Between Clients

C API Docs
NI-DAQmx
NI-DCPOWER
NI-DIGITAL PATTERN DRIVER
NI-DMM
NI-FGEN
NI-FPGA
NI-RFmx Bluetooth
NI-RFmx NR
NI-RFmx WCDMA
NI-RFmx GSM
NI-RFmx CDMA2k
NI-RFmx Instr
NI-RFmx LTE
NI-RFmx SpecAn
NI-RFmx TD-SCDMA
NI-RFmx WLAN
NI-RFSA
NI-RFSG
NI-SCOPE
NI-SWITCH
NI-TCLK
NI-XNET
Clone this wiki locally