Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
51e93a8
Added boost path for Mac Silicon Brew installations
serra-fastly May 30, 2025
8dd26f2
Adds C compatible struct and conversion function
serra-fastly Jun 2, 2025
1a9c8c3
Updates call_c_main call to include new arguments
serra-fastly Jun 6, 2025
a74311f
Changes into_c_struct to into_osstring_vec
serra-fastly Jun 6, 2025
c56ec9d
Updates args to work with existing ffi functions and modules
serra-fastly Jun 9, 2025
7326fb7
Adds unit test for Rust handler args
serra-fastly Jun 10, 2025
6df9c3e
Adds loading settings from cli and unit testing
serra-fastly Jun 11, 2025
3f4f54b
changed name of test fxn
serra-fastly Jun 11, 2025
1cf7cee
Adds new arg vars to test mod
serra-fastly Jun 16, 2025
a8d5978
Adds ArgsData to proxy
serra-fastly Jun 16, 2025
2ee4081
Updated args values in runner
serra-fastly Jun 18, 2025
8f18304
Adds proxy argument handling unit tests
serra-fastly Jul 3, 2025
5b24d05
Resolves clippy warnings and removes reduntant comments
serra-fastly Jul 7, 2025
153588a
Resolves linter issues
serra-fastly Jul 7, 2025
63d6109
Resolves clippy warning
serra-fastly Jul 7, 2025
ce7de89
Removes stray debuggging statement
serra-fastly Jul 16, 2025
db0624d
Adds new C++ compatible struct for bindgen compatibility for CCliArgs
serra-fastly Aug 5, 2025
3d0d861
Updates run functions in proxy and handler to accept new CCliArgsFfi
serra-fastly Aug 7, 2025
4c22bb8
Changes routes from string list to array of strings and removes Osst…
serra-fastly Aug 7, 2025
76640e7
Updates Settings to use ArgsData
serra-fastly Aug 7, 2025
ee677db
Refactors ArgsData to accept CCliArgsFfi instead of argc/argv
serra-fastly Aug 7, 2025
aa1c279
Integrates FFI argument handling into proxy and handler components
serra-fastly Aug 7, 2025
13dc80a
Restores old Settings constructor for backwards compatibility
serra-fastly Aug 7, 2025
73bcf06
Fixes warning about int vs unsigned int
serra-fastly Aug 7, 2025
66ffacb
Changes routes to return empty array instead of nullptr when empty
serra-fastly Aug 7, 2025
dda5e95
Refactors handler and proxy tests to use new FFI structs
serra-fastly Aug 7, 2025
8981999
Resolves circular dependency issues in ArgsData and Settings
serra-fastly Aug 7, 2025
7b905d7
Renames ArgsData in runner to RunnerArgsData
serra-fastly Aug 7, 2025
999c09d
Integrates FFI structs into the module calls for handler and proxy
serra-fastly Aug 7, 2025
e5e1927
Fix for FFI config_file to use proper valid default instead of empty …
serra-fastly Aug 7, 2025
bbde02b
Fixes incorrect empty str check and adds new getters in Settings
serra-fastly Aug 7, 2025
7bc65c3
Adds new Settings tests
serra-fastly Aug 7, 2025
8bfd1dd
Merge remote-tracking branch 'origin' into serra/rust-arg-handler
serra-fastly Aug 8, 2025
c7b3bcc
Replaces run_serial with run_cpp for tests, fixes a linking bug, remo…
serra-fastly Aug 8, 2025
0649f0c
Calls fromUtf8 on arguments for better parsing
serra-fastly Aug 8, 2025
3f1dc5b
Deletes unnecessary equivalency operator
serra-fastly Aug 11, 2025
ad3cd49
Splits and refactors CliArgs into individual structs for handler and …
serra-fastly Aug 11, 2025
5142efb
Removes getters/setters from CliArgsFfi and makes fields public instead
serra-fastly Aug 11, 2025
88b92ca
Removes unnecessary fields and renames Ffi structs to resolve duplica…
serra-fastly Aug 12, 2025
0161b9a
Removes unncessary IntoIterator
serra-fastly Aug 12, 2025
1890fa2
Removes unnecessary storage of routeCount in ProxyArgsData
serra-fastly Aug 12, 2025
bae6603
Adds safety documentation FFI destroy functions, per clippy
serra-fastly Aug 12, 2025
8e80e75
Adds destruction of args at end of execution
serra-fastly Aug 12, 2025
a561fa2
Refactors iteration from i..num to enumerate, per clippy
serra-fastly Aug 12, 2025
dbf51be
Moves destroy and to_ffi fxns out of the ffi mod
serra-fastly Aug 14, 2025
d45330d
Reverts arg styles
serra-fastly Aug 14, 2025
515d64a
Removes Ffi suffix from args struct
serra-fastly Aug 14, 2025
f5b2f5d
Removes unnecessary import
serra-fastly Aug 14, 2025
7a64c9c
Removes qapp from testing
serra-fastly Aug 14, 2025
c0810ce
Removes log.txt and adds it to gitignore
serra-fastly Aug 14, 2025
bb5eb4d
Moves handler and proxy cliargs into respective folders
serra-fastly Aug 14, 2025
c175539
Removes extra whitespace line
serra-fastly Aug 14, 2025
fa77189
Changed pushpin-handler test back to false
serra-fastly Aug 14, 2025
c279256
Creates test log file in log dir and removes log.txt from gitignore
serra-fastly Aug 15, 2025
09d4edc
Changes routes arg to route in proxy
serra-fastly Aug 15, 2025
2fbe712
Changes log file failure from throws exception to exit
serra-fastly Aug 15, 2025
f32d28f
Relocates log set up to run and adds unique log filename to tests
serra-fastly Aug 15, 2025
a84eef1
Changes error handling exit(1) to return 1
serra-fastly Aug 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 74 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ zmq = "0.9"
[dev-dependencies]
criterion = "0.5"
env_logger = { version = "0.9", default-features = false }
tempfile = "3.20.0"
test-log = "0.2"

