forked from skupperproject/skupper-router
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
9 changed files
with
358 additions
and
47 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
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
#include "private.h" | ||
|
||
|
||
static void http1_observe(qdpo_transport_handle_t *th, bool from_client, const unsigned char *data, size_t length) | ||
{ | ||
qd_log(LOG_HTTP_ADAPTOR, QD_LOG_DEBUG, | ||
"HTTP OBSERVE: %zu %s octets", length, from_client ? "client" : "server"); | ||
|
||
} | ||
|
||
|
||
|
||
void qdpo_http1_init(qdpo_transport_handle_t *th) | ||
{ | ||
qd_log(LOG_HTTP_ADAPTOR, QD_LOG_DEBUG, "HTTP OBSERVER INIT"); | ||
|
||
th->protocol = QD_PROTOCOL_HTTP1; | ||
th->observe = http1_observe; | ||
th->http1.tbd = 42; // whatever; | ||
|
||
} | ||
|
||
void qdpo_http1_final(qdpo_transport_handle_t *th) | ||
{ | ||
qd_log(LOG_HTTP_ADAPTOR, QD_LOG_DEBUG, "HTTP OBSERVER FINAL"); | ||
th->observe = 0; | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
#include "private.h" | ||
|
||
|
||
static void http2_observe(qdpo_transport_handle_t *th, bool from_client, const unsigned char *data, size_t length) | ||
{ | ||
qd_log(LOG_HTTP_ADAPTOR, QD_LOG_DEBUG, | ||
"HTTP/2 OBSERVE: %zu %s octets", length, from_client ? "client" : "server"); | ||
|
||
} | ||
|
||
|
||
void qdpo_http2_init(qdpo_transport_handle_t *th) | ||
{ | ||
qd_log(LOG_HTTP_ADAPTOR, QD_LOG_DEBUG, "HTTP/2 OBSERVER INIT"); | ||
|
||
th->protocol = QD_PROTOCOL_HTTP2; | ||
th->observe = http2_observe; | ||
th->http2.tbd = 42; // whatever | ||
|
||
} | ||
|
||
|
||
void qdpo_http2_final(qdpo_transport_handle_t *th) | ||
{ | ||
qd_log(LOG_HTTP_ADAPTOR, QD_LOG_DEBUG, "HTTP/2 OBSERVER FINAL"); | ||
th->observe = 0; | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#ifndef __observers_private_h__ | ||
#define __observers_private_h__ 1 | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
#include <qpid/dispatch/protocol_observer.h> | ||
|
||
struct qdpo_config_t { | ||
qdpo_use_address_t use_address; | ||
bool allow_all; | ||
}; | ||
|
||
|
||
struct qdpo_t { | ||
qd_protocol_t base; // initial observed protocol | ||
qdpo_config_t *config; | ||
}; | ||
|
||
/** | ||
* state machine for observing TCP | ||
*/ | ||
typedef struct tcp_observer_state_t tcp_observer_state_t; | ||
struct tcp_observer_state_t { | ||
int tbd; | ||
}; | ||
|
||
/** | ||
* state machine for observing HTTP/1.x | ||
*/ | ||
typedef struct http1_observer_state_t http1_observer_state_t; | ||
struct http1_observer_state_t { | ||
int tbd; | ||
}; | ||
|
||
|
||
/** | ||
* state machine for observing HTTP/2.0 | ||
*/ | ||
typedef struct http2_observer_state_t http2_observer_state_t; | ||
struct http2_observer_state_t { | ||
int tbd; | ||
}; | ||
|
||
|
||
/** | ||
* Per flow protocol observer | ||
*/ | ||
struct qdpo_transport_handle_t { | ||
qdpo_t *parent; | ||
vflow_record_t *vflow; | ||
void *transport_context; | ||
qd_protocol_t protocol; // current observed protocol | ||
|
||
void (*observe)(qdpo_transport_handle_t *, bool from_client, const unsigned char *buf, size_t length); | ||
|
||
union { | ||
tcp_observer_state_t tcp; | ||
http1_observer_state_t http1; | ||
http2_observer_state_t http2; | ||
}; | ||
}; | ||
|
||
void qdpo_tcp_init(qdpo_transport_handle_t *handle); | ||
void qdpo_tcp_final(qdpo_transport_handle_t *handle); | ||
|
||
void qdpo_http1_init(qdpo_transport_handle_t *handle); | ||
void qdpo_http1_final(qdpo_transport_handle_t *handle); | ||
|
||
void qdpo_http2_init(qdpo_transport_handle_t *handle); | ||
void qdpo_http2_final(qdpo_transport_handle_t *handle); | ||
|
||
#endif |
Oops, something went wrong.