This video demonstrates building an instant messaging server by abstracting complex TLS/SSL operations into a clean transport layer, enabling developers to implement secure messaging protocols without directly managing low-level cryptographic details. The approach involves creating a TLS state structure that encapsulates SSL contexts, configuration options, and file descriptors, then wrapping OpenSSL functions like SSL_read, SSL_write, and SSL_accept to provide a consistent interface for the application layer. This abstraction allows the server to handle connection management, message routing, and protocol framing while keeping the transport implementation separate from the application logic, making the codebase more maintainable and easier to extend with features like message encryption and multi-party communication.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
C Instant Messaging to avoid Chat Control
Added:We're live. We're live. Nice. So, yeah.
Um, we are I don't even know what the title of the stream is.
Let's check that.
So, we're continuing on um faith, right? So, instant messaging to Okay. Instant messaging from scratches. Yeah, it's kind of okay.
Yeah. Um All right. So, let's go in here. Let's clear the history.
Yeah, I think it's I think it's good just to not um show any um confidential information.
Okay, so we're live. Yeah. Welcome, Mary.
Uh, Mary the um I can't really spell your name. Mary the Trio 8425.
Welcome. Welcome. Um, you are the highest tier member on this channel, right?
Okay. So, let's put that here.
We might as well even do something like that. Yeah. So like uh and I think yeah we're not able to really scale those ratios.
We can only scale this ratio. Okay. So I think on the stream you can see the chat pretty well.
Yeah.
Okay. Um what I want to do today is to actually um prepare the codebase for the real MLS.
So essentially um MLS document um that's the architecture document. So basically uh this is the kind of protocol or architecture we want to use for um messaging between two or more um participants in the uh system and we will basically um implement that.
But to do that um we have to like kind of abstract away a lot of things.
For example, like I didn't really plan anything um on the stream. So it's basically a um it's basically a let's just do it. Let's just see how it goes.
And if there are errors along the way, then we have to fix those. or like if um yeah like basically all the decisions we are making today are made um exactly uh when I'm making them you know so I didn't make them um before the stream uh VA talk welcome welcome hello hello hello so we're basically doing a very uh early stream today um yeah so it's very early and that's the main difference today. Uh we will probably also be doing a bit of a longer stream because the um goal I want to achieve today is kind of hard to achieve because as you can see I already created this folder. That's the only thing I did transport because I want to abstract away everything from those 3,000 lines of code because they don't really like this is supposed to be just a um the executable um powering the server and not and it's handling like the protocol and stuff like that. So this shouldn't really be the case. Um yeah. So yeah, let's just go uh right into it. I want to basically abstract away all of those um things.
Are you on Linux? Uh yes, Linux. Void Linux.
So um I want like let's actually just um go from from here. So okay, here we init those libraries, we set the log handler, we pass arguments, then we init the server. So maybe we should have something like TLS.h H and TLS.C, you know. Um, that's tough. Yeah, it is.
And by the way, we have to we have to do this. So, this uh needs to be a little bit larger so you can actually see things. Yo, bro, how do you learn program? How do I learn programming like you? Um, I don't know. Learn C. I guess you can um learn it.
I I I don't really remember how I learned it. I think I have those streams where I first tried C online. They are like from 2023 or something. That's when I tried C first and I made like chess and stuff like that.
So yeah. Um so early. Yeah, it's an early stream today. Um because we have to uh get a lot of things done uh done. How do we learn C?
um do a project in C. If you have some project, then just choose C for your language and you'll learn it and that's it.
Okay, we need something like a TLS um like a structure that's um containing the TLS context I think or like the SSL context. So SSL context. Yeah, it's basically kind of a T um TLS state, I guess.
And init SSL takes in a context and sets all of those options and stuff like that.
Okay.
Okay.
Use certificate file.
Okay. So, didn't I just write stuff in here? I def Okay. Put it in the C file.
So uh basically let's have a TLS state T and let's have a type of strct uh TLS config T and this will have like those um hardcoded config flags like opts. So let's have long I guess opts or how is like um options and then let's have the uh chain file.
So certificate chain file and private key file.
So we kind of want to pass them. Okay. So, let's have CH um uh chain file and let's have 128 and um Py file.
Look up Be's guides for reference. Think up small projects you want to work on and get to coding. All right. All right.
G um Okay. Okay. Do we want to have the cache ID?
I don't really think we want to have that. Set time out. So, set cache size.
I guess let's have them as uh as values.
So, how are they taken in as long? So, long.
Do we, by the way, want to even um Yeah, let's let's cooperate with OpenSSL and just have them um specify the types and we just follow, you know, and have [ __ ] like long in here because I think this file will literally be um including OpenSSL because like we cannot have TLS and then TLS is also abstracting away the actual TLS implementation. So you could for example have TLS but use wolf SSL or I don't know the like the other SSL libraries and TLS.h would abstract that away but let's not do that because like how many layers of abstraction do we want to have? I think that's one too many. Let's have this um be the layer of abstraction for specifically open cell.
So and because of that I think having the types um like OpenSSL has them is valid right welcome who shadow welcome so let's have the uh time out and uh the other thing was the cache size right and set verify okay I think that is a so call back and stuff like that.
Yeah, we should look that up actually because I have no idea because currently we are literally ignoring SSL verification.
Sets the verification flag for context to be mode.
Yeah. And mode is none. You see uh yeah mode specifies the verify callback function. If no callback function shall be specified the null pointer can be used for verify callback context must not be null.
SSL set verify sets the verification flags for SSL to be mode. Okay. If no co bro why do you what why is it why bro oh my god in this case last verify call back set specifically for this remains no special callback set before the default callback for the underlying context is used that was valid at the time as was created in the callback function Um okay.
Can I just uh go into here? SSL verify peer fail if no peer certificate. Uh the last three options are or with SSL verify peer. I see. Okay. Uh verify client once.
Okay. So, I think this call back thing um can we learn more about the call back?
Uh cuz I don't really know if you normally set the call back at all.
I think let's just have for now let's have in this uh in this config let's have the int um verification mode right and yeah okay so let's have a TLS config cfg right yeah and then Let's also have a um SSL context pointer, right? Because uh this layer should own the SSL context.
Um yeah. So ctx is why error by the way. So isn't there like okay so then error I guess. Um, so, so that's going to be the config and and yes, let's have something like faith status code um TLS in it.
It's a peer-to-peer chat. Uh no, there is a server in between the peers and um the server routes messages via the protocol that it's um serving clients with that we are currently working on.
So yeah, it's not peer-to-peer like in the um transport sense, you know. Yeah.
Um, so let's have a TLS.
Let's have a con t. Yes, we use constancy C by the way. So yeah, cfg and faith status code comes from somewhere I guess. So I think from protocol.h faith status faith status code T. Where is that even defined?
Who defines faith status code? Is it in client faith status code?
Ah here okay so let's include protocol I guess but that's going to change as well. So protocol for now.
So dot dot slash protocol and let's have TLS init return that and maybe also a TLS destroy I guess. So TL uh SL context free so context free.
So let's try. Okay. Okay. So, let's have a TLS.
Do we want to have D in it? I don't know. Like, we have to um we have to have one thing that is consistent. So, let's have let's just have destroy self destroy also exists.
And this will take in a TLS state.
Hello friends. Hello friends. Welcome.
Welcome penguin operator. Great to see you here at this time. Nice.
Uh, all right. So, TLS in it. TLS destroy.
Let's first make sure that we have a config.
And of course, I forgot a very important thing. We will want to um return the TLS state. Let's return it not as a double pointer. So let's have um TLS state T um O TLS and let's have O so um TLS state T O TLS and then let's have OTLS is equal to null Okay.
So, yeah, let's build the TLS states um in here. So, TLS states config and context.
Your take on AI? Um, yeah, I think it's kind of okay.
I have to like kind of lean into it because we're kind of forced to lean into it, you know, but um I don't know. So maybe I didn't really um use it correctly, but it's not really helping me too much, but maybe I have to pay like 200 uh euros for it to work correctly.
uh and I don't really want to would you also want the strct arguments const or just the pointers to them um so just uh the pointer so basically this is just marked as const because the config is not um mutated in the function but I think um having this you mean probably um it's a little bit weird so I don't think you do that in C. I never I never seen anyone do that. Um you usually don't even specify constant here, but I just like to because then I know that this is just a input parameter to the function.
So yeah, um let's have cfg just be uh config and context be null.
And let's have uh so can we yeah let's let's have that just at the top of the function tsconfig const cfg to make the structure itself immutable I think so you mean that is there a difference between this and that yo Okay. Is that actually the case?
Because would this then um okay I don't know maybe there is a difference.
So yeah. Yeah. Just tell me if there is a difference but um okay so constant and front makes the pointer immutable. The structure itself can still be changed. You mean cfg.
Cache size is equal to six, right? But you still cannot assign it, right?
So constant or do you mean something like cfg? Ah, okay. So can you then do something like this?
also not const makes both the pointer and the structure immutable.
Okay, but I cannot mutate both of them even though I just do that.
Right?
So in here I can't mutate that. Right?
And I can also not do that or am I missing something?
Right.
But maybe I'm missing something. Okay.
So, let's actually try and do um SL in it. So, SSL in it. Is it not there anymore?
In it. SSL. All right. Um TLSL server method. Okay. Yeah. Let's just let's just um try and copy all of that.
put it into here and see how it works.
So that and then uh context is going to be uh cfg is going to be os uh context and so do we want to assign it like that? I think it's okay to assign it like that.
ctx I think. Yeah, let's let's better just have something like SSL ctx pointer ctx is equal to null and then we just use ctx for all of that. It really doesn't matter as you are the sword author and know not to manipulate the st. Yeah, true. So that's why I was saying like it's it doesn't even really matter to market cons in the first place, but I just like to so that I just immediately get it, you know.
Um fail to create. Okay, so we probably want a macro to um where did I have that? I think in co- render to basically log something like um protocol immediately or let's just just let's just write it I guess because this is going to be a little bit weird because then we have to like inspect the file names and like do a lot of weird [ __ ] So maybe let's just have uh transport /tls and then we can theoretically do something like hashdefine um module name and we will say transport TLS.
Automation of labor including AI integration saves a lot of human labor which then can be used for more DS. AI is good for workers but bad for the capital which has to exploit more human labor.
Okay. Interesting sense. Interesting sense.
Yeah. I don't know.
Um I don't really know. So okay. So let's have module name everywhere and have something like that.
And okay. So do we want to capitalize that?
Probably.
So failed failed failed.
SSL initialized and verify return defer with one.
So let's say uh faith error is there is there is even a SL error codes okay faith error SSL but this is more like faith error no me and in here we say faith error SSL let's replace SSL with TLS or I think it's even yeah let's have like that um and return defer. It's taking the return defer from nope.
So that's a little bit weird because I never use that. So maybe let's have FH uh return defer FH return defer and then defer statement requires expression scaler type if context free context and then context is kind of redundant and yeah and we set context here to null. So that's going to stay null. How old are you? I'm 18. Yeah.
And then let's say faith status code TFH result. And have a return defer from faith everywhere.
And let's have a faith error. It's more like a faith error crypto even, you know.
So maybe this even have a faith error crypto uh set options. So what does set options return? A also a so I think when they AU and 6040. So let's see let's set options arrow.
Um why can't I really search? So synopsis um returns the option set get options.
Okay. Set options options are already options already set before are not cleared. Okay. With an exclamation mark even um the following bug workaround options are available.
return values. Uh, return the new. Okay, I see returns one get options return the current bit mask.
Okay, that's why it say 64T. So, we can't really check errors on that. All right. So, let's not have long opts and let's have uh CFG options and let's have um cfg dot chain chain file.
Um yeah, the thing is that we should probably have to have it like this and then say I think we might just be able to pass it. So I think that's not even a thing that we have to worry about.
But maybe I just don't know what I'm talking about. So, we're we're going to see. Um, PY.
Okay. Cash ID. Let's just keep the cache ID. And let's have that be cfg. Cache size and cfg uh timeout. And this going to be cfg uh verification mode.
And return f result.
And this is going to um yo bro, what are you really making? Uh so that's just what stands in the title, right? Like it's not like I'm just pretending to make it and like uh in in real life like really making a I don't know Georgian horse, you know. How did you learn coding in such young age? Um I don't know. I just learned it. Yeah.
So, I can't really tell you. Yeah. What do you mean by instant messaging? Yeah.
Basically, like um if you have a person and you want to message them, you use WhatsApp or any other messenger, I don't know, like Signal and stuff like that. And you message them and it messages and the message is probably encrypted, right?
like you know and this is instant messaging and also um yes all right igu what is IGU yeah and basically that's what I'm making and I'm writing the server like technology for that and also the protocol and like the client library and the UI for that which is in this source tree so which is also [ __ ] Dang, large Bruffski.
Yeah, but it's not it's it's really small for what we're currently doing.
So, the code base will expand and expand, by the way. So, uh yeah.
Okay. So, let's have um bro, why am I just opening all of the files? Let's have not Okay. Why is it why is it named CFG though? Let's have something like SSL uh TLS. It looks very interesting. Thank you ma'am. Thank you.
TLS and if not TLS we will return faith error invalid.
And in here we will say yeah let's say TLS um dot context and then if TLS context it does not equal null then we will SSL context free TLS context and we will essentially mems set TLS0 size of TLS s and TL.
Why is it cons? That doesn't make any sense. So, TLS and let's return uh faith. Okay.
And yeah, so that's uh the TLS for now, right? Okay. So, let's try and just use that. Let's say um SSL init replaced by it's actually netsl um by so in net ssl.
Okay, for now let's have the uh TLS state be inside of the server state. So let's have um TLS state TLS and what's your major? I don't have a major. I will um enter into university um in a few months. So yeah, then I will do computer science. Yeah.
Um yeah, let's say um let's actually FH check that and say um TLS in it with a config which will be um TLS config cfg is equal to TLS config with and then let's say options. So in what order is this? because my um my IntelliSense or however you want to call that, it doesn't specify the STR members in the correct order. So, I don't know why they just decided not to.
Um options is going to be all of the options that I don't have anymore because I deleted everything and I didn't remember them. So, let's go to Coco Cry/Faith.
By the way, uh the project um git repo is in the description. So you can start that if you want to. So yeah. Um and let's go to faith d.
Let's go to source faith and let's find opts and let's have those options basically.
So options is equal to that and um verification mode. Okay. So let's the next thing is actually chain file. So let's say uh chain dot.
So what is the chain file? chain.pm.
Right? And the pey file is going to be um pi.pm. PM and the time mode is going to be three that's what I remember so 360 cache size is was that and verification mode was SSL verify none and then we can pass the config like that and we can make it const I guess even here and we have the OTLS which will be um which will be um STLs and yeah and then let's have something like if FHRC does not equal faith. Okay.
Then we will say that we want to um wait what what it okay I did that kind of thing but this is not really correct because the function already freeze it so that's kind of bad that I did that right okay bro Okay, let's say TLS uh destroy with um STLs and we can even check return that.
Okay, it doesn't return anything. Okay, then I guess and in here if that's not the case then we will do something else. But this is in server init and this will probably so cfg is equal to this will probably destroy the server.
So in that and if that then we say server destroy SSL context is null.
Okay. So we don't need that. And except for call to undeclared thing probably because Yeah.
So we will need that in here and SL context.
Okay. So yeah.
So let's have um TLS context for now.
And yeah, let's see if that still works.
So, let's have a nifty nop terminated. Um source/shared.c No such file directory where h probably a knob, right? So shared C it's going to be uh protocol C. So because that's also different uh protocol.
Wait, do I have to? So that's going to be the test suite.
So why does it include shared?
Yeah, we probably need that. So that's kind of true.
Let's have source slashtransports.c See uh this is the creation of assert fail expected what hash includes um undefined reference in faith gen block in okay so do we not Say something like knob implementation. We do undefined reference to knob block in set client state. Okay. But we implement knob. So can we say hash include um / third party/nob.h after that.
Okay, that works. Okay, nice.
Uh but it still doesn't work. Share.h H in test suite C. Okay. So it's going to be protocol. But do we need protocol?
No.
All right. So can we still run it closed client TLS handshake failed.
Client change state to tack failed for connection SL new failed. All right. So why does SSL new fail?
Because we don't set the context. So let's say O conts.ontext is going to be equal to the context that we actually created. Um right.
So, and that's a little bit weird. Let's say OTLS dot context like that, right?
All right. And if all of those fail, then it just doesn't work because Yeah.
Right.
Did transport/TLS say anything? No. So it just says SSL initialized but it didn't say ah here. All right. Nice. So let's say TLS initialized or opensl initialized I guess because yeah um like that. And then let's say build let's say faithd and build test suite. And it works. Nice.
Seems to work. So let's have um SL like anything of SL needs to be fully inside of TLS, right?
Read more byes.
Okay.
So we should probably need some kind of extraction over TLS read. So let's say um TLS read and it's going to take in a state and let's have them like this. And let's have TLS um new as well.
And so does SSL new take in anything? No, but it sets the FD and set accept state.
Okay. Okay. Okay. So then let's maybe say TLS uh accept and it will take in the FD.
Right.
Okay. So do we need anything? Like we probably need some other stuff. Okay.
It's actually there is another thing um it's called accept. So let's say new w and also something like ts except and does except take in the fd not really right.
No, doesn't take in the thing.
Okay. But t like the accept should um get the error and return the error, right?
and okay.
Yeah.
Okay. So, um I want to do something like TLS except it's going to return a um SL status code. So, it's going to return an int and it's just going to accept And yeah, so let's have them like this now because of the ends.
And that's going to return the code. All right. And um SSL right. Okay.
should also return the error, right? But SSL read should also return the error, right?
Mhm.
So let's have int and right.
Okay.
read I think it's SSL is a new SL set FD SL set except state except get a ROM right client output empty bio control okay yeah that was that H let's just have a function called like that right so let's have int TLS bio control pending which takes in the state will take in just takes in the state of the client e all All right. I see. Wait.
Right. Okay. So, I messed up TLS context state like the server state and the and the client state. So, all right. So, we need another thing that's going to encapsulate the TLS client state. So maybe let's call that TLS context and and let's have TLS state. TLS state let's return that and let's replace that with TLS context and TLS states TLS context and yeah And this is going to be um TLS states T Skiy welcome.
Cool that you're here. uh let's say SSL SSL and maybe also store the FD with a file descriptor specifically right so SSL new with FD and it's going to return so SSL takes in the context and assigns that.
Okay. So we have to take in the context but we also want the FD but we also need the TLS state FD O state and the this takes in the um TLS state of the like I state and TLS destroy takes in the context. text. All right.
And okay TS write needs to take in the state read except okay so except takes in the context right no income state state Um, and all right. So, what is in here? That still looks good.
That still looks good. And then in here, let's just pass functions. What?
Right. Okay. So, let's say SSL new.
And that's basically that.
So let's say um let's say all states all state is equal to TLS state FT FD is equal to FD and SSL is equal to null.
And let's have a SL SSL is equal to TLS context and SSL.
If not SSL FD um module name as a new failed for client connect for connection with this FD.
Okay. And then like closing the client we have to make sure that we actually do that like in as the caller. And this will say return faith error SSL and um set FD for the SSL DFD for the SSL into the except state. Right?
And then here we say if not TLS or FD is less than zero or all state or not equal or or not all state we'll say return faith error invalid. Cool right and here we will say return return faith. Okay.
And that's it. So pretty easy function.
Okay. So then we can essentially try and do something like TLS um new with FD and then O state is going to be SSL. So that's going to be um TLS basically. So let's say TLS state FD SSL say TLS unknown TLS state. Okay. So TLS context here um free the local TLS state. Okay. So that's in uh enclose, right? and we don't perform a great uh grateful TLS such shutdown exchange with the pier um we should probably have a function like TLS shutdown so yeah so let's have a um f status So TLS shutdown and it takes in a TLS state of the for the state and yeah so state and in here we just copy that and have um state SSL state a cell state a cell.
Yeah, let's say I'm set state zero size of state if not state return faith error invalid unfaith. Okay.
Accept. Do we want to do accept? Okay.
And then in here we say um FH check.
Yeah, we don't really use FH check in this function at all. So we should maybe do something like faith um faith. How do we handle our C's again here? Okay. Okay. So let's say faith status call C is equal to TLS shutdown C cl TLS and if RC does not okay then we will say um result is equal to RC See, and let's also maybe say TLS shutdown failed.
No, nice and in accept. So, let's see.
So SL except we just get the error. So let's say in our CCS SL except with state SSL. So let's say if not state or not state SSL.
So if not state we will say unfaith error invalid. And then maybe if not state SSL return faith error SSL.
I think that's valid and the same for here and also okay so yeah and then we will int um error SSL get error um state SSL RC return error and error.
Oh, I see. Okay.
Get error. Will get error just be one if it's so what is that SSL error want to read error none so will it just return error none if there is no error so let's see SSL get error return values those SSL the TLS operation completed. The result code is returned if and only if red is greater than zero.
Okay, so that's perfect. Um that's what so that's what we want essentially.
Okay. And then we need to say int rc is not really let's say int error is equal to tls uh except with cls and if error is um error none we will say that and and we will say the other things and now we don't have any SSL calls anymore. We just use the SSL things. So that's okay I think. Um okay so TLS accept then TLS read TLS right. So let's see SS right. Um, by the way, in TLS except, do we use that already?
Not really. Accept. What was the function? New with FD, right? So, new with FD. Yeah. Right. So, we don't really use it correctly. Um, so it's going to be TLS of the client.
The context is going to be S uh TLS. FD is going to be client FD.
O state is going to be the client TLS.
This is going to be like that. And this is going to say FH check.
And then if FHRC does not equal to faith K, we will um close the client and continue.
So yeah and SSL right. So let's have a TLS right which will call SSL right and it will just return in red I think.
Yeah.
So we can kind of get the error in here as well. So a road. Okay. So let's just do this very small wrapper which just does if so just does that and returns and okay. So that's kind of a problem. So it needs to also return int and right o and write and int pointer o and right need to be assigned.
So let's say o n right= to zero and o right is equal to n right and return faith. Okay, but that's also a problem because we don't really return faith status codes in here and that's a problem. Oh, so obviously we cannot really return faith status codes.
Um, do we just want to say so is there an SSL error invalid or something?
No.
What's the editor? Is it envel Okay, there's literally not something like SSL error.
Yeah, I'm kind of forced to almost put the ins into a argument, I guess. But I don't want it's it's too it's very very a a weird way to do that.
So maybe we can just return a cell error a cell.
Yeah. So I guess we can use that.
Um my theme is my custom theme which is in my dot files. So you can look it up.
It's in the env folder of the dot files. Yeah.
So let's go to SL accept it was accept right. So except hello TLS except and if it's error none.
So if error is equal to SL error SSL then we will say return faith error SSL right or let's yeah right so just like that I think that's But that's so bad because if we had look because look if we have a real SSL error error. How do we distinguish if we want to print or uh errors or not? Because yeah, that's like [ __ ] ass, you know.
So, do we just want to say something like in max and say uh this? So intmax is returned um on invalid uh argument um fade errors or invalid argument errors.
This does not mean there was an unnecess error something like that.
A return value of int max.
Okay, we need to say that for all of those.
Yeah. Hey, I hope you don't mind me asking, but I have just started learning C as my first language, and I want to know how to improve myself. Um, uh, yeah, I I don't really know to be honest. Probably writing more code could like will improve you. Um, I think writing more code is the answer.
Yeah, but I don't really have like I don't really have a way of like I don't know telling you that how how you could improve because like I improved by just writing more code. So that's the only way I can like tell you what to do like because I know it worked for me. I don't know if it works for you. So yeah.
Um, like, yeah, I'm Italian. Cool. I'm German. Yeah, German.
Pretty German, right? Okay. Um, so yeah, we just return int marks. So that's just a thing we do because then we can safely return with error invalid right I mean I was really inspired by what you are doing and it made me want to make myself better and that's amazing to hear man for real.
Um yeah, just keep going man I guess.
Um okay so state and then in here we also need to say end marks state state no. Oh out buff right. So we need some kind of pointer and we write into obviously.
So let's have um const void pointer buff and it will take const void pointer buff and we will write into buff if not buff. It's also weird.
So yeah, we can simplify that obviously to not state or status cell or not buff because now that they all return the same thing that's what we should do and so I just I think checking state SSL is not even a good thing because SL will also error on that. So I think the only thing we should even do is not is checking not state because that's the only thing that could result in like um uh undefined behavior you know because all of the rest of the arguments are checked by SL like open SL anyways uh will you drop the full envy chat you know envy chat you can look that up it's that config with my theme set which is called blood void. So yeah um so buff clamped all right we we're doing some clamping right so clamped is equal to remaining right okay so but this is more like how much we want to write so we say int n write and let's say n written right so because That's how much actually was written and this is okay.
So this is num in okay I think n write is okay right so let's say n written written and this is going to be int n write and so n written and n written and so n written and this is going to be nr right but in here we say and written.
Yeah. And also they get the error and they also return the error by the way. And that's basically that's basically what we have to do. So that right. Um okay so let's have um TLS right okay state that's going to be CL uh CL TLS and this is going to be CL outbirth plus CL out of and clamped.
So n right is going to be clamped and n written is um so right equal to zero and n right and then we want to kind of fh check.
No we don't want to f check because that doesn't work like that. So we want to say if the um if and right equal to int max we want to continue and say that it's like invalid. No.
Um failed to write percent I byes over the wire invalid arguments specified and there's going to be arrow and we will say and write Okay, this will continue and here we just like it worked you know and error ah okay so this by the way error so error is equal to okay and then we do that okay Cool.
Nice.
Let's not call it Let's Let's say clamped.
Uh, right.
Four arrows left. Client output empty.
So, let's implement that, I guess.
So, If not stage return max states return here. Let's destroy. Does it? Yeah, we already have that. TLS shutdown also works. TLS read. Okay.
So, let's have a So, let's have or not.
Yeah. So, not nothing and is equal to null and Yeah. So let's have int error or int rc is equal to tls bio control pending cls tls cls and okay so this takes in a okay it's actually a state so what's the problem ts pending status so shouldn't be a problem passing const parameter.
Well, because the client is const okay I guess. So let's mark that as const as well because it's a constant operation con const and if our C equal to in max int max then we will return zero and and RC equals zero.
and SSL read is basically the same thing SSL right. So let's just quickly copy read and go into here and say SSL read into t. Okay. So we need a buff and a num.
So point above and numb.
Void points above and num status cell of num.
That's going to be n read and n read should also be returned. So int o n read.
Let's say n read actually because we also set that for right. So let's say int n read and int pointer o n reads and then o n reads and we actually don't need that because we don't return before um is equal to n read.
Yeah, we can just say ONR written because yeah, so all nwritten n read and num is going to be n read and error is going to just be error for n read and we were going to return the error.
All right.
Just like that. That's it.
So, okay.
And then we can just say cl.
So, int and read not really. So is there okay so error so we will need error is equal to and also in and read is equal to zero and then we'll say tls read from cls uh and then tmp size of tmp and n read it can remove that and that.
And if error equal int max return read frame error.
Okay. So it seems like we should not have any cell calls anywhere. Okay. We have them in here.
Okay.
So maybe let's say TLS global in it.
Let's just have a void TLS in it global which takes nothing and just does those functions. So TLS in it and it will have let's actually be cool and say uh voids and voids and yeah so that I will say TLS global Right. Okay. Nope.
Great.
Um, close client FH check failed. Fade errors.
TLS shutdown failed. Fa errors.
Okay. So, what says still a sand check fail? So, who says that? Um, okay. So drive TLS handshake uses TLS accept and TLS accept returns the error from RC.
So, and TLS new from FD new with FD sets does not set all state. So, I keep forgetting that. So, yeah, SL equal to null is equals SL and Okay. So, but okay, I guess.
Okay, that made it work.
So, yeah, seems to be seems to be working.
Yeah.
So, do we still have any SL calls?
No, needs to wait.
Can you show what the app looks like?
Uh, okay, I guess. But the app part is just that currently because and yeah, why is it Arabic? because we are having a custom like text engine and we tested it for various things um and it's very fast and yeah so the UI part like every like you know component is there we can lay out arbitrary text in various scripts in various like everything is like supported you know even like right to left and left to right wrapping And I'm getting cold actually. But um all of the parts are there. But the app UI is not there yet because we have to first implement the entire protocol and like wire and connection setup and stuff like that. I have to quickly go to the call actually. So I'll be right back.
What are you up to? Uh, just calling, you know. I'm back, by the way. Okay, so let's actually open APR and just say get checkout um slashb transport/tls get dot get commit slashm refactor um opensl /tls abstraction in transports get push you origin transport ls why do you avoid AI so much uh because I don't really have a reason to use it currently okay so let's say um abstracted um open SSL call interface um uh into into transport slashts.
Um yeah, the interface is currently only used by the server.
I think that's enough.
Found someone with the same love for lowle systems and control. Using AI for lowle system is like pointing a shotgun at a mirror and directly looking at it as you shoot. For real.
Uh you may not intend to hurt yourself.
Yeah.
Uh merged. Okay. Nice. Uh right.
Okay. So is it like it's we are streaming for a very short time. So I think one thing I still want to implement on the stream. Um let me see.
Yeah. For 1 hour. But the broken mirror shots will hurt you. Yeah. Yeah. Yeah.
Yeah. That's actually the case. Are you serious? I'm not asking him to vibe code fully. You can plant and code along with the AI, you know, and review the code.
Yeah, like you can also not do it. So, it's like why are you not using Neo Vim?
It's so much f like I'm using Neoim by the way, but like it's so much faster.
You will like be so much of a better programmer and in the end software is still [ __ ] you know, people are using Vim and people are using AI, but the software isn't like even better, you know, so I don't really see a point in that.
People are still as dumb as they were.
And yeah.
Okay. So, let's have um something like um what is this comparison? Okay.
Yeah. Like I don't know if it makes you faster then go with it. But um does it produce better software? I'm not seeing that. I'm seeing that software is getting worse, more fragile, more buggy, um less predictable, and also those bugs are harder to find because you have to make sure that your AI has all of the context because you yourself don't even have a way of finding any bugs because you don't know what it's not even your codebase. So you're literally not working. It's not like you cannot say that you wrote this code and this is like you own this code. It's like code that has nothing to do with you at a point. But that's like AI um engineering for me. Basically working with a code base you know nothing about. Um, but I can see the point of using it while still being a good engineer, understanding the code, reviewing the code yourself, knowing how these systems work together. Um, I can still see the point, but like also why should I like stream and um just everything I do is just done by an AI.
So what's the fun in that? Like I'm literally just streaming for entertainment and I don't think that that is entertaining. You know if you fully vibe code yeah buggy software I am just suggesting you can code along with AI reviewing the changes understanding the architecture that's yeah it's a valid thing yeah you can use AI to uh as a tool to help you code review would be much of a responsibility for it too much um of a responsibility for it. Yeah, I think every everybody should make their minds up themselves and I don't really judge anyone, but um yeah, you should definitely not judge someone for not using the tool, you know. Um but yeah, uh so what I wanted to abstract away is something like uh connection.h age because um currently there is something like drive uh client read you know and try read one frame and stuff like that right and read my okay so basically let's call it um h con.h page.
Um, yeah, exactly. That's also the point. Yeah, like I am seeing that in real corporate environments by the way where the project just grows and grows and the people like the actual workers that used to be actual engineers cannot work with the project anymore because they just um because the context size of the AI is just too small. So the project just works until the context size is not um large enough to handle it anymore and stuff like that.
So that's a thing.
Yeah.
Okay. So let's uh we kind of want um also something like frame.h and frame C.
So let's also have them and pragma ones and yeah.
So client read drive client read um flush client output drive plant read flush client out I think yeah that's the are you using rust and c yes both for the UI I'm using rust for the like whole like protocol and stuff I'm and see so this kind of mechanism. Yeah, let's actually have also something like eol.h which provides this mechanism and modify client event mask.
Like the question is okay the server should probably own the clients but is that a thing so yeah drive client reads is a thing that is per client so that's kind of cool because um then we can just pass the kind as argument um okay so let's first implement the eole helpers basically um right so let's have something like pragma once And is there like a generalized word for eole because like naming it eol I mean there is already a file called eole and sis. So maybe like polling, right?
Um I'm using void Linux. Yeah, not Arch.
Yeah, let's just call it EOL. And it will um have something like uh modify client event mask.
Yeah.
Will it take client is the question?
Probably not. Right.
Let's just um copy that function and let's have it. So what does it by the way? But what does it return? Just returns the exit code, right? Or like the error code. Yeah, it would be cool if it just would return the um mask.
Let's make it return the exit code, but um also make it return the O mask. So u mask. Was it called um mask? I don't think so. So int and let's say hash include std in and have o mask and then we don't need the client anymore. So can be fully so let's say e modify EV mask. So modify EV mask and if you want you can quickly ask for suggestions. We may not be as cool as you but we can come up with a solution together.
Um, use eole when ioing is way better.
Um, yeah. Yeah, like I Oh, Uring is probably also cool, but it's more like So, yeah, that that's why I was thinking, should I actually name the file eole?
But it's like very closely tiled to eole. Um, so we could have an abstraction over both and then try and use both. Um, but I'll have to look into IO urang more before I actually adopt it. I also saw that and it's kind of probably very cool, but EOL is like basically the industry standard if you look at other servers. So yeah.
Um, yeah, let's implement the function I guess.
EO and Okay. Yeah, let's just have the signature copied because it's too different.
If not what? If not nothing, we can't really, right?
You can say if not all mask.
So okay. Whating is new but way more efficient. Yeah. So why like can you like uh explain exactly why? Like it would be kind of cool because I don't really know. Um, event meat.
Um, do we need to respecify the data pointer?
We need to Okay. So, I guess let's have bullet point of ptr.
Each function call in e port makes a system call to the kernel which is inherently slow. Ah and oh I see and I I ring just makes one right.
Um but per event or like per what per connection.
Uh okay. So void pointer pointer pointer and then we say mask mask and in here we will say the eole. So this is going to be the eol fd and this going to be the fd.
So FD conflicting I don't think so I guess right so let's just say something like that flicting types bro are you serious okay um but with IO ring you can cue multiple requests and make one system call and the kernel will handle everything. Yeah, that's kind of insanely cool. I don't think you can abstract both eol and urine because under the same interface because they are so fundamentally different. Yeah, I think so too. Yeah. So, but thanks for suggesting we should probably look into that in the future. Yeah.
So is IO can I say something like just I just want to look I don't want to actually do it but IO so where is the header for IO urine IO or is it not even a separate header but it is available on Linux right it's not like an PSD only or something read frame got byes um okay So EO we mostly use it for the modifying of the event mask but uh okay so CTL bell it's also kind of used.
Mhm.
Um I guess so let's have a function for that. EO Dell FD and it will say it's only for Linux. I don't remember the header file name though I haven't used it in a while. Okay. Yeah, makes sense.
Efd and FB.
and pass that and f and let's just copy that and return it equal of the of That's okay.
Yeah.
Okay. And so let's have an actual like something like drive client read, you know.
Let's actually have that function in uh in like connection uh let's actually call it like something like that. So con drive client read you know um so drive client read conclver state it should like handle its own state but what state does it need is the question.
So it needs the um server config.
Interesting.
Um right, it dispatches into handle frame from the server. Then let's actually call it okay. I think drive client read is okay you know why is there always the architecture man um bro okay modifying the event mask if um that's okay and modifying the event mask here so the main thing so I have a disconnect client so I disconnect client Um so the main thing that happens is if the frame is uh valid we call handle frame.
But we can also just not do that and just return something you know like return the read code right. Okay. So try read front frame. Um try pass frame from buffer. So I think that's like even more lowle. So let's actually try and port that first.
Yeah. Great. Okay.
So let's just port that into frame.
So let's have a frame try read full try full read and that's going to be frame read result.
So, and it's going to be type def because we will have def frame can I say? Yeah.
So read frame frame read and so yeah frame read result frame read result faith frame.
So this should probably be something in like protocol. So let's actually for now include protocol and yeah why do we need this config?
It's it's so weird probably because of verbose logging. Yeah, right. So we need to carry that everywhere.
Yeah.
Do we want to carry it? I guess.
Um and client cont.
Oh yeah. So I think client cont is a thing that is in con So I think that makes sense. Client con.
Okay.
That's kind of too large, you know, um because a lot of this is not related to transport.
So yeah, we kind of need some kind of smaller structure um that we can use only for transport.
So try pass frame from buffer. So let's say try pass one one frame one frame try read one frame. Uh let's just copy it and see what we will need.
Um because so okay so what so we need the connection ID we need the inbuff and stuff like that okay so this is stuff that should be handled by the connection right um yeah so all of this makes sense all of this makes sense so let's let's have something like type strruct Contport connection and it will have everything that is actually needed for transport like out Q and NQ.
So maybe let's also have something like type defrct and then we will say out will just be so out will be nothing and this will be transport QT and And we will have transport QT. Transport QT QT QT um in and out.
And then we will only need the um FD and the the FD and the what the what FD and ID or something like that. So con ID. Yeah.
So con id and um fd which will be int fd like that.
And then in frame we can accept a transport uh connection which will be the connection and a frame.
So transport connection connection declaration of strruct server config.
Okay. So let's ignore that for now.
Let's say something like B log balls because that's the only thing we need log verbose and let's say log verbose and we say log let's say verbose logging because yeah so verbose logging and verbose logging This will be con. So let's just say cl will be con.
That fixes a lot of those errors. And read frame will be frame reads.
Um try pass that. Okay.
So and then in so in um that will be in dot and out.
So okay only in makes sense. Uh this going to be without cfg this going to be frame read result server read more sl bytes will be um what we created. So TLS actually not right because read more bytes is another function.
So probably in con yeah that's a thing we should um how are we going to achieve instant messaging? Yeah we're basically architecting it in a way that I can use the entire thing. By the way we already achieved instant messages so I can't wait. Uh so I can use the entire thing for real instant messaging and um basically implement something like u message layer security type uh protocol on top of my current protocol right so I can uh connect to the server right and the server can I just quickly say dashv uh I think that's not a thing anymore okay so then let's have the so this generates a like handshake with our custom protocol which is basically like ooth you know and authorizes the client and then we can send their message request they can sign the request and accept it and we say hey and they say uh they get hey right so that's what we currently have but we want to have a real conversation system that's going to be powered by some sort of MLS um adjacent protocol that we're going to be implementing.
And for that, I want to have the code base at a point where things are correctly abstracted away so I can reuse stuff. Uh the font I'm using is um Yusfa not font. Yosef not font.
Yeah.
So server read more cellbyes is definitely a thing of con now. So let's actually go into FD and say server read more cellbyes and let's copy that kind of and let's go into con and um this is going to return a frame read result.
Okay, it's actually Yeah. So, the frame read result is kind of not really about frames, right?
So, that's kind of a bummer, right? Um, do we still want to do as if it's about frames because it's kind of convenient?
Yeah, let's just do as if it was about frames, I guess.
Do we need cfg in here? Server and cube bytes. Yeah, we kind of need So, let's say we're both logging.
That's an interesting protocol you have there. Yeah.
Thank you, man.
Okay. So, frame read results and unknown type name bool.
My favorite error. You get that error, you know that you're a real software engineer.
I don't like C as much. Uh I'm a C++ and Python dev. Okay. Do you uh intend to make a library for this protocol that can be used by external project? Is that your goal? Not really. But there is a client library that you can use to connect to the protocol and to the server. But you're doing really cool thing. Thank you, man. Have you tested this over a real network or only locally? only locally currently because we're still not that far, you know, we have to do a bunch of [ __ ] Uh, transport conte is unknown type because they are including themselves and stuff like that. Okay, interesting. So, okay, I give up. We just will not pretend that it's about frames and we'll actually say something like uh so frame so frame reads is going to be con read and this is going to be con isn't it hot out there you what do you mean out there so it's actually kind of cold today that's why I'm in a sweater or an exit Um, okay.
So, this is going to be let's actually quickly let's comment that out.
This going to be uh con read result and in frame we will have frame reads is going to be con reads and um ever tried making a code editor?
Yeah.
I even have videos about that. I think I have one video.
Uh frame rate read is going to be con read and server read more sittes and cfg. So let's you know let me check go ahead try pass frame from buffer.
Okay.
Read more SL byes. Is that and that's going to be con and verbose logging. So, and cool. Nice. Uh, so server reads byes was that. So, let's say con read more SL byes.
All right.
And we will have a con read result.
And it will be in here and it will include con.h declaration of client con. Okay. So, we want a transport con transport connection. Bro, what is up with my mouse? Um, so strct and um this is going to be a uh transport connection.
And let's uh zip that into the other file like that. And let's say read frame is going to be con read and that's going to be only that error is equal to int max cls.
So that is true. We should have a that's con by the way. We should have the TLS state be part of the transport connection. So I think you cannot really argue against that because it's deeply intertwined.
Okay.
Hello. What's up? H8 D13. Welcome to the stream.
Um, thank you. You need to try using Emac sometimes. Um, sometime. Yeah, probably. I don't know. Maybe, maybe not. TLS. Okay, let's have that not be a pointer.
And yeah, so I would totally agree with you, but only the thing keeping me from linking cable sources. Also, are you talking about the GUI text edc?
Yes.
Well, Python. Okay.
So, and Q inputs by using env. Yes.
So limits.h um so don't need that right. So we will need NQ input bytes.
So it's definitely part of con. So let's say um NQ NQ uh NQ input bytes and okay NQ output bytes. We should probably have one function for that.
So let's just only um have NQ input BS and this will have uh this will say con NQ input BS.
Should I try learning C? Do it. Yeah, I spense. Okay. You absolutely should only try Emix when you have a lot of free time.
Yeah, I don't really Yeah. What do I have? I don't know if I want to spend my time with that. Um, so let's say verbose logging.
And let's do we want to have separate function input and output probably.
Right.
But internally internally let's more likely have something like con and q bytes you know and cube bytes and okay we have those byes but we can encue it into a transport queue you know and then we don't even need to pass the client at if everything works correctly. So, so let's have a client uh let's have a transport Q and yeah and then let's have that here.
Let's copy all that.
paste it.
And so CL, what's CL going to be? CL is going to be Oh my [ __ ] god, bro.
Okay, so can I say CL in here? Probably not really. So let's just say CL like that is going to be um okay by the way trying to end Q right so let's hash hash define a module name as we did before transport slashcon one and in here let's say module name and nothing more basically only that because it's not linked to a client so n bytes and is n bytes it's a size t okay but okay everything's good hey boss welcome um only sorting is single-handedly carrying the popularity for emacs is this new generation of in this new generation of programmer slow.
True. I just don't like it because I'm kind of careless and I can't manage memory that good and as I'm having my summer vacations. So yeah, I will give it a try. I already know basics like control statements.
Yeah, I should. You should give it a try, man. Sorting is from the 2000s after all. He saw computing reach this level of power with his own eyes basically.
Yeah, I probably subbed to you a month ago. I think it was also in your stream tomorrow in the last 30 minutes. You mean yesterday?
What was in or are you talking about my my stream?
Uh or like I'm kind of Yeah, my stream yesterday. You mean did I stream yesterday? No, I didn't stream yesterday, right?
Okay, so verbose logging.
So, we should probably still keep that, by the way. So, verbose logging. Verbose logging. Um, try to encue zero length inputs. That's a good warning. So, let's keep that. And let's have uh logger name.
Okay. Con. Yeah, that's going to be Q, right? So Q size and Okay. Now CL in should clin should just be Q.
Okay, that fixes a bunch of things. Um, successfully encued input bytes. So, let's say uh module name module name and we successfully encued that many bytes.
Oh, two days ago. Yeah. And like what was this 30 minutes uh the last 30 minutes uh about um okay I would love to learn Rust would take a few days probably but I just love the simplicity of seeing I feel you. I feel you. I learned Rust for that project as well. So I don't didn't really learn it at all. I just started writing Rust. I don't know. It's like if you know a lot of programming languages, you just really learn while actually writing. So it's like you write a thing once and you already know how it works and it's like pretty easy to learn a language I think.
But to really understand it obviously like it's not I wouldn't say that I'm a Rust pro, you know. Yeah.
um server and Q input bytes. Still don't have that. That makes sense.
Um right. So what we should do is con nq bytes conin and con.in in and it should take byes and verbose logging should be verbose logging.
Nice. So, we actually just Yeah. did that. That's amazing.
Nice.
Any like tips so I don't get confused during the memory fixes and leaks?
That's my weakness.
I don't Yeah, just use Melican free.
Yeah, melanin free is the way you will not have any like issues um um after that probably. So, it's all going to be fine. Don't worry. Don't worry, champ. Oh my god. Why is it doing that?
Okay, but it doesn't matter, right?
Because it's just a space that is not inside the string. So everything's good.
Um, yeah.
Does this look good? Does this look good? Um, yeah, looks good.
Now try frame. Try full read, right?
Okay. So, read my SSL bytes. Do we have that? Read more SSL byes. And does it work? Read my cell bytes.
seems to right.
So now we should be able to say con read more SSL byes.
Uh I'm trying to run.
Okay. Instant messaging. Imagine having to learn new things every time a new update comes out. I learned C++ 17, but now there's so much stuff that I don't want to be bothered when I can utilize my time working instead.
I see. Yeah, that's a bummer.
Um, right. Okay. So, let's implement try pass frame from buffer. Um, I think try pass frame from buffer is literally just decoding a buffer.
Um yeah, literally that's still implemented. Uh try So yeah.
Let's have that. Let's have uh frame try parse from buffer.
Are you also trying to make the GUI because I can see frame C and frame.h.
Um, that's actually about the protocol framing um with like binary frames. Oh my god, I thought I was like [ __ ] um I closed my window manager or something.
Uh so basically I have the GUI also. Uh cannot open resource. Okay, so cargo run the GI is looking like that currently because we are building our own like UI framework and rendering engine and Vulcan is yeah so it's literally a Vulcan implementation you know but the UI that's going to be the UI of you know so that's actually okay let's actually quickly do that side quest I just I just need that kind of dopamine [ __ ] let's remove uh all of this testing because of like the Arabic characters we tested because we had to do layouting. Okay. So, let's say faith instant messaging. Messaging is it written like that? Messaging.
Yeah.
Um drink coffee I guess.
Okay. And then Lauram ipsum. Let's not do that.
And also the layout time. That's that's like a debugging thing, right? So let's let's not um let's just so let's just render the text wrapped and let's don't do that.
Let's don't have the image because the image is basically unrelated. Uh load the fonts I guess. Do we need base font and mixed? So what is that's going to be font handle? But why are there two vendor wrapped font handle? So why are there two still?
Ah that's just a string.
Okay. So let's remove that. And let's say base font. Let's load that first.
And let's remove that. And let's say um faith instant instant messaging.
And right. Okay. So image width and image height. We don't need that. Can we do we have a way to get Yeah, we have one. So we can just say okay let's just say 50/50 for now. So 50.0 50.0 and what is that base font and max width uh let's say minus 50 um faith instant messaging.
Okay. So let's say let's have something like let cursor is equal to uh 50 and let's uh [ __ ] layout and I think the layout gives us width and also height maybe. Yeah.
And then we say uh cursor plus equal and then that padding is equal to let's say padding is equal to 10.
Uh and we will say plus equal layout dot height.
We cannot bro. Holy rust. Holy rust. Is it like that? I already forgot.
Okay. And then we say um cursor padding plus padding.
Let's can I is there?
Okay. So, and then Okay. So, can I just say can I just say something like cursor plus equal that dot width or is Russ going to [ __ ] itself?
Uh cursor plus padding plus padding.
send a new or like send message.
Uh did you write a lot of things? I think uh they send it.
I might be here every stream, but I will keep supporting Coco Cran. Nice.
Thank you.
Okay, that's great actually. So that's amazing. Uh we should obviously say 50 cursor. So I'm just saying 50 cursor.
All right. So okay, so we did left good one, right?
Okay.
So I think now we cannot really say anything.
You making your own GI library. Yeah, using Vulcan. Yes, it says that's what we did in in Rust in the earlier streams. You can look those up.
I have a slight feeling that height is never correctly assigned.
So where was uh render wrapped does a baseline layout layout cached which takes height and height is just line.length times line height.
Isn't that kind of hot? Yes. I use both OpenJ and Vulcan. I have both backends.
So we can So we have a Vulcan and a uh So Vulcan is [ __ ] 4,000 lines of code and OpenGL is like 1,000. So it's Yeah, we have both back ends.
Uh that's a hard thing to do using OpenGL or what what is going on here?
Let's actually print the height. So is there I think it might actually just be zero because it looks like only padding is contributing. How do I print stuff again? So can I say hi? So let's say let's layout and it's going to be layouts height.
Okay. We have to that rust 33. So that makes fullon sense 33 makes sense, right? Um so can I say plus layout.
Uh so is rust just not working like that? So can I not say plus equal that?
So that should work right. So plus heights.
Okay. So what was the problem? Because of the padding.
That can't be the case.
cursor is equal to. Oh, I see.
Okay, I just did a little bit of an oopsy doopsy, you might say. So, let's have the padding be zero. And by the way, what I wanted is I can probably load a um Jet brands mon font regular regular.
So what do we we use only that. So let's actually remove all of those um color emoji and regular. Okay. So do I have not sums user share fonts?
Can I say FC?
How do I FC list?
Okay. So in user so CD user share fonts not to noto and let's say p sudo copy I don't know if I have to sudo that probably not suns um boldttf into checkspace slash assets That's if I were a good uh person, I would probably have muted my mic. Hello, handsome coder. Welcome to the stream, man. Overshot.
Uh, welcome. Welcome.
Hey, after uh you're done with this project, you can try to make a programming language like Python, of course, simpler in C, Rust. Yeah, maybe.
I don't know. Um, maybe I'll never be done with this project in the first place. So, yeah.
Okay. So, let's load a bold font.
Bold.
And then we will render. So, uh, [ __ ] bold fonts.
Will it crash? Oh my god, bro. It literally just works. Um, right. So, let's do a cool thing where we just say, um, is there text dot [ __ ] dimensions or something? Or how did I [ __ ] call it? I don't even remember. Uh, measure probably. Yeah, measure, bro.
Is there not text measure?
Oh my goodness.
Is there really not a function to measure text?
I think there might not be.
public or pop fn load font render render wrapped new only that and if no font supports a gly it is not rendered the given font is the preferred font to render glyphs with if a graffine cluster is not supported yeah okay But sir, why did you not implement a measure function?
Right.
Oh.
We could just call that function to do that because this is measuring.
Um, yeah, I think that would be good. Let's have pop fn measure.
And it takes in those things.
So it basically does ex it just calls it's just a a different it's just a flavor of layout cached. So measure and can I just say layout cached.
Yeah. Nice.
Um so let's say um so let's say let um dimensions is equal to text dot measure send message with base font and options being So how do I do that again? Text layout options can like construct it like this.
Max width is equal to um yeah. So let's let's have also a function measure that's just simpler. So let's say measure wrapped or measure with options and this will be just measure and it just won't take in options and it will provide default options. So self dot measure with options and the options will be text layout options um and max swift is just going to be zero. What is the no value for max width? Max width fan render.
Um current is not equal to okay but seal so let's just say Maxith I don't know let's just say is equal to [ __ ] [ __ ] okay. Let's first try zero because I don't remember is Max with what is the type of Max with F32.
So maybe I can just say negative one.
How do you do that in R like that? Nice.
Um but let's first try zero and see if just yeah how it behaves, you know. Uh, and then let's call measure with base font and let's say print ln dim like x and then dim dot dot width dimight.
What are your specs? You mean my PC specs?
um p fetch like my PC specs. I don't know how you see that on Linux.
Uh I don't know. Is there neo fetch?
No, it's not found. I don't know. Like in Neo Fetch, you can see that. But P fetch probably there is some way. He is stressing out. So guys, we should shut up and let him.
It's okay. It's okay. No problem. You can always write in the chat. It's there for you to write in. So, um, okay. So, the size seems correct. Okay.
So, that's great. Um, send message. And what I want to do, so the thing I even want to do is now that I have the dimension, we can say um height minus uh dim.ight minus padding.
And here we can say width minus dim.width divided by two.
And what's your issue? You cannot subtract. So how do you do that again in rest? How do you cast [ __ ] to really don't know F32 RVski cast U32 to F32 Rust?
Can you just tell me? Is it? Is it? Oh my god, bro.
S ass.
Thank you.
Um, value curse. Okay, so we don't need curse anymore. That's correct. Thank you, Mr. Rasboro or something like that.
I don't know.
using a let Yeah, no problem.
Right. So, that's what I wanted to do.
Great.
So, that's what I wanted to do. That's all. Like, Right. So, that's all. Uh, we can't like I'm just messing around, you know. And by the way, the size seems incorrect.
Right.
So the width seems kind of incorrect. Is it because it's wrapping in the So let's actually not render rep. Let's render normally. And this will not take in that.
Okay.
So okay it takes the thing like that I'm using void Linux as a strong um send okay and text domeasure let's try [ __ ] 9999 okay so it actually was wrapping so yeah what if we have negative one it stops working. So do we actually just want to say F32D max? Is there something like that?
SCD F32 max rate.
And let's have padding be something like oh it's not even anything. So 10 noise. Uh maybe like even 20 maybe even 50 because we have 50 on top right.
H can we have an emoji?
Emoji close.
Copy. Okay. So, can we say good job? Yeah. Yeah. [ __ ] good job.
Yo, no. It's It's very It's just I'm trying to uh Do we want to have it wrapping in here? Probably not. I'm just trying to do something that is not too hard, you know, um, and maybe a lot a little bit more entertaining um, than just [ __ ] rewriting my C codebase.
So, can we can we do that? What will you do with this project after it's done?
deploying it, you know, deploying it and then actually using it.
I want to have a alternative to um to actually control for myself for instant messaging. I want to actually uh have a mobile app that I will download and that my friends will download and we want we will write, you know, WhatsApp. Yeah, it's basically like WhatsApp. Yeah.
Um let's say emoji font is the font we want to use but it should yeah it should kind of infer that from fallback fonts automatically GPU and UI is going to be like [ __ ] mute UI and mute where can I buy the IPO? What's the IPO?
Uh, I don't know. You mean the app?
It's not out yet, man. It's loud.
Um, okay. So, I can render that emoji.
Uh, I want to however render it at um text.
I want to render it at let's dim one. I I by the way, it's just for funsies. you know this code is just so that the um people opening it on GitHub maybe uh if they want to build it they don't see that abomination that was there before you know so let's say dimmed one dot uh width and we will say width as f32 minus -50 and let's not padding because we don't even use it. So yeah, like that. And then maybe Great. So cool.
This can happen, but I don't care. Um, amazing. Okay, enough UI work.
Like, why this was Okay, cool. I guess um pro wants to talk business right away. What does IPO?
What does IPO mean?
Initial public offering is a process where private company first sells share of K. Amazing. Had a similar idea, but I forgot it. It came to me around 12 a.m.
by the way. All right. But you forgot it. So yeah, I have three ideas. One is brewing and I need to start on two. It's very fun to create stuff. It is.
Okay, let's quickly finish quickly finish that and then I will kind of, you know, need to go eat and stuff like that.
Yeah.
So, do we have trip? Yeah, we have that.
So, let's just have it in here.
and have that and say but not let's not destroy the server so the server can still work even though this API exists you know because I want to omit that but without destroying the server essentially um faith decode frame frame pass from buffer.
Um, I know a little bit of Java. Java was the first language I ever coded in, by the way.
So, yeah.
Uh yeah, bye all tech at was great with uh you in the stream. Uh I will end the stream in a minute as well because yeah, I think we're we're actually done here.
So I think yeah, the last error was just fixed.
Um let's quickly have a WIP. So WIP transport reflector in Java. Yeah, it's insanely annoying.
Um WIP so let's say refactor work in progress.
Um separate. So transport module abstraction layer.
Holy wording. Holy wording. Um my first language was Scratch. Oh, nice.
Yeah, Scratch is cool. Scratch is cool.
I never really did Scratch, though, but I think it's cool.
this PR changes um introduces um uh you doing stream tomorrow um I don't know I cannot say yeah maybe not introduces um multiple files to handle abstraction of transport/wire functionality to intro into full abstraction of transport/wire functionality. Yeah, I think that's enough.
Why don't you see use C++? Why don't you use Erlang?
Use Erlang, bro. It's the new thing.
Um, right. Okay. Cool. Cool. Cool.
So guys, um I'm going to end the stream now. It was very cool, cool stream.
Uh yeah.
Related Videos

