Package edu.drexel.cs544.mcmuc.channels

Examples of edu.drexel.cs544.mcmuc.channels.Controller


                this.keys = new ArrayList<Certificate>(keys.length());

                if (keys != null) {
                    int len = keys.length();
                    for (int i = 0; i < len; i++) {
                        this.keys.add(new Certificate(keys.getJSONObject(i)));
                    }
                }
            }
        } catch (JSONException e) {
            e.printStackTrace();
View Full Code Here


                List<Certificate> keys = message.getKeys();
                if (keys != null) {
                    Iterator<Certificate> it = keys.iterator();
                    while (it.hasNext()) {
                        Certificate c = it.next();
                        Controller.getInstance().output("Advertised " + c.getFormat() + " public-key cert from " + message.getFrom() + ":\n\t" + c.getCertificate());
                    }
                }

                channel.send(message);
            }
View Full Code Here

                List<Certificate> keys = message.getKeys();
                if (keys != null) {
                    Iterator<Certificate> it = keys.iterator();
                    while (it.hasNext()) {
                        Certificate c = it.next();
                        Controller.getInstance().output("Advertised " + c.getFormat() + " public-key cert from " + message.getFrom() + ":\n\t" + c.getCertificate());
                    }
                }

                channel.send(message);
            }
View Full Code Here

                    FileInputStream privateKeyFile = new FileInputStream(command.getArg(2));
                    byte privateKey[] = new byte[(int) privateKeyFile.available()];
                    privateKeyFile.read(privateKey);

                    controller.addKeyPair(command.getArg(0), new Certificate("X.509", publicKey), new Certificate("X.509", privateKey));
                } else if (command.getCommand() == CLICommand.Command.REMOVEKEY) {
                    FileInputStream publicKeyFile = new FileInputStream(command.getArg(1));
                    byte publicKey[] = new byte[(int) publicKeyFile.available()];
                    publicKeyFile.read(publicKey);

                    controller.removeKeyPair(command.getArg(0), new Certificate("X.509", publicKey));

                } else if (command.getCommand() == CLICommand.Command.SECUREMESSAGE) {
                    FileInputStream publicKeyFile = new FileInputStream(command.getArg(0));
                    byte publicKey[] = new byte[(int) publicKeyFile.available()];
                    publicKeyFile.read(publicKey);

                    Certificate cert = new Certificate("X.509", publicKey);
                    controller.messageRoom(command.getArg(2), new Message(controller.getUserName(command.getArg(2)), command.getArg(3), command.getArg(1), cert));
                }
            } catch (RoomDoesNotExistException e) {
                cli.alert(e.getMessage());
            } catch (FileNotFoundException e) {
View Full Code Here

     * the first timeout timer (random interval between 5 to 10 minutes).
     *
     * @param port int port to use
     */
    Channel(int port) {
        mcc = new MulticastChannel(port);
        runner = new MulticastReceiveRunnable(this);
        Thread runnerThread = new Thread(runner);
        runnerThread.start();
    }
View Full Code Here

     *
     * @param port int port to use
     */
    Channel(int port) {
        mcc = new MulticastChannel(port);
        runner = new MulticastReceiveRunnable(this);
        Thread runnerThread = new Thread(runner);
        runnerThread.start();
    }
View Full Code Here

     *
     * @param port int port to forward traffic on
     */
    Forwarder(int port) {
        super(port);
        primary = new PrimaryTimer(port);
        resetPrimaryTimer();
    }
View Full Code Here

        Integer p = roomNames.remove(roomName);
        if (p != null) {
            leaveRoom(p);
            this.alert("Left room: \"" + roomName + "\"");
        } else {
            throw new RoomDoesNotExistException(roomName);
        }
    }
View Full Code Here

        Room room = (Room) channels.get(roomNames.get(roomName));
        if (room != null) {
            room.setStatus(presence);
            this.alert("Set presence for \"" + room.getUserName() + "@" + roomName + "\" to \"" + presence.toString().toLowerCase() + "\"");
        } else {
            throw new RoomDoesNotExistException(roomName);
        }
    }
View Full Code Here

        Room room = (Room) channels.get(roomNames.get(roomName));
        if (room != null) {
            room.addKeyPair(publicKey, privateKey);
            this.alert("Added key pair for \"" + room.getUserName() + "@" + roomName + "\"");
        } else {
            throw new RoomDoesNotExistException(roomName);
        }
    }
View Full Code Here

TOP

Related Classes of edu.drexel.cs544.mcmuc.channels.Controller

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.