C++ Scatter Gather Arrays
$20-25 USD
Płatność przy odbiorze
C++ Scatter Gather Arrays
Your program will work with Win32 scatter-gather arrays. (look up LPWSABUF structure in MSDN) Or, use appropriate Unix structure if you want to code in *nix.
Your program must:
1) Process a scatter-gather array element by element,
searching for a specific pattern. Please note that the
pattern may span several buffers. Use effective pattern
detection algorithms, just doing strcmp() will not be
acceptable !
2) As soon as the pattern is detected, replace everything
up to the end-of-line character with a specific string.
Respect buffer boundaries !
3) You are not allowed to deallocate/reallocate existing
buffers. You ARE allowed to allocate new buffers.
The pattern you will be searching for is "RCPT TO: "
The replacement string is "testtesttest"
Example:
HELO
USER test
PASS test
RCPT TO:User blahblah
QUIT
Your output should look like this
HELO
USER test
PASS test
RCPT TO:test
This is a part of an ongoing project, and we have a lot of
other much more rewarding projects in store, do this one
RIGHT and you will be awarded more contracts, much more
expensive than this one.
----->
Here is a few important points/clarifications:
1. Buffers contain binary data, they may also contain \0, \n, \t etc at any point.
So, they are not null terminated.
2. Pattern may span multiple buffers.
3. To make matters even more complicated :) both pattern AND replacement string may span multiple LPWSABUF structures
In other words, your input may look like this:
//scatter gather array 1
RC //buffer 1
PT //buffer 2
T //buffer 3
//scatter gather array 2
O: //buffer 1
Your routine will take in 1 (ONE) LPWSABUF at a time.
4. And now, a simplification. You don't need to do pattern replacement 'in place'. Instead, each time your
routine is called you'll allocate a new WSABUF structure and fill it with information from input structure
with everything that follows RCPT TO: till the end-of line replaced by replacement-string. In the new structure,
you are free to allocate as many buffers as you wish. Personally, I would just allocate 1 :)
Hope it helps. Again, you are NOT allowed to modify/deallocate existing buffers.
5. Using State Machine pattern matching or KMP algorithm is a must. I'd prefer state machine.
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):
a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.
b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.
3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
## Platform
Win32 or Unix
Numer ID Projektu: #3307516