TOP 15 Data compression Interview Questions and Answers 2019 Part-2 | Data compression | Wisdom jobs
wisdomjobs
281 views•2019-06-28

CTS 158: 802.11w Management Frame Protection
ClearToSend
4K views•2019-02-04

NDSS 2019 Send Hardest Problems My Way: Probabilistic Path Prioritization for Hybrid Fuzzing
NDSSSymposium
496 views•2019-04-02

How realistic is Cities: Skylines?
CityBeautiful
159K views•2019-02-14

GUIs & TUIs: Choosing a User Interface for Your Python Project | Real Python Podcast
realpython
2K views•2025-04-04

The OSI Model - Explained by Example
hnasr
225K views•2019-05-12

Cloud Computing - Introduction
elithecomputerguy
98K views•2019-10-07

From Traveler's Dilemma to Dynamic Routing | Demystifying Networking
IITBombayJuly
5K views•2019-08-04
Trending

WOW! Judge TURNS THE TABLES on Trump in His OWN $10B LAWSUIT!!!
MeidasTouch
197K views•2026-07-23

Playstation NO DISC/NO BUY Fight Is Over...
DavidJaffeGames
4K views•2026-07-23

Steam and Xbox Just Dropped The Hammer On PlayStation
OhNoItsAlexx
9K views•2026-07-23

Americans Confused in Australia for 17 Minutes Straight
IWrocker
17K views•2026-07-23