Skip to content
hilfialkaff edited this page Nov 4, 2010 · 1 revision

Different Components of Channel

Nameserver

**Relevant files: ** nameserver.c, nameserver.h, nameserver_main.c

  • Gets initialized first
  • Stores simple services' struct (under struct service_t)
  • Client will need to ask nameserver to get the shared memory id for the server that it wants to connect

Service

**Relevant files: ** nbb.c, nbb.h, service.c

  • Will try to reserve a number of channels from the service and if it succeed, everything is good

Client

**Relevant files: ** nbb.c, nbb.h, client.c

  • Will try to connect to the service that it wants and if it succeed, it could then send message to the service

Quirkyness

  • Interrupts are only used by the person SENDING & polling is only used by the person READING (We assume that the reply will not be that far into the future & less complicated too)
  • Calloc() is used instead of malloc() in some parts of program so that no junk bytes are present in the shared memory & stuffs

Message Format

Service

  • Service sending to nameserver: {service name} {# of channels requested} {service_pid}
  • Nameserver replying to service: {1st channel id} {2nd channel id} ... {n-th channel id} (Assuming the previous request could be granted)

Client

  • Client sending to nameserver: {service to connect to}
  • Nameserver replying to client: {i-th service channel id} {service pid} (Assuming the previous request could be granted)

Running the Whole Program

  • make all
  • ./nameserver
  • ./service
  • Any # of "./client"

TODOs

Major Modification

  • Package the files better (ie: move the shm stuffs in nbb.c to possibly new client_shm.c & service_shm.c)
  • Handles the case when client & service disconnects from the nameserver
  • Related to the previous one -> heartbeat packets

Minor Modification

  • Dynamic growth of data structures
  • Fix hardcoded malloc()
  • service & client could choose who to connect to