Skip to main content
. 2025 Aug 7;25(15):4856. doi: 10.3390/s25154856
Algorithm 4 VANET–Teegraph scenario controller.
Require: communicationRange, trafficDensity, vehicleSpeed
Ensure: continuous, secure node operation
    Initialization:
  •   1:

    Obtain initial credentials and pseudonym from TA

  •   2:

    gossipInterval f(trafficDensity)

  •   3:

    function prioritize(events)

  •   4:

        for all msg in events do

  •   5:

            if msg.type = Safety then

  •   6:

               setHighPriority(msg)

  •   7:

            end if

  •   8:

        end for

  •   9:

    end function

  • 10:

    function selectNeighbors(r, v)

  • 11:

        return nearest k nodes by link stability (based on v)

  • 12:

    end function

  • 13:

    procedure  AuthManager

  • 14:

        while true do

  • 15:

            if handoverToNewRSU() then

  • 16:

               pseudonym ← TA.issuePseudonym()

  • 17:

               enclave.store(pseudonym)

  • 18:

            end if

  • 19:

            sleep(handoverCheckInterval)

  • 20:

        end while

  • 21:

    end procedure

  • 22:

    procedure  CommManager

  • 23:

        while true do

  • 24:

            incoming ← receiveEvents()

  • 25:

            if validate(incoming) then

  • 26:

               DAG.append(incoming)

  • 27:

               prioritize(incoming)

  • 28:

            else

  • 29:

               discard(incoming)

  • 30:

            end if

  • 31:

            newEvent ← makeEvent(DAG.lastSelfParent(), DAG.lastRemoteParent())

  • 32:

            signedEvent ← enclave.sign(newEvent)

  • 33:

            DAG.append(signedEvent)

  • 34:

            if DAG.allConfirmed() then

  • 35:

               pauseGossip()

  • 36:

            end if

  • 37:

            neighborSet ← selectNeighbors(communicationRange, vehicleSpeed)

  • 38:

            send(DAG.unseenEvents(), neighborSet)

  • 39:

            sleep(gossipInterval)

  • 40:

        end while

  • 41:

    end procedure

  • 42:

    Launch AuthManager and CommManager in parallel