protocol

protocol spec

표준 프로토콜은 명령(operation) 및 파일(file)전송을 지원할 수 있도록 simple하게 설계했다.

header size header body data size data
int(4byte) flexible long(8byte) flexible

header size

header size는 header body의 바이트 길이를 나타낸다. 가변길이이다.

header body

operation 인 경우 다음과 같은 값이 올 수 있다. OP_로 시작하는 문자열이 입력된다.

    final static String OP_CODE_SET = "OP_SET"; // agent에게 설정내역을 전송
    final static String OP_CODE_REQUEST = "OP_REQUEST"; // agent에게 정보를 요청
    final static String OP_CODE_SHELL = "OP_SHELL"; // agent에게 shell 실행을 명령
    final public static String OP_CODE_JOIN = "OP_JOIN"; // agent가 server와 연결 생성 후 가입메시지를 보냄

file 인 경우 파일이름을 나타낸다.

data size

data size는 data의 바이트 길이를 나타낸다. 파일(big binary) 사이즈를 고려하여 java의 long type으로 한다.

data

  • operation 인 경우 json 형태의 document를 사용한다. (text도 가능하다)
  • file 인 경우 파일의 binary를 나타낸다.

results matching ""

    No results matching ""