-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0bbd8d7
commit f01c685
Showing
7 changed files
with
102 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,51 @@ | ||
pragma circom 2.1.9; | ||
|
||
include "language.circom"; | ||
include "../utils/array.circom"; | ||
|
||
template ParseMethod() { | ||
signal input bytes[7]; | ||
signal output MethodTag; | ||
|
||
component RequestMethod = RequestMethod(); | ||
component RequestMethodTag = RequestMethodTag(); | ||
|
||
component IsGet = IsEqualArray(3); | ||
for(var byte_idx = 0; byte_idx < 3; byte_idx++) { | ||
IsGet.in[0][byte_idx] <== bytes[byte_idx]; | ||
IsGet.in[1][byte_idx] <== RequestMethod.GET[byte_idx]; | ||
} | ||
signal TagGet <== IsGet.out * RequestMethodTag.GET; | ||
|
||
component IsPost = IsEqualArray(4); | ||
for(var byte_idx = 0; byte_idx < 4; byte_idx++) { | ||
IsPost.in[0][byte_idx] <== bytes[byte_idx]; | ||
IsPost.in[1][byte_idx] <== RequestMethod.POST[byte_idx]; | ||
} | ||
signal TagPost <== IsPost.out * RequestMethodTag.POST; | ||
|
||
MethodTag <== TagGet + TagPost; | ||
include "../../utils/array.circom"; | ||
|
||
template StateUpdate() { | ||
signal input parsing_start; // Bool flag for if we are in the start line | ||
signal input parsing_header; // Flag + Counter for what header line we are in | ||
signal input parsing_body; | ||
signal input read_clrf; // Bool flag to say whether we just read a CLRF | ||
signal input byte_pair[2]; | ||
|
||
signal output next_parsing_start; | ||
signal output next_parsing_header; | ||
signal output next_parsing_body; | ||
signal output next_read_clrf; | ||
|
||
signal state[3] <== [parsing_start, parsing_header, parsing_body]; | ||
component stateToMask = StateToMask(); | ||
stateToMask.state <== state; | ||
|
||
component Syntax = Syntax(); | ||
|
||
component pairIsCLRF = IsEqualArray(2); | ||
pairIsCLRF.in <== [byte_pair, Syntax.CLRF]; | ||
log("pairIsCLRF: ", pairIsCLRF.out); | ||
|
||
component stateChange = ScalarArrayMul(3); | ||
stateChange.array <== stateToMask.mask; | ||
stateChange.scalar <== pairIsCLRF.out; | ||
log("stateChange[0]: ", stateChange.out[0]); | ||
log("stateChange[1]: ", stateChange.out[1]); | ||
log("stateChange[2]: ", stateChange.out[2]); | ||
|
||
component nextState = ArrayAdd(3); | ||
nextState.lhs <== state; | ||
nextState.rhs <== stateChange.out; | ||
|
||
next_parsing_start <== nextState.out[0]; | ||
next_parsing_header <== nextState.out[1]; | ||
next_parsing_body <== nextState.out[2]; | ||
next_read_clrf <== pairIsCLRF.out; | ||
|
||
} | ||
|
||
template StateToMask() { | ||
signal input state[3]; | ||
signal output mask[3]; | ||
|
||
mask <== [- state[0], state[0] - state[1], state[2]]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
GET /objectserver/restapi/alerts/status HTTP/1.1 | ||
GET /api HTTP/1.1 | ||
Accept: application/json | ||
Authorization: Basic dGVzdHVzZXIwMTpuZXRjb29s | ||
Host: localhost | ||
Connection: keep-alive | ||
Host: localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters