Git Product home page Git Product logo

mdr's Introduction

MDR

Messages Décentralisées en Réseau

MDR est un protocole de messagerie décentralisée très simple.

Les exemples suivants montrent une situation où un participant (Alice) tente de rejoindre la conversation de Bob, Carol et David. Alice ne connait pour l'instant que l'adresse IP de Bob (128.0.0.1:40)

Connexion

Alice se connecte à 128.0.0.1:40 (avec son nom et son addresse d'écoute) et lui demande son identité (INIT)

  • Alice (à 128.0.0.1) : KIKOO "Alice" 128.0.0.4:40 ASV

128.0.0.1 accepte, renvoie son nom, son adresse d'écoute et la liste des autres participants (s'il y en a) (IDENT)

  • 128.0.0.1 (à Alice) : OKLM "Bob" 128.0.0.1:40 / 128.0.0.2:40 / 128.0.0.3:40

Une connexion entre Alice et Bob est maintenant effective.

128.0.0.1 peut refuser la connexion et la communication s'arrête ici (REJECT)

  • 128.0.0.1 (à Alice) : TROPA

Alice se connecte à chaque autre participant si ce n'est pas déjà le cas.

  • Alice (à 128.0.0.2) : KIKOO "Alice" 128.0.0.4:40 ASV
  • Alice (à 128.0.0.3) : KIKOO "Alice" 128.0.0.4:40 ASV
  • 128.0.0.2 (à Alice) : OKLM "Carol" 128.0.0.2:40 / 128.0.0.1:40 / 128.0.0.3:40
  • 128.0.0.3 (à Alice) : OKLM "David" 128.0.0.3:40 / 128.0.0.1:40 / 128.0.0.2:40

Alice connait maintenant la liste de tous les participants (Bob, Carol et David)

Messages

Alice envoie un message à chacun des autres participants (MSG). Le protocole étant décentralisé, il faut répliquer un même message à chaque personne. Chaque message doit être ensuite acknowledge par un LOL par chaque destinataire (ACK) L'absence d'acknowlegdement pendant un laps de temps défini (TIMEOUT) clôt la connexion.

  • Alice (à Bob) : TAVU "Bonjour messieurs dames, comment vous portez-vous ?"
  • Bob (à Alice): LOL
  • Alice (à Carol) : TAVU "Bonjour messieurs dames, comment vous portez-vous ?"
  • Carol (à Alice) : LOL
  • Alice (à David) : TAVU "Bonjour messieurs dames, comment vous portez-vous ?"
  • David (à Alice) : LOL

Rafraichissement

Alice peut redemander l'identité d'un participant avec ASK. Le participant répond avec IDENT

Déconnexion

Alice se déconnecte (QUIT)

  • Alice (à Bob) : JPP
  • Alice (à Carol) : JPP
  • Alice (à David) : JPP

L'acknowledgement ici n'est pas obligatoire.

Gestion des erreurs

Si un participant :

  • envoie un message invalide ou non connu,
  • tente d'envoyer autre chose que INIT alors que la connexion n'est pas établie

le destinaire renvoie alors WTF "<explication>" (ERR)

  • Alice (à Bob) : AZY j'fais n'imp !!!!1!!one!
  • Bob (à Alice) : WTF "AZY non reconnu"

Référence

  • INIT : KIKOO <space> <name> <space> <authority> <space> <ASK>
  • ASK : ASV
  • IDENT : OKLM <space> <name> <space> <authority> (<space> <slash> <space> <authority>)*
  • REJECT : TROPA
  • MSG : TAVU <space> <string>
  • ACK : LOL
  • QUIT : JPP
  • ERR : WTF <space> <string>
  • space : [ ]+
  • slash : /
  • name : <string>
  • string : " (<unicode-char>|"")* "
  • unicode-char : n'importe quel caractère UNICODE
  • authority : <ip> <port>?
  • ip : <ip-part> <dot> <ip-part> <dot> <ip-part> <dot> <ip-part>
  • port : <colon> <port-number>
  • dot : .
  • ip-part : un entier de 0 à 127
  • colon : :
  • port-number : un entier de 0 à 65535

mdr's People

Contributors

neghmurken avatar

Stargazers

Xavier Foucrier avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.