[build-dependencies]
Expand Down
17 changes: 13 additions & 4 deletions src/bin/pushpin-handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,24 @@
* limitations under the License.
*/

use pushpin::core::call_c_main;
use clap::Parser;
use pushpin::handler::handlercliargs::ffi::HandlerCliArgs;
use pushpin::handler::handlercliargs::{destroy_handler_cli_args, CliArgs};
use pushpin::import_cpp;
use std::env;
use std::process::ExitCode;

import_cpp! {
fn handler_main(argc: libc::c_int, argv: *const *const libc::c_char) -> libc::c_int;
fn handler_main(args: *const HandlerCliArgs) -> libc::c_int;
}

fn main() -> ExitCode {
unsafe { ExitCode::from(call_c_main(handler_main, env::args_os())) }
let cli_args = CliArgs::parse().verify();
let cli_args_ffi = cli_args.to_ffi();

let exit_code = unsafe { handler_main(&cli_args_ffi) };

// Clean up the allocated memory
unsafe { destroy_handler_cli_args(cli_args_ffi) };

ExitCode::from(exit_code as u8)
}
17 changes: 13 additions & 4 deletions src/bin/pushpin-proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,24 @@
* limitations under the License.
*/

use pushpin::core::call_c_main;
use clap::Parser;
use pushpin::import_cpp;
use std::env;
use pushpin::proxy::proxycliargs::ffi::ProxyCliArgs;
use pushpin::proxy::proxycliargs::{destroy_proxy_cli_args, CliArgs};
use std::process::ExitCode;

import_cpp! {
fn proxy_main(argc: libc::c_int, argv: *const *const libc::c_char) -> libc::c_int;
fn proxy_main(args: *const ProxyCliArgs) -> libc::c_int;
}

fn main() -> ExitCode {
unsafe { ExitCode::from(call_c_main(proxy_main, env::args_os())) }
let cli_args = CliArgs::parse().verify();
let cli_args_ffi = cli_args.to_ffi();

let exit_code = unsafe { proxy_main(&cli_args_ffi) };

// Clean up the allocated memory
unsafe { destroy_proxy_cli_args(cli_args_ffi) };

ExitCode::from(exit_code as u8)
}
10 changes: 10 additions & 0 deletions src/core/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,13 @@ void Settings::setPortOffset(int x)
{
portOffset_ = x;
}

QString Settings::getIpcPrefix() const
{
return ipcPrefix_;
}

int Settings::getPortOffset() const
{
return portOffset_;
}
4 changes: 3 additions & 1 deletion src/core/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ class QSettings;
class Settings
{
public:

Settings(const QString &fileName);
~Settings();

Comment on lines +34 to -36
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about this whitespace change

bool contains(const QString &key) const;
QVariant valueRaw(const QString &key, const QVariant &defaultValue = QVariant()) const;
QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const;
int adjustedPort(const QString &key, int defaultValue = -1) const;

void setIpcPrefix(const QString &s);
void setPortOffset(int x);
QString getIpcPrefix() const;
int getPortOffset() const;

private:
QSettings *main_;
Expand Down
6 changes: 4 additions & 2 deletions src/handler/handler.pri
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ HEADERS += \
$$PWD/filterstack.h \
$$PWD/handlerengine.h \
$$PWD/handlerapp.h \
$$PWD/main.h
$$PWD/main.h \
$$PWD/handlerargsdata.h

SOURCES += \
$$PWD/deferred.cpp \
Expand Down Expand Up @@ -56,4 +57,5 @@ SOURCES += \
$$PWD/filterstack.cpp \
$$PWD/handlerengine.cpp \
$$PWD/handlerapp.cpp \
$$PWD/handlermain.cpp
$$PWD/handlermain.cpp \
$$PWD/handlerargsdata.cpp
Loading